From f0ed3f86fbc5234968472ba5920e9cc0ff9c1913 Mon Sep 17 00:00:00 2001 From: "Killar.exe" Date: Sun, 4 Feb 2024 16:14:13 +0100 Subject: [PATCH] Path bugs. --- .../github/killarexe/copper_extension/item/WaxableItem.java | 2 +- .../killarexe/copper_extension/fabric/mixin/ItemMixin.java | 4 ++-- .../killarexe/copper_extension/forge/event/CEEvents.java | 2 +- .../killarexe/copper_extension/forge/registry/CEItems.java | 4 ++++ 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/common/src/main/java/github/killarexe/copper_extension/item/WaxableItem.java b/common/src/main/java/github/killarexe/copper_extension/item/WaxableItem.java index 03b7390..1881e15 100644 --- a/common/src/main/java/github/killarexe/copper_extension/item/WaxableItem.java +++ b/common/src/main/java/github/killarexe/copper_extension/item/WaxableItem.java @@ -45,7 +45,7 @@ public InteractionResult useOn(UseOnContext context) { return InteractionResult.PASS; } - public static void waxStack(Item waxedItem, Level level, ItemStack stack, Vec3 playerPos, int amount) { + public static void waxStack(T waxedItem, Level level, ItemStack stack, Vec3 playerPos, int amount) { stack.shrink(amount); if(level instanceof ServerLevel serverLevel) { ItemEntity entity = new ItemEntity(serverLevel, playerPos.x, playerPos.y, playerPos.z, new ItemStack(waxedItem, amount)); diff --git a/fabric/src/main/java/github/killarexe/copper_extension/fabric/mixin/ItemMixin.java b/fabric/src/main/java/github/killarexe/copper_extension/fabric/mixin/ItemMixin.java index dc3e767..895cefe 100644 --- a/fabric/src/main/java/github/killarexe/copper_extension/fabric/mixin/ItemMixin.java +++ b/fabric/src/main/java/github/killarexe/copper_extension/fabric/mixin/ItemMixin.java @@ -30,7 +30,7 @@ @Mixin(Item.class) public abstract class ItemMixin implements FeatureElement, ItemLike, FabricItem { - @Inject(method = "inventoryTick(Lnet/minecraft/item/ItemStack;Lnet/minecraft/world/World;Lnet/minecraft/entity/Entity;IZ)V", at = @At("HEAD")) + @Inject(method = "inventoryTick(Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/level/Level;Lnet/minecraft/world/entity/Entity;IZ)V", at = @At("HEAD")) public void inventoryTick(ItemStack stack, Level level, Entity entity, int slot, boolean selected, CallbackInfo callbackInfo) { if(entity instanceof Player player && stack.getItem() == Items.COPPER_INGOT) { int count = stack.getCount(); @@ -40,7 +40,7 @@ public void inventoryTick(ItemStack stack, Level level, Entity entity, int slot, } } - @Inject(method = "useOn(Lnet/minecraft/item/context/UseOnContext;)Lnet/minecraft/world/InteractionResult;", at = @At("HEAD"), cancellable = true) + @Inject(method = "useOn(Lnet/minecraft/world/item/context/UseOnContext;)Lnet/minecraft/world/InteractionResult;", at = @At("HEAD"), cancellable = true) public void useOn(UseOnContext context, CallbackInfoReturnable callbackInfoReturnable) { if(context.getItemInHand().getItem() == Items.COPPER_INGOT) { Level level = context.getLevel(); diff --git a/forge/src/main/java/github/killarexe/copper_extension/forge/event/CEEvents.java b/forge/src/main/java/github/killarexe/copper_extension/forge/event/CEEvents.java index e5a6186..9b4f136 100644 --- a/forge/src/main/java/github/killarexe/copper_extension/forge/event/CEEvents.java +++ b/forge/src/main/java/github/killarexe/copper_extension/forge/event/CEEvents.java @@ -38,7 +38,7 @@ private static void onRightClickEvent(RightClickBlock event) { if(currentValue >= 1) { int amount = event.getEntity().isShiftKeyDown() ? currentValue : 1; Vec3 playerPos = event.getEntity().blockPosition().getCenter(); - WaxableItem.waxStack(CEItems.WAXED_COPPER_INGOT.get(), level, stack, state, playerPos, amount); + WaxableItem.waxStack(CEItems.WAXED_COPPER_INGOT.get(), level, stack, playerPos, amount); level.setBlock(event.getPos(), state.setValue(BeehiveBlock.HONEY_LEVEL, currentValue - amount) ,Block.UPDATE_ALL_IMMEDIATE); } } diff --git a/forge/src/main/java/github/killarexe/copper_extension/forge/registry/CEItems.java b/forge/src/main/java/github/killarexe/copper_extension/forge/registry/CEItems.java index 394f85c..c8192c1 100644 --- a/forge/src/main/java/github/killarexe/copper_extension/forge/registry/CEItems.java +++ b/forge/src/main/java/github/killarexe/copper_extension/forge/registry/CEItems.java @@ -1,9 +1,13 @@ package github.killarexe.copper_extension.forge.registry; +import java.util.Optional; + import github.killarexe.copper_extension.CEMod; import github.killarexe.copper_extension.forge.item.*; +import net.minecraft.core.Holder; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; +import net.minecraft.world.item.Items; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.RegistryObject;