Fix the bug that causes iron chests/iron shulker boxes to lose their contents in a visual bug.
This commit is contained in:
parent
31882e2d15
commit
5b8b97f385
|
|
@ -455,7 +455,7 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
|
||||||
this.numPlayersUsing = (type & 0xF8) >> 3;
|
this.numPlayersUsing = (type & 0xF8) >> 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return super.receiveClientEvent(id, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -509,8 +509,18 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
|
||||||
{
|
{
|
||||||
NBTTagCompound compound = new NBTTagCompound();
|
NBTTagCompound compound = new NBTTagCompound();
|
||||||
|
|
||||||
|
if (!this.checkLootAndWrite(compound))
|
||||||
|
{
|
||||||
|
ItemStackHelper.saveAllItems(compound, this.chestContents);
|
||||||
|
}
|
||||||
|
|
||||||
compound.setByte("facing", (byte) this.facing.ordinal());
|
compound.setByte("facing", (byte) this.facing.ordinal());
|
||||||
|
|
||||||
|
if (this.hasCustomName())
|
||||||
|
{
|
||||||
|
compound.setString("CustomName", this.customName);
|
||||||
|
}
|
||||||
|
|
||||||
return new SPacketUpdateTileEntity(this.pos, 0, compound);
|
return new SPacketUpdateTileEntity(this.pos, 0, compound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -618,8 +618,25 @@ public class TileEntityIronShulkerBox extends TileEntityLockableLoot implements
|
||||||
{
|
{
|
||||||
NBTTagCompound compound = new NBTTagCompound();
|
NBTTagCompound compound = new NBTTagCompound();
|
||||||
|
|
||||||
|
if (!this.checkLootAndWrite(compound))
|
||||||
|
{
|
||||||
|
ItemStackHelper.saveAllItems(compound, this.items, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
compound.setInteger("ShulkerBoxSize", this.getSizeInventory());
|
||||||
|
|
||||||
compound.setByte("facing", (byte) this.facing.ordinal());
|
compound.setByte("facing", (byte) this.facing.ordinal());
|
||||||
|
|
||||||
|
if (this.hasCustomName())
|
||||||
|
{
|
||||||
|
compound.setString("CustomName", this.customName);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!compound.hasKey("Lock") && this.isLocked())
|
||||||
|
{
|
||||||
|
this.getLockCode().toNBT(compound);
|
||||||
|
}
|
||||||
|
|
||||||
return new SPacketUpdateTileEntity(this.pos, 0, compound);
|
return new SPacketUpdateTileEntity(this.pos, 0, compound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue