From b4e0eb667f5fa235338b7bb63c8bb3fbf4a34401 Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Wed, 1 Jan 2014 23:52:16 -0600 Subject: [PATCH] Fix issue with Double Chests not properly re-initializing their adapter when they change to a double chest. --- util/Platform.java | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/util/Platform.java b/util/Platform.java index 7ad89ace2..d19d83fda 100644 --- a/util/Platform.java +++ b/util/Platform.java @@ -1255,22 +1255,36 @@ public class Platform int hash = target.hashCode(); - if ( target instanceof IInventory ) + if ( target instanceof TileEntityChest ) + { + TileEntityChest targ = (TileEntityChest) target; + targ.checkForAdjacentChests(); + if ( targ.adjacentChestZNeg != null ) + hash ^= targ.adjacentChestZNeg.hashCode(); + else if ( targ.adjacentChestZPosition != null ) + hash ^= targ.adjacentChestZPosition.hashCode(); + else if ( targ.adjacentChestXPos != null ) + hash ^= targ.adjacentChestXPos.hashCode(); + else if ( targ.adjacentChestXNeg != null ) + hash ^= targ.adjacentChestXNeg.hashCode(); + } + else if ( target instanceof IInventory ) + { hash ^= ((IInventory) target).getSizeInventory(); - if ( target instanceof ISidedInventory ) - { - for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) + if ( target instanceof ISidedInventory ) { - int offset = 0; - for (Integer Side : ((ISidedInventory) target).getAccessibleSlotsFromSide( dir.ordinal() )) + for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { - hash ^= Side << (offset++ % 20); + int offset = 0; + for (Integer Side : ((ISidedInventory) target).getAccessibleSlotsFromSide( dir.ordinal() )) + { + hash ^= Side << (offset++ % 20); + } } } } return hash; } - }