Fix the bug that causes iron chests/iron shulker boxes to lose their contents in a visual bug.

This commit is contained in:
alexbegt 2019-07-19 21:59:00 -04:00
parent 31882e2d15
commit 5b8b97f385
2 changed files with 28 additions and 1 deletions

View File

@ -455,7 +455,7 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
this.numPlayersUsing = (type & 0xF8) >> 3;
}
return true;
return super.receiveClientEvent(id, type);
}
@Override
@ -509,8 +509,18 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements ITick
{
NBTTagCompound compound = new NBTTagCompound();
if (!this.checkLootAndWrite(compound))
{
ItemStackHelper.saveAllItems(compound, this.chestContents);
}
compound.setByte("facing", (byte) this.facing.ordinal());
if (this.hasCustomName())
{
compound.setString("CustomName", this.customName);
}
return new SPacketUpdateTileEntity(this.pos, 0, compound);
}

View File

@ -618,8 +618,25 @@ public class TileEntityIronShulkerBox extends TileEntityLockableLoot implements
{
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());
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);
}