Fixed a bug where interfaces would try to send items into cables ( or other IInv implementations that can't accept items. )
This commit is contained in:
parent
ef759c7a7e
commit
93940c151d
1 changed files with 24 additions and 10 deletions
|
@ -778,24 +778,40 @@ public class DualityInterface implements IGridTickable, ISegmentedInventory, ISt
|
||||||
InventoryAdaptor ad = InventoryAdaptor.getAdaptor( te, s.getOpposite() );
|
InventoryAdaptor ad = InventoryAdaptor.getAdaptor( te, s.getOpposite() );
|
||||||
if ( ad != null )
|
if ( ad != null )
|
||||||
{
|
{
|
||||||
|
if ( acceptsItems( ad, table ) )
|
||||||
for (int x = 0; x < table.getSizeInventory(); x++)
|
|
||||||
{
|
{
|
||||||
ItemStack is = table.getStackInSlot( x );
|
for (int x = 0; x < table.getSizeInventory(); x++)
|
||||||
if ( is != null )
|
|
||||||
{
|
{
|
||||||
addToSendList( ad.addItems( is ) );
|
ItemStack is = table.getStackInSlot( x );
|
||||||
|
if ( is != null )
|
||||||
|
{
|
||||||
|
addToSendList( ad.addItems( is ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
pushItemsOut( possibleDirections );
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
pushItemsOut( possibleDirections );
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean acceptsItems(InventoryAdaptor ad, InventoryCrafting table)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < table.getSizeInventory(); x++)
|
||||||
|
{
|
||||||
|
ItemStack is = table.getStackInSlot( x );
|
||||||
|
if ( is == null )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if ( ad.simulateAdd( is.copy() ) != null )
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private void pushItemsOut(EnumSet<ForgeDirection> possibleDirections)
|
private void pushItemsOut(EnumSet<ForgeDirection> possibleDirections)
|
||||||
{
|
{
|
||||||
if ( !hasItemsToSend() )
|
if ( !hasItemsToSend() )
|
||||||
|
@ -826,8 +842,6 @@ public class DualityInterface implements IGridTickable, ISegmentedInventory, ISt
|
||||||
|
|
||||||
if ( whatToSend == null )
|
if ( whatToSend == null )
|
||||||
i.remove();
|
i.remove();
|
||||||
else
|
|
||||||
whatToSend.stackSize = whatToSend.stackSize;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( waitingToSend.isEmpty() )
|
if ( waitingToSend.isEmpty() )
|
||||||
|
|
Loading…
Reference in a new issue