From 73c41f7863cac4b31be6e534aae5cae23732b5e8 Mon Sep 17 00:00:00 2001 From: Aidan Brady Date: Wed, 4 Dec 2013 22:17:56 -0500 Subject: [PATCH] Sorters can now directly eject into inventories --- .../TileEntityLogisticalSorter.java | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/common/mekanism/common/tileentity/TileEntityLogisticalSorter.java b/common/mekanism/common/tileentity/TileEntityLogisticalSorter.java index 55ef378eb..6f41e405e 100644 --- a/common/mekanism/common/tileentity/TileEntityLogisticalSorter.java +++ b/common/mekanism/common/tileentity/TileEntityLogisticalSorter.java @@ -79,10 +79,9 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen TileEntity back = Object3D.get(this).getFromSide(ForgeDirection.getOrientation(facing).getOpposite()).getTileEntity(worldObj); TileEntity front = Object3D.get(this).getFromSide(ForgeDirection.getOrientation(facing)).getTileEntity(worldObj); - if(back instanceof IInventory && front instanceof TileEntityLogisticalTransporter) + if(back instanceof IInventory && (front instanceof TileEntityLogisticalTransporter || front instanceof IInventory)) { IInventory inventory = (IInventory)back; - TileEntityLogisticalTransporter transporter = (TileEntityLogisticalTransporter)front; InvStack inInventory = null; boolean hasFilter = false; @@ -125,17 +124,31 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen { ItemStack used = null; - if(!roundRobin) + if(front instanceof TileEntityLogisticalTransporter) { - ItemStack rejects = TransporterUtils.insert(this, transporter, inInventory.getStack(), filterColor, true, min); + TileEntityLogisticalTransporter transporter = (TileEntityLogisticalTransporter)front; - if(TransporterManager.didEmit(inInventory.getStack(), rejects)) + if(!roundRobin) { - used = TransporterManager.getToUse(inInventory.getStack(), rejects); + ItemStack rejects = TransporterUtils.insert(this, transporter, inInventory.getStack(), filterColor, true, min); + + if(TransporterManager.didEmit(inInventory.getStack(), rejects)) + { + used = TransporterManager.getToUse(inInventory.getStack(), rejects); + } + } + else { + ItemStack rejects = TransporterUtils.insertRR(this, transporter, inInventory.getStack(), filterColor, true, min); + + if(TransporterManager.didEmit(inInventory.getStack(), rejects)) + { + used = TransporterManager.getToUse(inInventory.getStack(), rejects); + } } } - else { - ItemStack rejects = TransporterUtils.insertRR(this, transporter, inInventory.getStack(), filterColor, true, min); + else if(front instanceof IInventory) + { + ItemStack rejects = InventoryUtils.putStackInInventory((IInventory)front, inInventory.getStack(), facing, false); if(TransporterManager.didEmit(inInventory.getStack(), rejects)) {