Check getAccessibleSlotsFromSide for null returns.

This commit is contained in:
AlgorithmX2 2014-07-31 23:52:16 -05:00
parent 4e0b03454c
commit 1c266fc91a
4 changed files with 16 additions and 3 deletions

View file

@ -1052,8 +1052,13 @@ public class DualityInterface implements IGridTickable, ISegmentedInventory, ISt
if ( te instanceof IInventory && ((IInventory) te).getSizeInventory() == 0 )
continue;
if ( te instanceof ISidedInventory && ((ISidedInventory) te).getAccessibleSlotsFromSide( s.getOpposite().ordinal() ).length == 0 )
if ( te instanceof ISidedInventory )
{
int[] sides = ((ISidedInventory) te).getAccessibleSlotsFromSide( s.getOpposite().ordinal() );
if ( sides == null || sides.length == 0 )
continue;
}
if ( mop.blockX == te.xCoord && mop.blockY == te.yCoord && mop.blockZ == te.zCoord )
{

View file

@ -1470,7 +1470,13 @@ public class Platform
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
{
int offset = 0;
for (Integer Side : ((ISidedInventory) target).getAccessibleSlotsFromSide( dir.ordinal() ))
int[] sides = ((ISidedInventory) target).getAccessibleSlotsFromSide( dir.ordinal() );
if ( sides == null )
return 0;
for (Integer Side : sides)
{
int c = (Side << (offset++ % 8)) ^ (1 << dir.ordinal());
hash = c + (hash << 6) + (hash << 16) - hash;

View file

@ -85,6 +85,7 @@ public class AdaptorISpecialInventory extends InventoryAdaptor
{
ISidedInventory sided = (ISidedInventory) i;
int slots[] = sided.getAccessibleSlotsFromSide( d.ordinal() );
if ( slots == null )
return false;

View file

@ -30,6 +30,7 @@ public class WrapperInventoryRange implements IInventory
public WrapperInventoryRange(IInventory a, int[] s, boolean ignoreValid) {
src = a;
slots = s;
if ( slots == null )
slots = new int[0];