Fix item placement losing NBT data in creative mode (#5757)

This commit is contained in:
Ben Staddon 2019-06-25 21:59:10 +01:00 committed by LexManos
parent 7915397377
commit 790da699dd

View file

@ -587,7 +587,7 @@ public class ForgeHooks
// handle all placement events here
int size = itemstack.getCount();
CompoundNBT nbt = null;
if (itemstack.hasTag())
if (itemstack.getTag() != null)
{
nbt = itemstack.getTag().copy();
}
@ -605,7 +605,7 @@ public class ForgeHooks
// save new item data
int newSize = itemstack.getCount();
CompoundNBT newNBT = null;
if (itemstack.hasTag())
if (itemstack.getTag() != null)
{
newNBT = itemstack.getTag().copy();
}
@ -615,10 +615,7 @@ public class ForgeHooks
// make sure to set pre-placement item data for event
itemstack.setCount(size);
if (nbt != null)
{
itemstack.setTag(nbt);
}
itemstack.setTag(nbt);
PlayerEntity player = context.getPlayer();
Direction side = context.getFace();
@ -648,10 +645,7 @@ public class ForgeHooks
{
// Change the stack to its new content
itemstack.setCount(newSize);
if (nbt != null)
{
itemstack.setTag(newNBT);
}
itemstack.setTag(newNBT);
for (BlockSnapshot snap : blockSnapshots)
{