Only run setTagCompound() if required in applyInputToChiselTarget()

This commit is contained in:
Kynake committed 2026-11-28 14:56:12 -03:00
1 parent 21cea32be7
commit aebb0f7083
1 file changed
+4 -7
@@ -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;
}