mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-12 08:17:35 +00:00
Fix item placement losing NBT data in creative mode (#5757)
This commit is contained in:
1 parent
7915397377
commit
790da699dd
1 file changed
+4
-10
@@ -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)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user