Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to 1.18.2 #166

Merged
merged 2 commits into from
Apr 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
apply from: 'https://raw.githubusercontent.com/TerraformersMC/GradleScripts/2.1/ferry.gradle'

repositories {
// mavenLocal()
mavenLocal()
maven {
url "https://maven.jamieswhiteshirt.com/libs-release"
content {
Expand All @@ -31,8 +31,8 @@ dependencies {
include modImplementation("com.jamieswhiteshirt:reach-entity-attributes:${project.reach_entity_attributes_version}")
}

minecraft {
accessWidener = file("src/main/resources/campanion.accesswidener")
loom {
accessWidenerPath = file("src/main/resources/campanion.accesswidener")
}

subprojects.each {
Expand Down
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ org.gradle.jvmargs=-Xmx1G
maven_group=com.terraformersmc
archive_name=campanion

minecraft_version=1.18.1
yarn_mappings=1.18.1+build.3
loader_version=0.12.11
fabric_version=0.44.0+1.18
dossier_version=0.5.0
minecraft_version=1.18.2
yarn_mappings=1.18.2+build.2
loader_version=0.13.3
fabric_version=0.51.1+1.18.2
dossier_version=0.6.0
reach_entity_attributes_version=2.1.1
#gravestones_version=v1.9
trinkets_version=3.1.0
trinkets_version=3.3.0

# Project Metadata
project_name=Campanion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt
tag.putLong(CLICKED_POSITION_KEY, pos.asLong());
}
}
if (ItemTags.PLANKS.contains(stack.getItem()) && this.incrementBridge(world, player, be, pos, true) && !player.isCreative()) {
if (stack.isIn(ItemTags.PLANKS) && this.incrementBridge(world, player, be, pos, true) && !player.isCreative()) {
stack.decrement(1);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class FakeWorld extends ClientWorld {
public FakeWorld(ItemStack stack, BlockPos basePos, int lightOverride) {
super(CLIENT.player.networkHandler,
new ClientWorld.Properties(CLIENT.world.getLevelProperties().getDifficulty(), CLIENT.world.getLevelProperties().isDifficultyLocked(), CLIENT.world.getLevelProperties().isHardcore()),
CLIENT.world.getRegistryKey(), CLIENT.world.getDimension(), 3, 3, CLIENT::getProfiler,
CLIENT.world.getRegistryKey(), CLIENT.world.method_40134(), 3, 3, CLIENT::getProfiler,
CLIENT.worldRenderer, CLIENT.world.isDebugWorld(),
((AccessorBiomeAccess) CLIENT.world.getBiomeAccess()).getSeed());
updatePositioning(basePos, lightOverride);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void draw(RenderLayer layer) {
boolean bl = Objects.equals(this.currentLayer, layer.asOptional());
if ((bl || buffer != this.fallbackBuffer) && this.activeConsumers.remove(buffer)) {
if (buffer.isBuilding()) {
buffer.setCameraPosition(0, 0, 0);
buffer.sortFrom(0, 0, 0);

buffer.end();
layer.startDrawing();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.terraformersmc.campanion.config;

import com.terraformersmc.campanion.Campanion;
import com.terraformersmc.campanion.item.CampanionItems;
import com.terraformersmc.campanion.tag.CampanionItemTags;
import dev.emi.trinkets.api.SlotType;
import dev.emi.trinkets.api.TrinketsApi;
import net.fabricmc.fabric.api.util.TriState;
Expand Down Expand Up @@ -49,9 +51,7 @@ private static void load() {

if (FabricLoader.getInstance().isModLoaded("trinkets")) {
TrinketsApi.registerTrinketPredicate(new Identifier("campanion", "backpacks"), (stack, ref, entity) -> {
SlotType slot = ref.inventory().getSlotType();
Tag<Item> tag = ItemTags.getTagGroup().getTagOrEmpty(new Identifier("campanion", "backpacks"));
if (tag.contains(stack.getItem())) {
if (stack.isIn(CampanionItemTags.BACKPACKS)) {
return config.isTrinketsBackpacksEnabled() ? TriState.TRUE : TriState.FALSE;
}
return TriState.DEFAULT;
Expand Down
136 changes: 68 additions & 68 deletions src/main/java/com/terraformersmc/campanion/data/CampanionData.java

Large diffs are not rendered by default.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ public class MixinMinecraftClient {

@Inject(method = "handleInputEvents", at = @At("HEAD"), cancellable = true)
public void handleInputEvents(CallbackInfo info) {
if (this.player != null && this.options.keyAttack.isPressed()) {
if (this.player != null && this.options.attackKey.isPressed()) {
ItemStack stack = this.player.getMainHandStack();
if (stack.getItem() instanceof PlaceableTentItem && ((PlaceableTentItem) stack.getItem()).hasBlocks(stack)) {
if (this.options.keyAttack.wasPressed()) {
if (this.options.attackKey.wasPressed()) {
this.player.networkHandler.sendPacket(C2SRotateHeldItem.createPacket());
}
info.cancel();
Expand Down
19 changes: 10 additions & 9 deletions src/main/java/com/terraformersmc/campanion/recipe/TarpRecipe.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.terraformersmc.campanion.recipe;

import com.terraformersmc.campanion.item.CampanionItems;
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
import net.fabricmc.fabric.api.tag.convention.v1.ConventionalItemTags;
import net.minecraft.inventory.CraftingInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
Expand All @@ -26,9 +26,9 @@ public boolean matches(CraftingInventory inv, World world) {
int shearAmount = 0;
for (int i = 0; i < inv.size(); i++) {
ItemStack stack = inv.getStack(i);
if(FabricToolTags.SHEARS.contains(stack.getItem())) {
if(stack.isIn(ConventionalItemTags.SHEARS)) {
shearAmount++;
} else if(ItemTags.WOOL.contains(stack.getItem())) {
} else if(stack.isIn(ItemTags.WOOL)) {
woolAmount++;
}
}
Expand All @@ -48,7 +48,7 @@ public DefaultedList<Ingredient> getIngredients() {
list.add(Ingredient.fromTag(ItemTags.WOOL));
list.add(Ingredient.fromTag(ItemTags.WOOL));

list.add(Ingredient.fromTag(FabricToolTags.SHEARS));
list.add(Ingredient.fromTag(ConventionalItemTags.SHEARS));
return list;
}

Expand Down Expand Up @@ -77,14 +77,15 @@ public DefaultedList<ItemStack> getRemainder(CraftingInventory inventory) {
DefaultedList<ItemStack> defaultedList = DefaultedList.ofSize(inventory.size(), ItemStack.EMPTY);

for(int i = 0; i < defaultedList.size(); ++i) {
Item item = inventory.getStack(i).getItem();
ItemStack stack = inventory.getStack(i);
Item item = stack.getItem();
if (item.hasRecipeRemainder()) {
defaultedList.set(i, new ItemStack(item.getRecipeRemainder()));
}
if(FabricToolTags.SHEARS.contains(item)) {
ItemStack stack = inventory.getStack(i).copy();
if (!stack.damage(1, new Random(), null)) {
defaultedList.set(i, stack);
if(stack.isIn(ConventionalItemTags.SHEARS)) {
ItemStack copy = stack.copy();
if (!copy.damage(1, new Random(), null)) {
defaultedList.set(i, copy);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
package com.terraformersmc.campanion.tag;

import com.terraformersmc.campanion.Campanion;
import com.terraformersmc.campanion.mixin.AccessorBlockTags;
import net.minecraft.block.Block;
import net.minecraft.tag.Tag;
import net.minecraft.tag.TagKey;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;

public class CampanionBlockTags {
public static final Tag.Identified<Block> LAWN_CHAIRS = get("lawn_chairs");
public static final Tag.Identified<Block> TENT_SIDES = get("tent_sides");
public static final Tag.Identified<Block> TENT_TOPS = get("tent_tops");
public static final Tag.Identified<Block> FLAT_TENT_TOPS = get("flat_tent_tops");
public static final Tag.Identified<Block> TOPPED_TENT_POLES = get("topped_tent_poles");
public static final Tag.Identified<Block> TENT_POLES = get("tent_poles");
public static final TagKey<Block> LAWN_CHAIRS = get("lawn_chairs");
public static final TagKey<Block> TENT_SIDES = get("tent_sides");
public static final TagKey<Block> TENT_TOPS = get("tent_tops");
public static final TagKey<Block> FLAT_TENT_TOPS = get("flat_tent_tops");
public static final TagKey<Block> TOPPED_TENT_POLES = get("topped_tent_poles");
public static final TagKey<Block> TENT_POLES = get("tent_poles");

private static Tag.Identified<Block> get(String id) {
return AccessorBlockTags.callRegister(Campanion.MOD_ID + ":" + id);
private static TagKey<Block> get(String id) {
return TagKey.of(Registry.BLOCK_KEY, new Identifier(Campanion.MOD_ID, id));
}

public static void load() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
package com.terraformersmc.campanion.tag;

import com.terraformersmc.campanion.Campanion;
import com.terraformersmc.campanion.mixin.AccessorItemTags;
import net.minecraft.item.Item;
import net.minecraft.tag.Tag;
import net.minecraft.tag.TagKey;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;

public class CampanionItemTags {
public static final Tag.Identified<Item> MARSHMALLOWS = get("marshmallows");
public static final Tag.Identified<Item> MELTED_MARSHMALLOWS = get("melted_marshmallows");
public static final Tag.Identified<Item> MARSHMALLOWS_ON_STICKS = get("marshmallows_on_sticks");
public static final Tag.Identified<Item> SPEARS = get("spears");
public static final Tag.Identified<Item> BACKPACKS = get("backpacks");
public static final Tag.Identified<Item> LAWN_CHAIRS = get("lawn_chairs");
public static final TagKey<Item> MARSHMALLOWS = get("marshmallows");
public static final TagKey<Item> MELTED_MARSHMALLOWS = get("melted_marshmallows");
public static final TagKey<Item> MARSHMALLOWS_ON_STICKS = get("marshmallows_on_sticks");
public static final TagKey<Item> SPEARS = get("spears");
public static final TagKey<Item> BACKPACKS = get("backpacks");
public static final TagKey<Item> LAWN_CHAIRS = get("lawn_chairs");

public static final Tag.Identified<Item> TENT_SIDES = get("tent_sides");
public static final Tag.Identified<Item> TENT_TOPS = get("tent_tops");
public static final Tag.Identified<Item> FLAT_TENT_TOPS = get("flat_tent_tops");
public static final Tag.Identified<Item> TOPPED_TENT_POLES = get("topped_tent_poles");
public static final Tag.Identified<Item> TENT_POLES = get("tent_poles");
public static final TagKey<Item> TENT_SIDES = get("tent_sides");
public static final TagKey<Item> TENT_TOPS = get("tent_tops");
public static final TagKey<Item> FLAT_TENT_TOPS = get("flat_tent_tops");
public static final TagKey<Item> TOPPED_TENT_POLES = get("topped_tent_poles");
public static final TagKey<Item> TENT_POLES = get("tent_poles");

public static final Tag.Identified<Item> FRUITS = get("fruits");
public static final Tag.Identified<Item> GRAINS = get("grains");
public static final Tag.Identified<Item> PROTEINS = get("proteins");
public static final Tag.Identified<Item> VEGETABLES = get("vegetables");
public static final Tag.Identified<Item> MRE_COMPONENTS = get("mre_components");
public static final TagKey<Item> FRUITS = get("fruits");
public static final TagKey<Item> GRAINS = get("grains");
public static final TagKey<Item> PROTEINS = get("proteins");
public static final TagKey<Item> VEGETABLES = get("vegetables");
public static final TagKey<Item> MRE_COMPONENTS = get("mre_components");

private static Tag.Identified<Item> get(String id) {
return AccessorItemTags.callRegister(Campanion.MOD_ID + ":" + id);
private static TagKey<Item> get(String id) {
return TagKey.of(Registry.ITEM_KEY, new Identifier(Campanion.MOD_ID, id));
}

public static void load() {
Expand Down
2 changes: 0 additions & 2 deletions src/main/resources/campanion.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
"compatibilityLevel": "JAVA_17",
"mixins": [
"AccessorBiomeAccess",
"AccessorBlockTags",
"AccessorItemTags",
"InvokerCriteria",
"InvokerBlockEntity",
"InvokerEntity",
Expand Down