Fix item placement losing NBT data in creative mode (#5757)
This commit is contained in:
parent
7915397377
commit
790da699dd
1 changed files with 4 additions and 10 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
for (BlockSnapshot snap : blockSnapshots)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue