Better client energy scales in universal cables, made Logistical Transporter pull mode take one item at a time to give L. Sorter an advantage

This commit is contained in:
Aidan C. Brady 2013-12-27 21:50:24 -05:00
parent aca4b461b7
commit e36e62b6be
5 changed files with 9 additions and 14 deletions

View file

@ -394,12 +394,11 @@ public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork>
{ {
needsUpdate = true; needsUpdate = true;
} }
lastPowerScale = currentPowerScale;
if(needsUpdate) if(needsUpdate)
{ {
MinecraftForge.EVENT_BUS.post(new EnergyTransferEvent(this, currentPowerScale)); MinecraftForge.EVENT_BUS.post(new EnergyTransferEvent(this, currentPowerScale));
lastPowerScale = currentPowerScale;
needsUpdate = false; needsUpdate = false;
} }

View file

@ -15,7 +15,7 @@ import mekanism.common.PacketHandler.Transmission;
import mekanism.common.network.PacketDataRequest; import mekanism.common.network.PacketDataRequest;
import mekanism.common.network.PacketTileEntity; import mekanism.common.network.PacketTileEntity;
import mekanism.common.tileentity.TileEntityLogisticalSorter; import mekanism.common.tileentity.TileEntityLogisticalSorter;
import mekanism.common.transporter.Finder.FreeFinder; import mekanism.common.transporter.Finder.FirstFinder;
import mekanism.common.transporter.InvStack; import mekanism.common.transporter.InvStack;
import mekanism.common.transporter.TransporterManager; import mekanism.common.transporter.TransporterManager;
import mekanism.common.transporter.TransporterStack; import mekanism.common.transporter.TransporterStack;
@ -368,7 +368,7 @@ public class PartLogisticalTransporter extends PartSidedPipe implements ILogisti
if(tile instanceof IInventory) if(tile instanceof IInventory)
{ {
IInventory inv = (IInventory)tile; IInventory inv = (IInventory)tile;
InvStack stack = InventoryUtils.takeTopStack(inv, side.ordinal(), new FreeFinder()); InvStack stack = InventoryUtils.takeTopItem(inv, side.ordinal());
if(stack != null && stack.getStack() != null) if(stack != null && stack.getStack() != null)
{ {

View file

@ -13,7 +13,7 @@ import mekanism.common.PacketHandler;
import mekanism.common.PacketHandler.Transmission; import mekanism.common.PacketHandler.Transmission;
import mekanism.common.block.BlockMachine.MachineType; import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.network.PacketTileEntity; import mekanism.common.network.PacketTileEntity;
import mekanism.common.transporter.Finder.FreeFinder; import mekanism.common.transporter.Finder.FirstFinder;
import mekanism.common.transporter.InvStack; import mekanism.common.transporter.InvStack;
import mekanism.common.transporter.TItemStackFilter; import mekanism.common.transporter.TItemStackFilter;
import mekanism.common.transporter.TransporterFilter; import mekanism.common.transporter.TransporterFilter;
@ -119,7 +119,7 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen
if(!hasFilter && autoEject) if(!hasFilter && autoEject)
{ {
inInventory = InventoryUtils.takeTopStack(inventory, ForgeDirection.getOrientation(facing).getOpposite().ordinal(), new FreeFinder()); inInventory = InventoryUtils.takeTopStack(inventory, ForgeDirection.getOrientation(facing).getOpposite().ordinal(), new FirstFinder());
} }
if(inInventory != null && inInventory.getStack() != null) if(inInventory != null && inInventory.getStack() != null)

View file

@ -10,7 +10,7 @@ public abstract class Finder
{ {
public abstract boolean modifies(ItemStack stack); public abstract boolean modifies(ItemStack stack);
public static class FreeFinder extends Finder public static class FirstFinder extends Finder
{ {
@Override @Override
public boolean modifies(ItemStack stack) public boolean modifies(ItemStack stack)

View file

@ -168,7 +168,7 @@ public final class InventoryUtils
return toInsert; return toInsert;
} }
public static ItemStack takeTopItemFromInventory(IInventory inventory, int side) public static InvStack takeTopItem(IInventory inventory, int side)
{ {
inventory = checkChestInv(inventory); inventory = checkChestInv(inventory);
@ -181,9 +181,7 @@ public final class InventoryUtils
ItemStack toSend = inventory.getStackInSlot(i).copy(); ItemStack toSend = inventory.getStackInSlot(i).copy();
toSend.stackSize = 1; toSend.stackSize = 1;
inventory.decrStackSize(i, 1); return new InvStack(inventory, i, toSend);
return toSend;
} }
} }
} }
@ -204,9 +202,7 @@ public final class InventoryUtils
if(sidedInventory.canExtractItem(slotID, toSend, side)) if(sidedInventory.canExtractItem(slotID, toSend, side))
{ {
sidedInventory.decrStackSize(slotID, 1); return new InvStack(inventory, slotID, toSend);
return toSend;
} }
} }
} }