mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-29 00:09:17 +00:00
Only run setTagCompound() if required in applyInputToChiselTarget()
This commit is contained in:
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;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user