From aebb0f70835764717273ae319e6b985686ba4663 Mon Sep 17 00:00:00 2001 From: Kynake Date: Sat, 28 Nov 2026 14:56:12 -0300 Subject: [PATCH] Only run setTagCompound() if required in applyInputToChiselTarget() --- .../cricketcraft/chisel/api/carving/CarvingUtils.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/cricketcraft/chisel/api/carving/CarvingUtils.java b/src/main/java/com/cricketcraft/chisel/api/carving/CarvingUtils.java index 30a33e3f..e7610217 100644 --- a/src/main/java/com/cricketcraft/chisel/api/carving/CarvingUtils.java +++ b/src/main/java/com/cricketcraft/chisel/api/carving/CarvingUtils.java @@ -120,15 +120,12 @@ public class CarvingUtils { public static @Nonnull ItemStack applyInputToChiselTarget(@Nonnull ItemStack input, @Nonnull ItemStack target) { ItemStack result = new ItemStack(target.getItem(), input.stackSize, target.getItemDamage()); - // Copy NBT from input to target to both avoid dupes and prevent loss of stored information - // (such as when chiseling drawers with items inside) - NBTTagCompound inputNBT = input.getTagCompound(); - if (inputNBT != null) { - inputNBT = (NBTTagCompound) inputNBT.copy(); + if (input.hasTagCompound()) { + result.setTagCompound( + (NBTTagCompound) input.getTagCompound() + .copy()); } - result.setTagCompound(inputNBT); - return result; }