diff --git a/src/main/java/net/neoforged/neoforge/common/CommonHooks.java b/src/main/java/net/neoforged/neoforge/common/CommonHooks.java index d81c78914c..34b843d737 100644 --- a/src/main/java/net/neoforged/neoforge/common/CommonHooks.java +++ b/src/main/java/net/neoforged/neoforge/common/CommonHooks.java @@ -738,15 +738,6 @@ public static Player getCraftingPlayer() { return craftingPlayer.get(); } - public static ItemStack getCraftingRemainder(ItemStack stack) { - stack = stack.getCraftingRemainder(); - if (!stack.isEmpty() && stack.isDamageableItem() && stack.getDamageValue() > stack.getMaxDamage()) { - EventHooks.onPlayerDestroyItem(craftingPlayer.get(), stack, null); - return ItemStack.EMPTY; - } - return stack; - } - public static boolean onPlayerAttackTarget(Player player, Entity target) { if (NeoForge.EVENT_BUS.post(new AttackEntityEvent(player, target)).isCanceled()) return false; diff --git a/src/main/java/net/neoforged/neoforge/common/extensions/IItemStackExtension.java b/src/main/java/net/neoforged/neoforge/common/extensions/IItemStackExtension.java index 0b18ba462f..4fa15f8d8b 100644 --- a/src/main/java/net/neoforged/neoforge/common/extensions/IItemStackExtension.java +++ b/src/main/java/net/neoforged/neoforge/common/extensions/IItemStackExtension.java @@ -61,7 +61,12 @@ private ItemStack self() { * @return The resulting ItemStack */ default ItemStack getCraftingRemainder() { - return self().getItem().getCraftingRemainder(self()); + ItemStack stack = self().getItem().getCraftingRemainder(self()); + if (!stack.isEmpty() && stack.isDamageableItem() && stack.getDamageValue() > stack.getMaxDamage()) { + EventHooks.onPlayerDestroyItem(CommonHooks.getCraftingPlayer(), stack, null); + return ItemStack.EMPTY; + } + return stack; } /**