return false;
}
}
else if (te != null && te instanceof TileEntityChest)
{
TileEntityChest tec = (TileEntityChest) te;
if (tec.numPlayersUsing > 0)
{
return false;
}
if (!getType().canUpgrade(IronChestType.WOOD))
{
return false;
}
// Force old TE out of the world so that adjacent chests can update
newchest = IronChestType.makeEntity(getTargetChestOrdinal(IronChestType.WOOD.ordinal()));
int newSize = newchest.chestContents.length;
ItemStack[] chestContents = ObfuscationReflectionHelper.getPrivateValue(TileEntityChest.class, tec, 0);
System.arraycopy(chestContents, 0, newchest.chestContents, 0, Math.min(newSize, chestContents.length));
BlockIronChest block = IronChest.ironChestBlock;
block.dropContent(newSize, tec, world, tec.xCoord, tec.yCoord, tec.zCoord);
newchest.setFacing((byte) tec.getBlockMetadata());
newchest.sortTopStacks();
for (int i = 0; i < Math.min(newSize, chestContents.length); i++)
{
chestContents[i] = null;
}
// Clear the old block out
world.setBlock(X, Y, Z, Blocks.air, 0, 3);
// Force the Chest TE to reset it's knowledge of neighbouring blocks
tec.updateContainingBlockInfo();
// Force the Chest TE to update any neighbours so they update next
// tick
tec.checkForAdjacentChests();
// And put in our block instead
world.setBlock(X, Y, Z, block, newchest.getType().ordinal(), 3);
}
else
{