diff --git a/helpers/DualityInterface.java b/helpers/DualityInterface.java index 4ed4960d..d394ea8c 100644 --- a/helpers/DualityInterface.java +++ b/helpers/DualityInterface.java @@ -778,24 +778,40 @@ public class DualityInterface implements IGridTickable, ISegmentedInventory, ISt InventoryAdaptor ad = InventoryAdaptor.getAdaptor( te, s.getOpposite() ); if ( ad != null ) { - - for (int x = 0; x < table.getSizeInventory(); x++) + if ( acceptsItems( ad, table ) ) { - ItemStack is = table.getStackInSlot( x ); - if ( is != null ) + for (int x = 0; x < table.getSizeInventory(); x++) { - 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; } + 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 possibleDirections) { if ( !hasItemsToSend() ) @@ -826,8 +842,6 @@ public class DualityInterface implements IGridTickable, ISegmentedInventory, ISt if ( whatToSend == null ) i.remove(); - else - whatToSend.stackSize = whatToSend.stackSize; } if ( waitingToSend.isEmpty() )