diff --git a/arclight-neoforge/src/main/java/io/izzel/arclight/neoforge/mixin/core/world/item/ItemStackMixin_NeoForge.java b/arclight-neoforge/src/main/java/io/izzel/arclight/neoforge/mixin/core/world/item/ItemStackMixin_NeoForge.java index 34cf88bb0..c7f4bf318 100644 --- a/arclight-neoforge/src/main/java/io/izzel/arclight/neoforge/mixin/core/world/item/ItemStackMixin_NeoForge.java +++ b/arclight-neoforge/src/main/java/io/izzel/arclight/neoforge/mixin/core/world/item/ItemStackMixin_NeoForge.java @@ -38,8 +38,13 @@ public abstract class ItemStackMixin_NeoForge implements ItemStackBridge, IItemS // @formatter:on @Decorate(method = "hurtAndBreak(ILnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/entity/LivingEntity;Ljava/util/function/Consumer;)V", - at = @At(value = "INVOKE", target = "Lnet/minecraft/world/item/enchantment/EnchantmentHelper;processDurabilityChange(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/item/ItemStack;I)I")) + at = @At(value = "INVOKE", target = "Lnet/minecraft/world/item/enchantment/EnchantmentHelper;processDurabilityChange(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/item/ItemStack;I)I")) private int arclight$itemDamage(ServerLevel serverLevel, ItemStack itemStack, int i, @Local(ordinal = 0) LivingEntity damager) throws Throwable { + // Added null check for itemStack + if (itemStack == null) { + return 0; + } + int result = (int) DecorationOps.callsite().invoke(serverLevel, itemStack, i); if (damager instanceof ServerPlayer) { PlayerItemDamageEvent event = new PlayerItemDamageEvent(((ServerPlayerEntityBridge) damager).bridge$getBukkitEntity(), CraftItemStack.asCraftMirror((ItemStack) (Object) this), result); @@ -64,7 +69,7 @@ public abstract class ItemStackMixin_NeoForge implements ItemStackBridge, IItemS } @Deprecated - public void setItem(Item item) { + public void setItem(@Nullable Item item) { this.item = item; }