Drives/Chests now charge power based on Cell Types.
This commit is contained in:
parent
35d51e23fb
commit
1d539a33a8
|
@ -58,7 +58,7 @@ public class BasicCellHandler implements ICellHandler
|
|||
@Override
|
||||
public double cellIdleDrain(ItemStack is, IMEInventory handler)
|
||||
{
|
||||
CellInventory inv = (CellInventory) handler;
|
||||
CellInventory inv = ((CellInventoryHandler) handler).getCellInv();
|
||||
return inv.getIdleDrain();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ import appeng.api.storage.IMEMonitorHandlerReciever;
|
|||
import appeng.api.storage.IStorageMonitorable;
|
||||
import appeng.api.storage.MEMonitorHandler;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.helpers.AENoHandler;
|
||||
|
@ -321,8 +322,21 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
|
|||
{
|
||||
isCached = true;
|
||||
cellHandler = AEApi.instance().registries().cell().getHander( is );
|
||||
icell = wrap( cellHandler.getCellInventory( is, StorageChannel.ITEMS ) );
|
||||
fcell = wrap( cellHandler.getCellInventory( is, StorageChannel.FLUIDS ) );
|
||||
|
||||
double power = 1.0;
|
||||
|
||||
IMEInventoryHandler<IAEItemStack> itemCell = cellHandler.getCellInventory( is, StorageChannel.ITEMS );
|
||||
IMEInventoryHandler<IAEFluidStack> fluidCell = cellHandler.getCellInventory( is, StorageChannel.FLUIDS );
|
||||
|
||||
if ( itemCell != null )
|
||||
power += cellHandler.cellIdleDrain( is, itemCell );
|
||||
else if ( fluidCell != null )
|
||||
power += cellHandler.cellIdleDrain( is, fluidCell );
|
||||
|
||||
gridProxy.setIdlePowerUsage( power );
|
||||
|
||||
icell = wrap( itemCell );
|
||||
fcell = wrap( fluidCell );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -188,6 +188,8 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive
|
|||
items = new LinkedList();
|
||||
fluids = new LinkedList();
|
||||
|
||||
double power = 2.0;
|
||||
|
||||
for (int x = 0; x < inv.getSizeInventory(); x++)
|
||||
{
|
||||
ItemStack is = inv.getStackInSlot( x );
|
||||
|
@ -204,6 +206,8 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive
|
|||
|
||||
if ( cell != null )
|
||||
{
|
||||
power += handlersBySlot[x].cellIdleDrain( is, cell );
|
||||
|
||||
DriveWatcher<IAEItemStack> ih = new DriveWatcher( cell, is, handlersBySlot[x], this );
|
||||
ih.myPriority = priority;
|
||||
invBySlot[x] = ih;
|
||||
|
@ -215,6 +219,8 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive
|
|||
|
||||
if ( cell != null )
|
||||
{
|
||||
power += handlersBySlot[x].cellIdleDrain( is, cell );
|
||||
|
||||
DriveWatcher<IAEItemStack> ih = new DriveWatcher( cell, is, handlersBySlot[x], this );
|
||||
ih.myPriority = priority;
|
||||
invBySlot[x] = ih;
|
||||
|
@ -225,6 +231,8 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive
|
|||
}
|
||||
}
|
||||
|
||||
gridProxy.setIdlePowerUsage( power );
|
||||
|
||||
isCached = true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue