Refactored StorageChannel enum into an interface (#3138)
This replaces the static enum with a more dynamic interface providing factory methods for handling network storage.
This commit is contained in:
@@ -37,6 +37,7 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
@@ -62,9 +63,9 @@ public class GuiCraftConfirm extends AEBaseGui
|
||||
|
||||
private final int rows = 5;
|
||||
|
||||
private final IItemList<IAEItemStack> storage = AEApi.instance().storage().createItemList();
|
||||
private final IItemList<IAEItemStack> pending = AEApi.instance().storage().createItemList();
|
||||
private final IItemList<IAEItemStack> missing = AEApi.instance().storage().createItemList();
|
||||
private final IItemList<IAEItemStack> storage = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
private final IItemList<IAEItemStack> pending = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
private final IItemList<IAEItemStack> missing = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
|
||||
private final List<IAEItemStack> visual = new ArrayList<>();
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ import appeng.api.AEApi;
|
||||
import appeng.api.config.SortDir;
|
||||
import appeng.api.config.SortOrder;
|
||||
import appeng.api.config.ViewItems;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.api.util.AEColor;
|
||||
@@ -84,9 +85,9 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
|
||||
|
||||
private final ContainerCraftingCPU craftingCpu;
|
||||
|
||||
private IItemList<IAEItemStack> storage = AEApi.instance().storage().createItemList();
|
||||
private IItemList<IAEItemStack> active = AEApi.instance().storage().createItemList();
|
||||
private IItemList<IAEItemStack> pending = AEApi.instance().storage().createItemList();
|
||||
private IItemList<IAEItemStack> storage = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
private IItemList<IAEItemStack> active = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
private IItemList<IAEItemStack> pending = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
|
||||
private List<IAEItemStack> visual = new ArrayList<>();
|
||||
private GuiButton cancel;
|
||||
@@ -110,9 +111,9 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
|
||||
|
||||
public void clearItems()
|
||||
{
|
||||
this.storage = AEApi.instance().storage().createItemList();
|
||||
this.active = AEApi.instance().storage().createItemList();
|
||||
this.pending = AEApi.instance().storage().createItemList();
|
||||
this.storage = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
this.active = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
this.pending = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
this.visual = new ArrayList<>();
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.widgets.GuiScrollbar;
|
||||
import appeng.client.gui.widgets.MEGuiTextField;
|
||||
@@ -347,7 +348,9 @@ public class GuiInterfaceTerminal extends AEBaseGui
|
||||
final ItemStack parsedItemStack = new ItemStack( outTag.getCompoundTagAt( i ) );
|
||||
if( !parsedItemStack.isEmpty() )
|
||||
{
|
||||
final String displayName = Platform.getItemDisplayName( AEApi.instance().storage().createItemStack( parsedItemStack ) ).toLowerCase();
|
||||
final String displayName = Platform
|
||||
.getItemDisplayName( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( parsedItemStack ) )
|
||||
.toLowerCase();
|
||||
if( displayName.contains( searchTerm ) )
|
||||
{
|
||||
return true;
|
||||
|
||||
@@ -33,6 +33,7 @@ import appeng.api.config.Settings;
|
||||
import appeng.api.config.SortOrder;
|
||||
import appeng.api.config.ViewItems;
|
||||
import appeng.api.config.YesNo;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.client.gui.widgets.IScrollSource;
|
||||
@@ -48,7 +49,7 @@ import appeng.util.prioritylist.IPartitionList;
|
||||
public class ItemRepo
|
||||
{
|
||||
|
||||
private final IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
|
||||
private final IItemList<IAEItemStack> list = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
private final ArrayList<IAEItemStack> view = new ArrayList<>();
|
||||
private final IScrollSource src;
|
||||
private final ISortSource sortSrc;
|
||||
|
||||
@@ -56,6 +56,7 @@ import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.networking.security.ISecurityGrid;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.me.InternalSlotME;
|
||||
import appeng.client.me.SlotME;
|
||||
@@ -204,7 +205,7 @@ public abstract class AEBaseContainer extends Container
|
||||
final NBTTagCompound data = CompressedStreamTools.readCompressed( new ByteArrayInputStream( buffer ) );
|
||||
if( data != null )
|
||||
{
|
||||
this.setTargetStack( AEApi.instance().storage().createItemStack( new ItemStack( data ) ) );
|
||||
this.setTargetStack( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( new ItemStack( data ) ) );
|
||||
}
|
||||
}
|
||||
catch( final IOException e )
|
||||
@@ -893,7 +894,7 @@ public abstract class AEBaseContainer extends Container
|
||||
|
||||
if( !isg.isEmpty() && releaseQty > 0 )
|
||||
{
|
||||
IAEItemStack ais = AEApi.instance().storage().createItemStack( isg );
|
||||
IAEItemStack ais = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( isg );
|
||||
ais.setStackSize( 1 );
|
||||
final IAEItemStack extracted = ais.copy();
|
||||
|
||||
@@ -983,7 +984,7 @@ public abstract class AEBaseContainer extends Container
|
||||
}
|
||||
else
|
||||
{
|
||||
IAEItemStack ais = AEApi.instance().storage().createItemStack( player.inventory.getItemStack() );
|
||||
IAEItemStack ais = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( player.inventory.getItemStack() );
|
||||
ais = Platform.poweredInsert( this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource() );
|
||||
if( ais != null )
|
||||
{
|
||||
@@ -1032,7 +1033,7 @@ public abstract class AEBaseContainer extends Container
|
||||
}
|
||||
else
|
||||
{
|
||||
IAEItemStack ais = AEApi.instance().storage().createItemStack( player.inventory.getItemStack() );
|
||||
IAEItemStack ais = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( player.inventory.getItemStack() );
|
||||
ais.setStackSize( 1 );
|
||||
ais = Platform.poweredInsert( this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource() );
|
||||
if( ais == null )
|
||||
@@ -1107,7 +1108,7 @@ public abstract class AEBaseContainer extends Container
|
||||
{
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance().sendTo( new PacketInventoryAction( InventoryAction.UPDATE_HAND, 0, AEItemStack.create( p.inventory.getItemStack() ) ),
|
||||
NetworkHandler.instance().sendTo( new PacketInventoryAction( InventoryAction.UPDATE_HAND, 0, AEItemStack.fromItemStack( p.inventory.getItemStack() ) ),
|
||||
p );
|
||||
}
|
||||
catch( final IOException e )
|
||||
@@ -1123,7 +1124,8 @@ public abstract class AEBaseContainer extends Container
|
||||
{
|
||||
return input;
|
||||
}
|
||||
final IAEItemStack ais = Platform.poweredInsert( this.getPowerSource(), this.getCellInventory(), AEApi.instance().storage().createItemStack( input ),
|
||||
final IAEItemStack ais = Platform.poweredInsert( this.getPowerSource(), this.getCellInventory(),
|
||||
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( input ),
|
||||
this.getActionSource() );
|
||||
if( ais == null )
|
||||
{
|
||||
|
||||
@@ -35,7 +35,7 @@ import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.storage.ICellWorkbenchItem;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
@@ -227,12 +227,14 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
|
||||
final IItemHandler inv = this.getUpgradeable().getInventoryByName( "config" );
|
||||
|
||||
final IMEInventory<IAEItemStack> cellInv = AEApi.instance().registries().cell().getCellInventory(
|
||||
this.getUpgradeable().getInventoryByName( "cell" ).getStackInSlot( 0 ), null, StorageChannel.ITEMS );
|
||||
this.getUpgradeable().getInventoryByName( "cell" ).getStackInSlot( 0 ), null,
|
||||
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
|
||||
Iterator<IAEItemStack> i = new NullIterator<>();
|
||||
if( cellInv != null )
|
||||
{
|
||||
final IItemList<IAEItemStack> list = cellInv.getAvailableItems( AEApi.instance().storage().createItemList() );
|
||||
final IItemList<IAEItemStack> list = cellInv
|
||||
.getAvailableItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList() );
|
||||
i = list.iterator();
|
||||
}
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.networking.storage.IStorageGrid;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.container.AEBaseContainer;
|
||||
@@ -208,7 +209,7 @@ public class ContainerCraftConfirm extends AEBaseContainer
|
||||
final PacketMEInventoryUpdate b = new PacketMEInventoryUpdate( (byte) 1 );
|
||||
final PacketMEInventoryUpdate c = this.result.isSimulation() ? new PacketMEInventoryUpdate( (byte) 2 ) : null;
|
||||
|
||||
final IItemList<IAEItemStack> plan = AEApi.instance().storage().createItemList();
|
||||
final IItemList<IAEItemStack> plan = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
this.result.populatePlan( plan );
|
||||
|
||||
this.setUsedBytes( this.result.getByteTotal() );
|
||||
@@ -225,7 +226,7 @@ public class ContainerCraftConfirm extends AEBaseContainer
|
||||
p.setStackSize( out.getCountRequestable() );
|
||||
|
||||
final IStorageGrid sg = this.getGrid().getCache( IStorageGrid.class );
|
||||
final IMEInventory<IAEItemStack> items = sg.getItemInventory();
|
||||
final IMEInventory<IAEItemStack> items = sg.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
|
||||
IAEItemStack m = null;
|
||||
if( c != null && this.result.isSimulation() )
|
||||
|
||||
@@ -34,6 +34,7 @@ import appeng.api.networking.security.IActionHost;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.networking.storage.IBaseMonitor;
|
||||
import appeng.api.storage.IMEMonitorHandlerReceiver;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.container.AEBaseContainer;
|
||||
@@ -52,7 +53,7 @@ import appeng.util.Platform;
|
||||
public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorHandlerReceiver<IAEItemStack>, ICustomNameObject
|
||||
{
|
||||
|
||||
private final IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
|
||||
private final IItemList<IAEItemStack> list = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
private IGrid network;
|
||||
private CraftingCPUCluster monitor = null;
|
||||
private String cpuName = null;
|
||||
|
||||
@@ -54,6 +54,7 @@ import appeng.api.parts.IPart;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.IMEMonitorHandlerReceiver;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
@@ -77,7 +78,7 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
||||
|
||||
private final SlotRestrictedInput[] cellView = new SlotRestrictedInput[5];
|
||||
private final IMEMonitor<IAEItemStack> monitor;
|
||||
private final IItemList<IAEItemStack> items = AEApi.instance().storage().createItemList();
|
||||
private final IItemList<IAEItemStack> items = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
private final IConfigManager clientCM;
|
||||
private final ITerminalHost host;
|
||||
@GuiSync( 99 )
|
||||
@@ -108,7 +109,7 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
||||
{
|
||||
this.serverCM = monitorable.getConfigManager();
|
||||
|
||||
this.monitor = monitorable.getItemInventory();
|
||||
this.monitor = monitorable.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
if( this.monitor != null )
|
||||
{
|
||||
this.monitor.addListener( this, null );
|
||||
@@ -188,7 +189,7 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
if( this.monitor != this.host.getItemInventory() )
|
||||
if( this.monitor != this.host.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ) )
|
||||
{
|
||||
this.setValidContainer( false );
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import appeng.api.networking.IGridBlock;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.energy.IEnergyGrid;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
@@ -113,14 +114,14 @@ public class ContainerNetworkStatus extends AEBaseContainer
|
||||
|
||||
for( final Class<? extends IGridHost> machineClass : this.network.getMachinesClasses() )
|
||||
{
|
||||
final IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
|
||||
final IItemList<IAEItemStack> list = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
for( final IGridNode machine : this.network.getMachines( machineClass ) )
|
||||
{
|
||||
final IGridBlock blk = machine.getGridBlock();
|
||||
final ItemStack is = blk.getMachineRepresentation();
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
final IAEItemStack ais = AEItemStack.create( is );
|
||||
final IAEItemStack ais = AEItemStack.fromItemStack( is );
|
||||
ais.setStackSize( 1 );
|
||||
ais.setCountRequestable( (long) ( blk.getIdlePowerUsage() * 100.0 ) );
|
||||
list.add( ais );
|
||||
|
||||
@@ -45,6 +45,7 @@ import appeng.api.config.Actionable;
|
||||
import appeng.api.definitions.IDefinitions;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.container.ContainerNull;
|
||||
@@ -398,7 +399,8 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
return;
|
||||
}
|
||||
|
||||
final IMEMonitor<IAEItemStack> storage = this.getPatternTerminal().getItemInventory();
|
||||
final IMEMonitor<IAEItemStack> storage = this.getPatternTerminal()
|
||||
.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
final IItemList<IAEItemStack> all = storage.getStorageList();
|
||||
|
||||
final ItemStack is = r.getCraftingResult( ic );
|
||||
@@ -447,7 +449,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
final ItemStack failed = real.getStackInSlot( x );
|
||||
if( !failed.isEmpty() )
|
||||
{
|
||||
this.getCellInventory().injectItems( AEItemStack.create( failed ), Actionable.MODULATE,
|
||||
this.getCellInventory().injectItems( AEItemStack.fromItemStack( failed ), Actionable.MODULATE,
|
||||
new MachineSource( this.getPatternTerminal() ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import appeng.api.config.Settings;
|
||||
import appeng.api.config.StorageFilter;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
@@ -157,7 +158,8 @@ public class ContainerStorageBus extends ContainerUpgradeable
|
||||
Iterator<IAEItemStack> i = new NullIterator<>();
|
||||
if( cellInv != null )
|
||||
{
|
||||
final IItemList<IAEItemStack> list = cellInv.getAvailableItems( AEApi.instance().storage().createItemList() );
|
||||
final IItemList<IAEItemStack> list = cellInv
|
||||
.getAvailableItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList() );
|
||||
i = list.iterator();
|
||||
}
|
||||
|
||||
|
||||
@@ -34,11 +34,13 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.energy.IEnergySource;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.IStorageMonitorable;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.container.ContainerNull;
|
||||
@@ -105,7 +107,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
||||
return;
|
||||
}
|
||||
|
||||
final IMEMonitor<IAEItemStack> inv = this.storage.getItemInventory();
|
||||
final IMEMonitor<IAEItemStack> inv = this.storage.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
final int howManyPerCraft = this.getStack().getCount();
|
||||
int maxTimesToCraft = 0;
|
||||
|
||||
@@ -306,7 +308,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
||||
else if( !set[x].isEmpty() )
|
||||
{
|
||||
// eek! put it back!
|
||||
final IAEItemStack fail = inv.injectItems( AEItemStack.create( set[x] ), Actionable.MODULATE, this.mySrc );
|
||||
final IAEItemStack fail = inv.injectItems( AEItemStack.fromItemStack( set[x] ), Actionable.MODULATE, this.mySrc );
|
||||
if( fail != null )
|
||||
{
|
||||
drops.add( fail.createItemStack() );
|
||||
|
||||
@@ -29,6 +29,7 @@ import appeng.api.AEApi;
|
||||
import appeng.api.networking.energy.IEnergySource;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.IStorageMonitorable;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.packets.PacketPatternSlot;
|
||||
import appeng.helpers.IContainerCraftingPacket;
|
||||
@@ -50,7 +51,8 @@ public class SlotPatternTerm extends SlotCraftingTerm
|
||||
|
||||
public AppEngPacket getRequest( final boolean shift ) throws IOException
|
||||
{
|
||||
return new PacketPatternSlot( this.getPattern(), AEApi.instance().storage().createItemStack( this.getStack() ), shift );
|
||||
return new PacketPatternSlot( this
|
||||
.getPattern(), AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( this.getStack() ), shift );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,20 +20,14 @@ package appeng.core;
|
||||
|
||||
|
||||
import appeng.api.IAppEngApi;
|
||||
import appeng.api.exceptions.FailedConnection;
|
||||
import appeng.api.features.IRegistryContainer;
|
||||
import appeng.api.networking.IGridBlock;
|
||||
import appeng.api.networking.IGridConnection;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.IGridHelper;
|
||||
import appeng.api.storage.IStorageHelper;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.core.api.ApiGrid;
|
||||
import appeng.core.api.ApiPart;
|
||||
import appeng.core.api.ApiStorage;
|
||||
import appeng.core.features.registries.PartModels;
|
||||
import appeng.core.features.registries.RegistryContainer;
|
||||
import appeng.me.GridConnection;
|
||||
import appeng.me.GridNode;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public final class Api implements IAppEngApi
|
||||
@@ -45,11 +39,13 @@ public final class Api implements IAppEngApi
|
||||
// private MovableTileRegistry MovableRegistry = new MovableTileRegistry();
|
||||
private final IRegistryContainer registryContainer;
|
||||
private final IStorageHelper storageHelper;
|
||||
private final IGridHelper networkHelper;
|
||||
private final ApiDefinitions definitions;
|
||||
|
||||
private Api()
|
||||
{
|
||||
this.storageHelper = new ApiStorage();
|
||||
this.networkHelper = new ApiGrid();
|
||||
this.registryContainer = new RegistryContainer();
|
||||
this.partHelper = new ApiPart();
|
||||
this.definitions = new ApiDefinitions( (PartModels) this.registryContainer.partModels() );
|
||||
@@ -72,6 +68,12 @@ public final class Api implements IAppEngApi
|
||||
return this.storageHelper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGridHelper grid()
|
||||
{
|
||||
return this.networkHelper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiPart partHelper()
|
||||
{
|
||||
@@ -83,21 +85,4 @@ public final class Api implements IAppEngApi
|
||||
{
|
||||
return this.definitions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGridNode createGridNode( final IGridBlock blk )
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
throw new IllegalStateException( "Grid features for " + blk + " are server side only." );
|
||||
}
|
||||
|
||||
return new GridNode( blk );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGridConnection createGridConnection( final IGridNode a, final IGridNode b ) throws FailedConnection
|
||||
{
|
||||
return new GridConnection( a, b, AEPartLocation.INTERNAL );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.core.api;
|
||||
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import appeng.api.exceptions.FailedConnection;
|
||||
import appeng.api.networking.IGridBlock;
|
||||
import appeng.api.networking.IGridConnection;
|
||||
import appeng.api.networking.IGridHelper;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.me.GridConnection;
|
||||
import appeng.me.GridNode;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
/**
|
||||
* @author yueh
|
||||
* @version rv5
|
||||
* @since rv5
|
||||
*/
|
||||
public class ApiGrid implements IGridHelper
|
||||
{
|
||||
|
||||
@Override
|
||||
public IGridNode createGridNode( final IGridBlock blk )
|
||||
{
|
||||
Preconditions.checkNotNull( blk );
|
||||
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
throw new IllegalStateException( "Grid features for " + blk + " are server side only." );
|
||||
}
|
||||
|
||||
return new GridNode( blk );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGridConnection createGridConnection( final IGridNode a, final IGridNode b ) throws FailedConnection
|
||||
{
|
||||
Preconditions.checkNotNull( a );
|
||||
Preconditions.checkNotNull( b );
|
||||
|
||||
return new GridConnection( a, b, AEPartLocation.INTERNAL );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,6 +20,12 @@ package appeng.core.api;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ClassToInstanceMap;
|
||||
import com.google.common.collect.MutableClassToInstanceMap;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
@@ -32,9 +38,13 @@ import appeng.api.networking.crafting.ICraftingRequester;
|
||||
import appeng.api.networking.energy.IEnergySource;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.IStorageHelper;
|
||||
import appeng.api.storage.channels.IFluidStorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.crafting.CraftingLink;
|
||||
import appeng.util.Platform;
|
||||
@@ -47,57 +57,157 @@ import appeng.util.item.ItemList;
|
||||
public class ApiStorage implements IStorageHelper
|
||||
{
|
||||
|
||||
private final ClassToInstanceMap<IStorageChannel<?>> channels;
|
||||
|
||||
public ApiStorage()
|
||||
{
|
||||
this.channels = MutableClassToInstanceMap.create();
|
||||
this.registerStorageChannel( IItemStorageChannel.class, new ItemStorageChannel() );
|
||||
this.registerStorageChannel( IFluidStorageChannel.class, new FluidStorageChannel() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends IAEStack<T>, C extends IStorageChannel<T>> void registerStorageChannel( Class<C> channel, C factory )
|
||||
{
|
||||
Preconditions.checkNotNull( channel );
|
||||
Preconditions.checkNotNull( factory );
|
||||
Preconditions.checkArgument( channel.isInstance( factory ) );
|
||||
Preconditions.checkArgument( !this.channels.containsKey( channel ) );
|
||||
|
||||
this.channels.putInstance( channel, factory );
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends IAEStack<T>, C extends IStorageChannel<T>> C getStorageChannel( Class<C> channel )
|
||||
{
|
||||
Preconditions.checkNotNull( channel );
|
||||
|
||||
final C type = this.channels.getInstance( channel );
|
||||
|
||||
Preconditions.checkNotNull( type );
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<IStorageChannel<? extends IAEStack<?>>> storageChannels()
|
||||
{
|
||||
return Collections.unmodifiableCollection( this.channels.values() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICraftingLink loadCraftingLink( final NBTTagCompound data, final ICraftingRequester req )
|
||||
{
|
||||
Preconditions.checkNotNull( data );
|
||||
Preconditions.checkNotNull( req );
|
||||
|
||||
return new CraftingLink( data, req );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack createItemStack( final ItemStack is )
|
||||
private static final class ItemStorageChannel implements IItemStorageChannel
|
||||
{
|
||||
return AEItemStack.create( is );
|
||||
|
||||
@Override
|
||||
public IItemList<IAEItemStack> createList()
|
||||
{
|
||||
return new ItemList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack createStack( Object input )
|
||||
{
|
||||
Preconditions.checkNotNull( input );
|
||||
|
||||
if( input instanceof ItemStack )
|
||||
{
|
||||
return AEItemStack.fromItemStack( (ItemStack) input );
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack readFromPacket( ByteBuf input ) throws IOException
|
||||
{
|
||||
Preconditions.checkNotNull( input );
|
||||
|
||||
return AEItemStack.fromPacket( input );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack poweredExtraction( IEnergySource energy, IMEInventory<IAEItemStack> cell, IAEItemStack request, IActionSource src )
|
||||
{
|
||||
Preconditions.checkNotNull( energy );
|
||||
Preconditions.checkNotNull( cell );
|
||||
Preconditions.checkNotNull( request );
|
||||
Preconditions.checkNotNull( src );
|
||||
|
||||
return Platform.poweredExtraction( energy, cell, request, src );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack poweredInsert( IEnergySource energy, IMEInventory<IAEItemStack> cell, IAEItemStack input, IActionSource src )
|
||||
{
|
||||
Preconditions.checkNotNull( energy );
|
||||
Preconditions.checkNotNull( cell );
|
||||
Preconditions.checkNotNull( input );
|
||||
Preconditions.checkNotNull( src );
|
||||
|
||||
return Platform.poweredInsert( energy, cell, input, src );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEFluidStack createFluidStack( final FluidStack is )
|
||||
private static final class FluidStorageChannel implements IFluidStorageChannel
|
||||
{
|
||||
return AEFluidStack.create( is );
|
||||
|
||||
@Override
|
||||
public IItemList<IAEFluidStack> createList()
|
||||
{
|
||||
return new FluidList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEFluidStack createStack( Object input )
|
||||
{
|
||||
Preconditions.checkNotNull( input );
|
||||
|
||||
if( input instanceof FluidStack )
|
||||
{
|
||||
return AEFluidStack.fromFluidStack( (FluidStack) input );
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEFluidStack readFromPacket( ByteBuf input ) throws IOException
|
||||
{
|
||||
Preconditions.checkNotNull( input );
|
||||
|
||||
return AEFluidStack.fromPacket( input );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEFluidStack poweredExtraction( IEnergySource energy, IMEInventory<IAEFluidStack> cell, IAEFluidStack request, IActionSource src )
|
||||
{
|
||||
Preconditions.checkNotNull( energy );
|
||||
Preconditions.checkNotNull( cell );
|
||||
Preconditions.checkNotNull( request );
|
||||
Preconditions.checkNotNull( src );
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEFluidStack poweredInsert( IEnergySource energy, IMEInventory<IAEFluidStack> cell, IAEFluidStack input, IActionSource src )
|
||||
{
|
||||
Preconditions.checkNotNull( energy );
|
||||
Preconditions.checkNotNull( cell );
|
||||
Preconditions.checkNotNull( input );
|
||||
Preconditions.checkNotNull( src );
|
||||
|
||||
return input;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemList<IAEItemStack> createItemList()
|
||||
{
|
||||
return new ItemList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemList<IAEFluidStack> createFluidList()
|
||||
{
|
||||
return new FluidList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack readItemFromPacket( final ByteBuf input ) throws IOException
|
||||
{
|
||||
return AEItemStack.loadItemStackFromPacket( input );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEFluidStack readFluidFromPacket( final ByteBuf input ) throws IOException
|
||||
{
|
||||
return AEFluidStack.loadFluidStackFromPacket( input );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack poweredExtraction( final IEnergySource energy, final IMEInventory<IAEItemStack> cell, final IAEItemStack request, final IActionSource src )
|
||||
{
|
||||
return Platform.poweredExtraction( energy, cell, request, src );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack poweredInsert( final IEnergySource energy, final IMEInventory<IAEItemStack> cell, final IAEItemStack input, final IActionSource src )
|
||||
{
|
||||
return Platform.poweredInsert( energy, cell, input, src );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.implementations.tiles.IChestOrDrive;
|
||||
import appeng.api.storage.ICellHandler;
|
||||
import appeng.api.storage.ICellInventory;
|
||||
@@ -30,7 +31,8 @@ import appeng.api.storage.ICellInventoryHandler;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.ISaveProvider;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.me.storage.CellInventory;
|
||||
@@ -48,9 +50,9 @@ public class BasicCellHandler implements ICellHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEInventoryHandler getCellInventory( final ItemStack is, final ISaveProvider container, final StorageChannel channel )
|
||||
public IMEInventoryHandler getCellInventory( final ItemStack is, final ISaveProvider container, final IStorageChannel channel )
|
||||
{
|
||||
if( channel == StorageChannel.ITEMS )
|
||||
if( channel == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
|
||||
{
|
||||
return CellInventory.getCell( is, container );
|
||||
}
|
||||
@@ -58,7 +60,7 @@ public class BasicCellHandler implements ICellHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openChestGui( final EntityPlayer player, final IChestOrDrive chest, final ICellHandler cellHandler, final IMEInventoryHandler inv, final ItemStack is, final StorageChannel chan )
|
||||
public void openChestGui( final EntityPlayer player, final IChestOrDrive chest, final ICellHandler cellHandler, final IMEInventoryHandler inv, final ItemStack is, final IStorageChannel chan )
|
||||
{
|
||||
Platform.openGUI( player, (TileEntity) chest, AEPartLocation.fromFacing( chest.getUp() ), GuiBridge.GUI_ME );
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import appeng.api.storage.ICellHandler;
|
||||
import appeng.api.storage.ICellRegistry;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.ISaveProvider;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
|
||||
|
||||
public class CellRegistry implements ICellRegistry
|
||||
@@ -85,7 +85,7 @@ public class CellRegistry implements ICellRegistry
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEInventoryHandler getCellInventory( final ItemStack is, final ISaveProvider container, final StorageChannel chan )
|
||||
public IMEInventoryHandler getCellInventory( final ItemStack is, final ISaveProvider container, final IStorageChannel chan )
|
||||
{
|
||||
if( is.isEmpty() )
|
||||
{
|
||||
|
||||
@@ -23,12 +23,14 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.implementations.tiles.IChestOrDrive;
|
||||
import appeng.api.storage.ICellHandler;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.ISaveProvider;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.items.storage.ItemCreativeStorageCell;
|
||||
@@ -46,9 +48,10 @@ public class CreativeCellHandler implements ICellHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEInventoryHandler getCellInventory( final ItemStack is, final ISaveProvider container, final StorageChannel channel )
|
||||
public IMEInventoryHandler getCellInventory( final ItemStack is, final ISaveProvider container, final IStorageChannel channel )
|
||||
{
|
||||
if( channel == StorageChannel.ITEMS && !is.isEmpty() && is.getItem() instanceof ItemCreativeStorageCell )
|
||||
if( channel == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) && !is.isEmpty() && is
|
||||
.getItem() instanceof ItemCreativeStorageCell )
|
||||
{
|
||||
return CreativeCellInventory.getCell( is );
|
||||
}
|
||||
@@ -56,7 +59,7 @@ public class CreativeCellHandler implements ICellHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openChestGui( final EntityPlayer player, final IChestOrDrive chest, final ICellHandler cellHandler, final IMEInventoryHandler inv, final ItemStack is, final StorageChannel chan )
|
||||
public void openChestGui( final EntityPlayer player, final IChestOrDrive chest, final ICellHandler cellHandler, final IMEInventoryHandler inv, final ItemStack is, final IStorageChannel chan )
|
||||
{
|
||||
Platform.openGUI( player, (TileEntity) chest, AEPartLocation.fromFacing( chest.getUp() ), GuiBridge.GUI_ME );
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ public class PacketAssemblerAnimation extends AppEngPacket
|
||||
this.y = stream.readInt();
|
||||
this.z = stream.readInt();
|
||||
this.rate = stream.readByte();
|
||||
this.is = AEItemStack.loadItemStackFromPacket( stream );
|
||||
this.is = AEItemStack.fromPacket( stream );
|
||||
}
|
||||
|
||||
// api
|
||||
|
||||
@@ -59,7 +59,7 @@ public class PacketInventoryAction extends AppEngPacket
|
||||
final boolean hasItem = stream.readBoolean();
|
||||
if( hasItem )
|
||||
{
|
||||
this.slotItem = AEItemStack.loadItemStackFromPacket( stream );
|
||||
this.slotItem = AEItemStack.fromPacket( stream );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -36,6 +36,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.networking.IGrid;
|
||||
@@ -44,6 +45,7 @@ import appeng.api.networking.energy.IEnergyGrid;
|
||||
import appeng.api.networking.security.ISecurityGrid;
|
||||
import appeng.api.networking.storage.IStorageGrid;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.network.INetworkInfo;
|
||||
@@ -135,7 +137,7 @@ public class PacketJEIRecipe extends AppEngPacket
|
||||
|
||||
if( inv != null && this.recipe != null && security != null )
|
||||
{
|
||||
final IMEMonitor<IAEItemStack> storage = inv.getItemInventory();
|
||||
final IMEMonitor<IAEItemStack> storage = inv.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
final IPartitionList<IAEItemStack> filter = ItemViewCell.createFilter( cct.getViewCells() );
|
||||
|
||||
for( int x = 0; x < craftMatrix.getSlots(); x++ )
|
||||
@@ -151,7 +153,7 @@ public class PacketJEIRecipe extends AppEngPacket
|
||||
// put away old item
|
||||
if( newItem != currentItem && security.hasPermission( player, SecurityPermissions.INJECT ) )
|
||||
{
|
||||
final IAEItemStack in = AEItemStack.create( currentItem );
|
||||
final IAEItemStack in = AEItemStack.fromItemStack( currentItem );
|
||||
final IAEItemStack out = cct.useRealItems() ? Platform.poweredInsert( energy, storage, in, cct.getActionSource() ) : null;
|
||||
if( out != null )
|
||||
{
|
||||
@@ -169,7 +171,7 @@ public class PacketJEIRecipe extends AppEngPacket
|
||||
// for each variant
|
||||
for( int y = 0; y < this.recipe[x].length && currentItem.isEmpty(); y++ )
|
||||
{
|
||||
final IAEItemStack request = AEItemStack.create( this.recipe[x][y] );
|
||||
final IAEItemStack request = AEItemStack.fromItemStack( this.recipe[x][y] );
|
||||
if( request != null )
|
||||
{
|
||||
// try ae
|
||||
|
||||
@@ -113,7 +113,7 @@ public class PacketMEInventoryUpdate extends AppEngPacket
|
||||
|
||||
while( uncompressed.readableBytes() > 0 )
|
||||
{
|
||||
this.list.add( AEItemStack.loadItemStackFromPacket( uncompressed ) );
|
||||
this.list.add( AEItemStack.fromPacket( uncompressed ) );
|
||||
}
|
||||
|
||||
this.empty = this.list.isEmpty();
|
||||
|
||||
@@ -29,6 +29,7 @@ import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.container.implementations.ContainerPatternTerm;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
@@ -65,7 +66,7 @@ public class PacketPatternSlot extends AppEngPacket
|
||||
|
||||
if( hasItem )
|
||||
{
|
||||
return AEItemStack.loadItemStackFromPacket( stream );
|
||||
return AEItemStack.fromPacket( stream );
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -87,7 +88,7 @@ public class PacketPatternSlot extends AppEngPacket
|
||||
this.writeItem( slotItem, data );
|
||||
for( int x = 0; x < 9; x++ )
|
||||
{
|
||||
this.pattern[x] = AEApi.instance().storage().createItemStack( pat.getStackInSlot( x ) );
|
||||
this.pattern[x] = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( pat.getStackInSlot( x ) );
|
||||
this.writeItem( this.pattern[x], data );
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||
import appeng.api.networking.security.IActionHost;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.networking.storage.IStorageGrid;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
@@ -54,8 +55,8 @@ public class CraftingJob implements Runnable, ICraftingJob
|
||||
|
||||
private final MECraftingInventory original;
|
||||
private final World world;
|
||||
private final IItemList<IAEItemStack> crafting = AEApi.instance().storage().createItemList();
|
||||
private final IItemList<IAEItemStack> missing = AEApi.instance().storage().createItemList();
|
||||
private final IItemList<IAEItemStack> crafting = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
private final IItemList<IAEItemStack> missing = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
private final HashMap<String, TwoIntegers> opsAndMultiplier = new HashMap<>();
|
||||
private final Object monitor = new Object();
|
||||
private final Stopwatch watch = Stopwatch.createUnstarted();
|
||||
@@ -85,7 +86,8 @@ public class CraftingJob implements Runnable, ICraftingJob
|
||||
this.callback = callback;
|
||||
final ICraftingGrid cc = grid.getCache( ICraftingGrid.class );
|
||||
final IStorageGrid sg = grid.getCache( IStorageGrid.class );
|
||||
this.original = new MECraftingInventory( sg.getItemInventory(), actionSrc, false, false, false );
|
||||
this.original = new MECraftingInventory( sg
|
||||
.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ), actionSrc, false, false, false );
|
||||
|
||||
this.setTree( this.getCraftingTree( cc, what ) );
|
||||
this.availableCheck = null;
|
||||
|
||||
@@ -34,6 +34,7 @@ import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.networking.crafting.ICraftingGrid;
|
||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.me.cluster.implementations.CraftingCPUCluster;
|
||||
@@ -45,7 +46,7 @@ public class CraftingTreeNode
|
||||
// what slot!
|
||||
private final int slot;
|
||||
private final CraftingJob job;
|
||||
private final IItemList<IAEItemStack> used = AEApi.instance().storage().createItemList();
|
||||
private final IItemList<IAEItemStack> used = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
// parent node.
|
||||
private final CraftingTreeProcess parent;
|
||||
private final World world;
|
||||
|
||||
@@ -34,6 +34,7 @@ import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.crafting.ICraftingGrid;
|
||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.container.ContainerNull;
|
||||
@@ -207,7 +208,7 @@ public class CraftingTreeProcess
|
||||
ItemStack is = ic.getStackInSlot( x );
|
||||
is = Platform.getContainerItem( is );
|
||||
|
||||
final IAEItemStack o = AEApi.instance().storage().createItemStack( is );
|
||||
final IAEItemStack o = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( is );
|
||||
if( o != null )
|
||||
{
|
||||
this.bytes++;
|
||||
@@ -226,7 +227,7 @@ public class CraftingTreeProcess
|
||||
if( this.containerItems )
|
||||
{
|
||||
final ItemStack is = Platform.getContainerItem( stack.createItemStack() );
|
||||
final IAEItemStack o = AEApi.instance().storage().createItemStack( is );
|
||||
final IAEItemStack o = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( is );
|
||||
if( o != null )
|
||||
{
|
||||
this.bytes++;
|
||||
|
||||
@@ -24,7 +24,8 @@ import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.util.inv.ItemListIgnoreCrafting;
|
||||
@@ -49,7 +50,7 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
|
||||
|
||||
public MECraftingInventory()
|
||||
{
|
||||
this.localCache = new ItemListIgnoreCrafting<>( AEApi.instance().storage().createItemList() );
|
||||
this.localCache = new ItemListIgnoreCrafting<>( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList() );
|
||||
this.extractedCache = null;
|
||||
this.injectedCache = null;
|
||||
this.missingCache = null;
|
||||
@@ -69,7 +70,7 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
|
||||
|
||||
if( this.logMissing )
|
||||
{
|
||||
this.missingCache = AEApi.instance().storage().createItemList();
|
||||
this.missingCache = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -78,7 +79,7 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
|
||||
|
||||
if( this.logExtracted )
|
||||
{
|
||||
this.extractedCache = AEApi.instance().storage().createItemList();
|
||||
this.extractedCache = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -87,14 +88,15 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
|
||||
|
||||
if( this.logInjections )
|
||||
{
|
||||
this.injectedCache = AEApi.instance().storage().createItemList();
|
||||
this.injectedCache = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.injectedCache = null;
|
||||
}
|
||||
|
||||
this.localCache = this.target.getAvailableItems( new ItemListIgnoreCrafting<>( AEApi.instance().storage().createItemList() ) );
|
||||
this.localCache = this.target
|
||||
.getAvailableItems( new ItemListIgnoreCrafting<>( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList() ) );
|
||||
|
||||
this.par = parent;
|
||||
}
|
||||
@@ -108,7 +110,7 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
|
||||
|
||||
if( logMissing )
|
||||
{
|
||||
this.missingCache = AEApi.instance().storage().createItemList();
|
||||
this.missingCache = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -117,7 +119,7 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
|
||||
|
||||
if( logExtracted )
|
||||
{
|
||||
this.extractedCache = AEApi.instance().storage().createItemList();
|
||||
this.extractedCache = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -126,14 +128,14 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
|
||||
|
||||
if( logInjections )
|
||||
{
|
||||
this.injectedCache = AEApi.instance().storage().createItemList();
|
||||
this.injectedCache = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.injectedCache = null;
|
||||
}
|
||||
|
||||
this.localCache = new ItemListIgnoreCrafting<>( AEApi.instance().storage().createItemList() );
|
||||
this.localCache = new ItemListIgnoreCrafting<>( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList() );
|
||||
for( final IAEItemStack is : target.getStorageList() )
|
||||
{
|
||||
this.localCache.add( target.extractItems( is, Actionable.SIMULATE, src ) );
|
||||
@@ -151,7 +153,7 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
|
||||
|
||||
if( logMissing )
|
||||
{
|
||||
this.missingCache = AEApi.instance().storage().createItemList();
|
||||
this.missingCache = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -160,7 +162,7 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
|
||||
|
||||
if( logExtracted )
|
||||
{
|
||||
this.extractedCache = AEApi.instance().storage().createItemList();
|
||||
this.extractedCache = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -169,14 +171,14 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
|
||||
|
||||
if( logInjections )
|
||||
{
|
||||
this.injectedCache = AEApi.instance().storage().createItemList();
|
||||
this.injectedCache = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.injectedCache = null;
|
||||
}
|
||||
|
||||
this.localCache = target.getAvailableItems( AEApi.instance().storage().createItemList() );
|
||||
this.localCache = target.getAvailableItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList() );
|
||||
this.par = null;
|
||||
}
|
||||
|
||||
@@ -255,9 +257,9 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getChannel()
|
||||
public IStorageChannel getChannel()
|
||||
{
|
||||
return StorageChannel.ITEMS;
|
||||
return AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class );
|
||||
}
|
||||
|
||||
public IItemList<IAEItemStack> getItemList()
|
||||
@@ -267,8 +269,8 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
|
||||
|
||||
public boolean commit( final IActionSource src )
|
||||
{
|
||||
final IItemList<IAEItemStack> added = AEApi.instance().storage().createItemList();
|
||||
final IItemList<IAEItemStack> pulled = AEApi.instance().storage().createItemList();
|
||||
final IItemList<IAEItemStack> added = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
final IItemList<IAEItemStack> pulled = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
boolean failed = false;
|
||||
|
||||
if( this.logInjections )
|
||||
|
||||
@@ -75,11 +75,14 @@ import appeng.api.networking.ticking.TickingRequest;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.IStorageMonitorable;
|
||||
import appeng.api.storage.IStorageMonitorableAccessor;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.channels.IFluidStorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
@@ -125,8 +128,12 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
private final AppEngInternalAEInventory config = new AppEngInternalAEInventory( this, NUMBER_OF_CONFIG_SLOTS );
|
||||
private final AppEngInternalInventory storage = new AppEngInternalInventory( this, NUMBER_OF_STORAGE_SLOTS );
|
||||
private final AppEngInternalInventory patterns = new AppEngInternalInventory( this, NUMBER_OF_PATTERN_SLOTS );
|
||||
private final MEMonitorPassThrough<IAEItemStack> items = new MEMonitorPassThrough<>( new NullInventory<IAEItemStack>(), StorageChannel.ITEMS );
|
||||
private final MEMonitorPassThrough<IAEFluidStack> fluids = new MEMonitorPassThrough<>( new NullInventory<IAEFluidStack>(), StorageChannel.FLUIDS );
|
||||
private final MEMonitorPassThrough<IAEItemStack> items = new MEMonitorPassThrough<>( new NullInventory<IAEItemStack>(), AEApi.instance()
|
||||
.storage()
|
||||
.getStorageChannel( IItemStorageChannel.class ) );
|
||||
private final MEMonitorPassThrough<IAEFluidStack> fluids = new MEMonitorPassThrough<>( new NullInventory<IAEFluidStack>(), AEApi.instance()
|
||||
.storage()
|
||||
.getStorageChannel( IFluidStorageChannel.class ) );
|
||||
private final UpgradeInventory upgrades;
|
||||
private boolean hasConfig = false;
|
||||
private int priority;
|
||||
@@ -412,7 +419,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
|
||||
if( req == null && !stored.isEmpty() )
|
||||
{
|
||||
final IAEItemStack work = AEApi.instance().storage().createItemStack( stored );
|
||||
final IAEItemStack work = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( stored );
|
||||
this.requireWork[slot] = work.setStackSize( -work.getStackSize() );
|
||||
return;
|
||||
}
|
||||
@@ -435,7 +442,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
else
|
||||
// Stored != null; dispose!
|
||||
{
|
||||
final IAEItemStack work = AEApi.instance().storage().createItemStack( stored );
|
||||
final IAEItemStack work = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( stored );
|
||||
this.requireWork[slot] = work.setStackSize( -work.getStackSize() );
|
||||
return;
|
||||
}
|
||||
@@ -500,7 +507,8 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
@Override
|
||||
public boolean canInsert( final ItemStack stack )
|
||||
{
|
||||
final IAEItemStack out = this.destination.injectItems( AEApi.instance().storage().createItemStack( stack ), Actionable.SIMULATE, null );
|
||||
final IAEItemStack out = this.destination.injectItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( stack ),
|
||||
Actionable.SIMULATE, null );
|
||||
if( out == null )
|
||||
{
|
||||
return true;
|
||||
@@ -526,8 +534,8 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
{
|
||||
try
|
||||
{
|
||||
this.items.setInternal( this.gridProxy.getStorage().getItemInventory() );
|
||||
this.fluids.setInternal( this.gridProxy.getStorage().getFluidInventory() );
|
||||
this.items.setInternal( this.gridProxy.getStorage().getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ) );
|
||||
this.fluids.setInternal( this.gridProxy.getStorage().getInventory( AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) ) );
|
||||
}
|
||||
catch( final GridAccessException gae )
|
||||
{
|
||||
@@ -663,7 +671,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
boolean changed = false;
|
||||
try
|
||||
{
|
||||
this.destination = this.gridProxy.getStorage().getItemInventory();
|
||||
this.destination = this.gridProxy.getStorage().getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
final IEnergySource src = this.gridProxy.getEnergy();
|
||||
|
||||
if( this.craftingTracker.isBusy( x ) )
|
||||
@@ -788,14 +796,28 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEItemStack> getItemInventory()
|
||||
public <T extends IAEStack<T>> IMEMonitor<T> getInventory( IStorageChannel<T> channel )
|
||||
{
|
||||
if( this.hasConfig() )
|
||||
if( channel == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
|
||||
{
|
||||
return new InterfaceInventory( this );
|
||||
if( this.hasConfig() )
|
||||
{
|
||||
return (IMEMonitor<T>) new InterfaceInventory( this );
|
||||
}
|
||||
|
||||
return (IMEMonitor<T>) this.items;
|
||||
}
|
||||
else if( channel == AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) )
|
||||
{
|
||||
if( this.hasConfig() )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return (IMEMonitor<T>) this.fluids;
|
||||
}
|
||||
|
||||
return this.items;
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean hasConfig()
|
||||
@@ -851,17 +873,6 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEFluidStack> getFluidInventory()
|
||||
{
|
||||
if( this.hasConfig() )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.fluids;
|
||||
}
|
||||
|
||||
private void cancelCrafting()
|
||||
{
|
||||
this.craftingTracker.cancel();
|
||||
@@ -880,14 +891,12 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
{
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEItemStack> getItemInventory()
|
||||
{
|
||||
return new InterfaceInventory( di );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEFluidStack> getFluidInventory()
|
||||
public <T extends IAEStack<T>> IMEMonitor<T> getInventory( IStorageChannel<T> channel )
|
||||
{
|
||||
if( channel == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
|
||||
{
|
||||
return (IMEMonitor<T>) new InterfaceInventory( di );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
@@ -1119,11 +1128,11 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
|
||||
if( mode == Actionable.SIMULATE )
|
||||
{
|
||||
return AEItemStack.create( adaptor.simulateAdd( acquired.createItemStack() ) );
|
||||
return AEItemStack.fromItemStack( adaptor.simulateAdd( acquired.createItemStack() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
final IAEItemStack is = AEItemStack.create( adaptor.addItems( acquired.createItemStack() ) );
|
||||
final IAEItemStack is = AEItemStack.fromItemStack( adaptor.addItems( acquired.createItemStack() ) );
|
||||
this.updatePlan( slot );
|
||||
return is;
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.container.ContainerNull;
|
||||
import appeng.util.ItemSorters;
|
||||
@@ -78,7 +79,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
|
||||
this.canSubstitute = this.isCrafting && encodedValue.getBoolean( "substitute" );
|
||||
this.patternItem = is;
|
||||
this.pattern = AEItemStack.create( is );
|
||||
this.pattern = AEItemStack.fromItemStack( is );
|
||||
|
||||
final List<IAEItemStack> in = new ArrayList<>();
|
||||
final List<IAEItemStack> out = new ArrayList<>();
|
||||
@@ -100,7 +101,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
this.markItemAs( x, gs, TestStatus.ACCEPT );
|
||||
}
|
||||
|
||||
in.add( AEApi.instance().storage().createItemStack( gs ) );
|
||||
in.add( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( gs ) );
|
||||
this.testFrame.setInventorySlotContents( x, gs );
|
||||
}
|
||||
|
||||
@@ -111,7 +112,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
if( this.standardRecipe != null )
|
||||
{
|
||||
this.correctOutput = this.standardRecipe.getCraftingResult( this.crafting );
|
||||
out.add( AEApi.instance().storage().createItemStack( this.correctOutput ) );
|
||||
out.add( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( this.correctOutput ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -135,7 +136,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
|
||||
if( !gs.isEmpty() )
|
||||
{
|
||||
out.add( AEApi.instance().storage().createItemStack( gs ) );
|
||||
out.add( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( gs ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,9 +39,10 @@ import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.networking.storage.IStorageGrid;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.IMEMonitorHandlerReceiver;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.api.util.IConfigManager;
|
||||
@@ -95,7 +96,7 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
|
||||
this.sg = this.targetGrid.getCache( IStorageGrid.class );
|
||||
if( this.sg != null )
|
||||
{
|
||||
this.itemStorage = this.sg.getItemInventory();
|
||||
this.itemStorage = this.sg.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -108,23 +109,9 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEItemStack> getItemInventory()
|
||||
public <T extends IAEStack<T>> IMEMonitor<T> getInventory( IStorageChannel<T> channel )
|
||||
{
|
||||
if( this.sg == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return this.sg.getItemInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEFluidStack> getFluidInventory()
|
||||
{
|
||||
if( this.sg == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return this.sg.getFluidInventory();
|
||||
return this.sg.getInventory( channel );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -146,7 +133,7 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemList<IAEItemStack> getAvailableItems( final IItemList out )
|
||||
public IItemList<IAEItemStack> getAvailableItems( final IItemList<IAEItemStack> out )
|
||||
{
|
||||
if( this.itemStorage != null )
|
||||
{
|
||||
@@ -242,13 +229,13 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getChannel()
|
||||
public IStorageChannel getChannel()
|
||||
{
|
||||
if( this.itemStorage != null )
|
||||
{
|
||||
return this.itemStorage.getChannel();
|
||||
}
|
||||
return StorageChannel.ITEMS;
|
||||
return AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,6 +22,7 @@ package appeng.items.contents;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
import appeng.api.config.Settings;
|
||||
@@ -31,9 +32,11 @@ import appeng.api.config.ViewItems;
|
||||
import appeng.api.implementations.guiobjects.IPortableCell;
|
||||
import appeng.api.implementations.items.IAEItemPowerStorage;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.MEMonitorHandler;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.container.interfaces.IInventorySlotAware;
|
||||
import appeng.me.storage.CellInventory;
|
||||
@@ -83,14 +86,12 @@ public class PortableCellViewer extends MEMonitorHandler<IAEItemStack> implement
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEItemStack> getItemInventory()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEFluidStack> getFluidInventory()
|
||||
public <T extends IAEStack<T>> IMEMonitor<T> getInventory( IStorageChannel<T> channel )
|
||||
{
|
||||
if( channel == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
|
||||
{
|
||||
return (IMEMonitor<T>) this;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ import appeng.api.implementations.items.IUpgradeModule;
|
||||
import appeng.api.storage.ICellInventory;
|
||||
import appeng.api.storage.ICellInventoryHandler;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.core.AEConfig;
|
||||
@@ -101,7 +101,8 @@ public final class ItemBasicStorageCell extends AEBaseItem implements IStorageCe
|
||||
@Override
|
||||
public void addCheckedInformation( final ItemStack stack, final World world, final List<String> lines, final ITooltipFlag advancedTooltips )
|
||||
{
|
||||
final IMEInventoryHandler<?> inventory = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
|
||||
final IMEInventoryHandler<?> inventory = AEApi.instance().registries().cell().getCellInventory( stack, null,
|
||||
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
|
||||
if( inventory instanceof ICellInventoryHandler )
|
||||
{
|
||||
@@ -236,11 +237,13 @@ public final class ItemBasicStorageCell extends AEBaseItem implements IStorageCe
|
||||
}
|
||||
|
||||
final InventoryPlayer playerInventory = player.inventory;
|
||||
final IMEInventoryHandler inv = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
|
||||
final IMEInventoryHandler inv = AEApi.instance().registries().cell().getCellInventory( stack, null,
|
||||
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
if( inv != null && playerInventory.getCurrentItem() == stack )
|
||||
{
|
||||
final InventoryAdaptor ia = InventoryAdaptor.getAdaptor( player );
|
||||
final IItemList<IAEItemStack> list = inv.getAvailableItems( StorageChannel.ITEMS.createList() );
|
||||
final IItemList<IAEItemStack> list = inv
|
||||
.getAvailableItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList() );
|
||||
if( list.isEmpty() && ia != null )
|
||||
{
|
||||
playerInventory.setInventorySlotContents( playerInventory.currentItem, ItemStack.EMPTY );
|
||||
|
||||
@@ -33,7 +33,7 @@ import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.storage.ICellInventoryHandler;
|
||||
import appeng.api.storage.ICellWorkbenchItem;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.items.contents.CellConfig;
|
||||
|
||||
@@ -80,7 +80,8 @@ public class ItemCreativeStorageCell extends AEBaseItem implements ICellWorkbenc
|
||||
@Override
|
||||
public void addCheckedInformation( final ItemStack stack, final World world, final List<String> lines, final ITooltipFlag advancedTooltips )
|
||||
{
|
||||
final IMEInventoryHandler<?> inventory = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
|
||||
final IMEInventoryHandler<?> inventory = AEApi.instance().registries().cell().getCellInventory( stack, null,
|
||||
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
|
||||
if( inventory instanceof ICellInventoryHandler )
|
||||
{
|
||||
|
||||
@@ -27,6 +27,7 @@ import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.implementations.items.IUpgradeModule;
|
||||
import appeng.api.storage.ICellWorkbenchItem;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.items.AEBaseItem;
|
||||
@@ -62,7 +63,7 @@ public class ItemViewCell extends AEBaseItem implements ICellWorkbenchItem
|
||||
|
||||
if( ( currentViewCell.getItem() instanceof ItemViewCell ) )
|
||||
{
|
||||
final IItemList<IAEItemStack> priorityList = AEApi.instance().storage().createItemList();
|
||||
final IItemList<IAEItemStack> priorityList = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
|
||||
final ICellWorkbenchItem vc = (ICellWorkbenchItem) currentViewCell.getItem();
|
||||
final IItemHandler upgrades = vc.getUpgradesInventory( currentViewCell );
|
||||
@@ -99,7 +100,7 @@ public class ItemViewCell extends AEBaseItem implements ICellWorkbenchItem
|
||||
final ItemStack is = config.getStackInSlot( x );
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
priorityList.add( AEItemStack.create( is ) );
|
||||
priorityList.add( AEItemStack.fromItemStack( is ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ import appeng.api.implementations.tiles.IColorableTile;
|
||||
import appeng.api.storage.ICellInventory;
|
||||
import appeng.api.storage.ICellInventoryHandler;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.api.util.AEColor;
|
||||
@@ -119,10 +119,11 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
|
||||
ItemStack paintBall = this.getColor( is );
|
||||
|
||||
final IMEInventory<IAEItemStack> inv = AEApi.instance().registries().cell().getCellInventory( is, null, StorageChannel.ITEMS );
|
||||
final IMEInventory<IAEItemStack> inv = AEApi.instance().registries().cell().getCellInventory( is, null,
|
||||
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
if( inv != null )
|
||||
{
|
||||
final IAEItemStack option = inv.extractItems( AEItemStack.create( paintBall ), Actionable.SIMULATE, new BaseActionSource() );
|
||||
final IAEItemStack option = inv.extractItems( AEItemStack.fromItemStack( paintBall ), Actionable.SIMULATE, new BaseActionSource() );
|
||||
|
||||
if( option != null )
|
||||
{
|
||||
@@ -150,7 +151,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
{
|
||||
if( ( (IColorableTile) te ).recolourBlock( side, AEColor.TRANSPARENT, p ) )
|
||||
{
|
||||
inv.extractItems( AEItemStack.create( paintBall ), Actionable.MODULATE, new BaseActionSource() );
|
||||
inv.extractItems( AEItemStack.fromItemStack( paintBall ), Actionable.MODULATE, new BaseActionSource() );
|
||||
this.extractAEPower( is, powerPerUse, Actionable.MODULATE );
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
@@ -162,7 +163,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
final TileEntity painted = w.getTileEntity( pos.offset( side ) );
|
||||
if( this.getAECurrentPower( is ) > powerPerUse && testBlk instanceof BlockPaint && painted instanceof TilePaint )
|
||||
{
|
||||
inv.extractItems( AEItemStack.create( paintBall ), Actionable.MODULATE, new BaseActionSource() );
|
||||
inv.extractItems( AEItemStack.fromItemStack( paintBall ), Actionable.MODULATE, new BaseActionSource() );
|
||||
this.extractAEPower( is, powerPerUse, Actionable.MODULATE );
|
||||
( (TilePaint) painted ).cleanSide( side.getOpposite() );
|
||||
return EnumActionResult.SUCCESS;
|
||||
@@ -176,7 +177,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
{
|
||||
if( color != AEColor.TRANSPARENT && this.recolourBlock( blk, side, w, pos, side, color, p ) )
|
||||
{
|
||||
inv.extractItems( AEItemStack.create( paintBall ), Actionable.MODULATE, new BaseActionSource() );
|
||||
inv.extractItems( AEItemStack.fromItemStack( paintBall ), Actionable.MODULATE, new BaseActionSource() );
|
||||
this.extractAEPower( is, powerPerUse, Actionable.MODULATE );
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
@@ -265,10 +266,12 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
{
|
||||
ItemStack newColor = ItemStack.EMPTY;
|
||||
|
||||
final IMEInventory<IAEItemStack> inv = AEApi.instance().registries().cell().getCellInventory( is, null, StorageChannel.ITEMS );
|
||||
final IMEInventory<IAEItemStack> inv = AEApi.instance().registries().cell().getCellInventory( is, null,
|
||||
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
if( inv != null )
|
||||
{
|
||||
final IItemList<IAEItemStack> itemList = inv.getAvailableItems( AEApi.instance().storage().createItemList() );
|
||||
final IItemList<IAEItemStack> itemList = inv
|
||||
.getAvailableItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList() );
|
||||
if( anchor.isEmpty() )
|
||||
{
|
||||
final IAEItemStack firstItem = itemList.getFirstItem();
|
||||
@@ -429,7 +432,8 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
{
|
||||
super.addCheckedInformation( stack, world, lines, advancedTooltips );
|
||||
|
||||
final IMEInventory<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
|
||||
final IMEInventory<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( stack, null,
|
||||
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
|
||||
if( cdi instanceof CellInventoryHandler )
|
||||
{
|
||||
|
||||
@@ -55,7 +55,7 @@ import appeng.api.implementations.items.IStorageCell;
|
||||
import appeng.api.storage.ICellInventory;
|
||||
import appeng.api.storage.ICellInventoryHandler;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
@@ -96,7 +96,8 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell
|
||||
{
|
||||
super.addCheckedInformation( stack, world, lines, advancedTooltips );
|
||||
|
||||
final IMEInventory<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
|
||||
final IMEInventory<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( stack, null,
|
||||
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
|
||||
if( cdi instanceof CellInventoryHandler )
|
||||
{
|
||||
@@ -122,10 +123,11 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell
|
||||
shots += cu.getInstalledUpgrades( Upgrades.SPEED );
|
||||
}
|
||||
|
||||
final IMEInventory inv = AEApi.instance().registries().cell().getCellInventory( p.getHeldItem( hand ), null, StorageChannel.ITEMS );
|
||||
final IMEInventory inv = AEApi.instance().registries().cell().getCellInventory( p.getHeldItem( hand ), null,
|
||||
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
if( inv != null )
|
||||
{
|
||||
final IItemList itemList = inv.getAvailableItems( AEApi.instance().storage().createItemList() );
|
||||
final IItemList itemList = inv.getAvailableItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList() );
|
||||
IAEStack aeAmmo = itemList.getFirstItem();
|
||||
if( aeAmmo instanceof IAEItemStack )
|
||||
{
|
||||
|
||||
@@ -43,7 +43,7 @@ import appeng.api.implementations.items.IStorageCell;
|
||||
import appeng.api.storage.ICellInventory;
|
||||
import appeng.api.storage.ICellInventoryHandler;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.core.AEConfig;
|
||||
@@ -84,7 +84,8 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell,
|
||||
{
|
||||
super.addCheckedInformation( stack, world, lines, advancedTooltips );
|
||||
|
||||
final IMEInventory<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
|
||||
final IMEInventory<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( stack, null,
|
||||
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
|
||||
if( cdi instanceof CellInventoryHandler )
|
||||
{
|
||||
|
||||
+17
-13
@@ -44,6 +44,7 @@ import com.google.common.collect.Multimap;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.IGrid;
|
||||
@@ -71,7 +72,8 @@ import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.networking.storage.IStorageGrid;
|
||||
import appeng.api.storage.ICellProvider;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
@@ -87,7 +89,7 @@ import appeng.tile.crafting.TileCraftingTile;
|
||||
import appeng.util.ItemSorters;
|
||||
|
||||
|
||||
public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper, ICellProvider, IMEInventoryHandler<IAEStack>
|
||||
public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper, ICellProvider, IMEInventoryHandler<IAEItemStack>
|
||||
{
|
||||
|
||||
private static final ExecutorService CRAFTING_POOL;
|
||||
@@ -264,7 +266,8 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
|
||||
this.emitableItems.clear();
|
||||
|
||||
// update the stuff that was in the list...
|
||||
this.storageGrid.postAlterationOfStoredItems( StorageChannel.ITEMS, oldItems.keySet(), new BaseActionSource() );
|
||||
this.storageGrid.postAlterationOfStoredItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ), oldItems.keySet(),
|
||||
new BaseActionSource() );
|
||||
|
||||
// re-create list..
|
||||
for( final ICraftingProvider provider : this.craftingProviders )
|
||||
@@ -300,7 +303,8 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
|
||||
this.craftableItems.put( e.getKey(), ImmutableList.copyOf( e.getValue() ) );
|
||||
}
|
||||
|
||||
this.storageGrid.postAlterationOfStoredItems( StorageChannel.ITEMS, this.craftableItems.keySet(), new BaseActionSource() );
|
||||
this.storageGrid.postAlterationOfStoredItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ), this.craftableItems.keySet(),
|
||||
new BaseActionSource() );
|
||||
}
|
||||
|
||||
private void updateCPUClusters()
|
||||
@@ -375,11 +379,11 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IMEInventoryHandler> getCellArray( final StorageChannel channel )
|
||||
public List<IMEInventoryHandler> getCellArray( final IStorageChannel channel )
|
||||
{
|
||||
final List<IMEInventoryHandler> list = new ArrayList<>( 1 );
|
||||
|
||||
if( channel == StorageChannel.ITEMS )
|
||||
if( channel == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
|
||||
{
|
||||
list.add( this );
|
||||
}
|
||||
@@ -400,13 +404,13 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPrioritized( final IAEStack input )
|
||||
public boolean isPrioritized( final IAEItemStack input )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAccept( final IAEStack input )
|
||||
public boolean canAccept( final IAEItemStack input )
|
||||
{
|
||||
for( final CraftingCPUCluster cpu : this.craftingCPUClusters )
|
||||
{
|
||||
@@ -432,7 +436,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEStack injectItems( IAEStack input, final Actionable type, final IActionSource src )
|
||||
public IAEItemStack injectItems( IAEItemStack input, final Actionable type, final IActionSource src )
|
||||
{
|
||||
for( final CraftingCPUCluster cpu : this.craftingCPUClusters )
|
||||
{
|
||||
@@ -443,13 +447,13 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEStack extractItems( final IAEStack request, final Actionable mode, final IActionSource src )
|
||||
public IAEItemStack extractItems( final IAEItemStack request, final Actionable mode, final IActionSource src )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemList<IAEStack> getAvailableItems( final IItemList<IAEStack> out )
|
||||
public IItemList<IAEItemStack> getAvailableItems( final IItemList<IAEItemStack> out )
|
||||
{
|
||||
// add craftable items!
|
||||
for( final IAEItemStack stack : this.craftableItems.keySet() )
|
||||
@@ -466,9 +470,9 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getChannel()
|
||||
public IStorageChannel<IAEItemStack> getChannel()
|
||||
{
|
||||
return StorageChannel.ITEMS;
|
||||
return AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+61
-133
@@ -21,8 +21,10 @@ package appeng.me.cache;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.SetMultimap;
|
||||
@@ -44,8 +46,7 @@ import appeng.api.storage.ICellContainer;
|
||||
import appeng.api.storage.ICellProvider;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
@@ -64,22 +65,23 @@ public class GridStorageCache implements IStorageGrid
|
||||
private final HashSet<ICellProvider> inactiveCellProviders = new HashSet<>();
|
||||
private final SetMultimap<IAEStack, ItemWatcher> interests = HashMultimap.create();
|
||||
private final GenericInterestManager<ItemWatcher> interestManager = new GenericInterestManager<>( this.interests );
|
||||
private final NetworkMonitor<IAEItemStack> itemMonitor = new NetworkMonitor<>( this, StorageChannel.ITEMS );
|
||||
private final NetworkMonitor<IAEFluidStack> fluidMonitor = new NetworkMonitor<>( this, StorageChannel.FLUIDS );
|
||||
private final HashMap<IGridNode, IStackWatcher> watchers = new HashMap<>();
|
||||
private NetworkInventoryHandler<IAEItemStack> myItemNetwork;
|
||||
private NetworkInventoryHandler<IAEFluidStack> myFluidNetwork;
|
||||
private Map<IStorageChannel<? extends IAEStack>, NetworkInventoryHandler<?>> storageNetworks;
|
||||
private Map<IStorageChannel<? extends IAEStack>, NetworkMonitor<?>> storageMonitors;
|
||||
|
||||
public GridStorageCache( final IGrid g )
|
||||
{
|
||||
this.myGrid = g;
|
||||
this.storageNetworks = new IdentityHashMap<>();
|
||||
this.storageMonitors = new IdentityHashMap<>();
|
||||
|
||||
AEApi.instance().storage().storageChannels().forEach( channel -> this.storageMonitors.put( channel, new NetworkMonitor<>( this, channel ) ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateTick()
|
||||
{
|
||||
this.itemMonitor.onTick();
|
||||
this.fluidMonitor.onTick();
|
||||
this.storageMonitors.forEach( ( channel, monitor ) -> monitor.onTick() );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -155,6 +157,17 @@ public class GridStorageCache implements IStorageGrid
|
||||
|
||||
}
|
||||
|
||||
public <T extends IAEStack<T>> IMEInventoryHandler<T> getInventoryHandler( IStorageChannel<T> channel )
|
||||
{
|
||||
return (IMEInventoryHandler<T>) this.storageNetworks.computeIfAbsent( channel, this::buildNetworkStorage );
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends IAEStack<T>> IMEMonitor<T> getInventory( IStorageChannel<T> channel )
|
||||
{
|
||||
return (IMEMonitor<T>) this.storageMonitors.get( channel );
|
||||
}
|
||||
|
||||
private CellChangeTracker addCellProvider( final ICellProvider cc, final CellChangeTracker tracker )
|
||||
{
|
||||
if( this.inactiveCellProviders.contains( cc ) )
|
||||
@@ -162,21 +175,15 @@ public class GridStorageCache implements IStorageGrid
|
||||
this.inactiveCellProviders.remove( cc );
|
||||
this.activeCellProviders.add( cc );
|
||||
|
||||
IActionSource actionSrc = new BaseActionSource();
|
||||
if( cc instanceof IActionHost )
|
||||
{
|
||||
actionSrc = new MachineSource( (IActionHost) cc );
|
||||
}
|
||||
final IActionSource actionSrc = cc instanceof IActionHost ? new MachineSource( (IActionHost) cc ) : new BaseActionSource();
|
||||
|
||||
for( final IMEInventoryHandler<IAEItemStack> h : cc.getCellArray( StorageChannel.ITEMS ) )
|
||||
this.storageMonitors.forEach( ( channel, monitor ) ->
|
||||
{
|
||||
tracker.postChanges( StorageChannel.ITEMS, 1, h, actionSrc );
|
||||
}
|
||||
|
||||
for( final IMEInventoryHandler<IAEFluidStack> h : cc.getCellArray( StorageChannel.FLUIDS ) )
|
||||
{
|
||||
tracker.postChanges( StorageChannel.FLUIDS, 1, h, actionSrc );
|
||||
}
|
||||
for( final IMEInventoryHandler<?> h : cc.getCellArray( channel ) )
|
||||
{
|
||||
tracker.postChanges( channel, 1, h, actionSrc );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
return tracker;
|
||||
@@ -189,22 +196,15 @@ public class GridStorageCache implements IStorageGrid
|
||||
this.activeCellProviders.remove( cc );
|
||||
this.inactiveCellProviders.add( cc );
|
||||
|
||||
IActionSource actionSrc = new BaseActionSource();
|
||||
final IActionSource actionSrc = cc instanceof IActionHost ? new MachineSource( (IActionHost) cc ) : new BaseActionSource();
|
||||
|
||||
if( cc instanceof IActionHost )
|
||||
this.storageMonitors.forEach( ( channel, monitor ) ->
|
||||
{
|
||||
actionSrc = new MachineSource( (IActionHost) cc );
|
||||
}
|
||||
|
||||
for( final IMEInventoryHandler<IAEItemStack> h : cc.getCellArray( StorageChannel.ITEMS ) )
|
||||
{
|
||||
tracker.postChanges( StorageChannel.ITEMS, -1, h, actionSrc );
|
||||
}
|
||||
|
||||
for( final IMEInventoryHandler<IAEFluidStack> h : cc.getCellArray( StorageChannel.FLUIDS ) )
|
||||
{
|
||||
tracker.postChanges( StorageChannel.FLUIDS, -1, h, actionSrc );
|
||||
}
|
||||
for( final IMEInventoryHandler<IAEItemStack> h : cc.getCellArray( channel ) )
|
||||
{
|
||||
tracker.postChanges( channel, -1, h, actionSrc );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
return tracker;
|
||||
@@ -213,10 +213,9 @@ public class GridStorageCache implements IStorageGrid
|
||||
@MENetworkEventSubscribe
|
||||
public void cellUpdate( final MENetworkCellArrayUpdate ev )
|
||||
{
|
||||
this.myItemNetwork = null;
|
||||
this.myFluidNetwork = null;
|
||||
this.storageNetworks.clear();
|
||||
|
||||
final LinkedList<ICellProvider> ll = new LinkedList();
|
||||
final List<ICellProvider> ll = new LinkedList<ICellProvider>();
|
||||
ll.addAll( this.inactiveCellProviders );
|
||||
ll.addAll( this.activeCellProviders );
|
||||
|
||||
@@ -249,85 +248,37 @@ public class GridStorageCache implements IStorageGrid
|
||||
}
|
||||
}
|
||||
|
||||
this.itemMonitor.forceUpdate();
|
||||
this.fluidMonitor.forceUpdate();
|
||||
this.storageMonitors.forEach( ( channel, monitor ) -> monitor.forceUpdate() );
|
||||
|
||||
tracker.applyChanges();
|
||||
}
|
||||
|
||||
private void postChangesToNetwork( final StorageChannel chan, final int upOrDown, final IItemList availableItems, final IActionSource src )
|
||||
private <T extends IAEStack<T>, C extends IStorageChannel<T>> void postChangesToNetwork( final C chan, final int upOrDown, final IItemList<T> availableItems, final IActionSource src )
|
||||
{
|
||||
switch( chan )
|
||||
{
|
||||
case FLUIDS:
|
||||
this.fluidMonitor.postChange( upOrDown > 0, availableItems, src );
|
||||
break;
|
||||
case ITEMS:
|
||||
this.itemMonitor.postChange( upOrDown > 0, availableItems, src );
|
||||
break;
|
||||
default:
|
||||
}
|
||||
this.storageMonitors.get( chan ).postChange( upOrDown > 0, (Iterable) availableItems, src );
|
||||
}
|
||||
|
||||
IMEInventoryHandler<IAEItemStack> getItemInventoryHandler()
|
||||
{
|
||||
if( this.myItemNetwork == null )
|
||||
{
|
||||
this.buildNetworkStorage( StorageChannel.ITEMS );
|
||||
}
|
||||
return this.myItemNetwork;
|
||||
}
|
||||
|
||||
private void buildNetworkStorage( final StorageChannel chan )
|
||||
private <T extends IAEStack<T>, C extends IStorageChannel<T>> NetworkInventoryHandler<T> buildNetworkStorage( final C chan )
|
||||
{
|
||||
final SecurityCache security = this.getGrid().getCache( ISecurityGrid.class );
|
||||
|
||||
switch( chan )
|
||||
{
|
||||
case FLUIDS:
|
||||
this.myFluidNetwork = new NetworkInventoryHandler<>( StorageChannel.FLUIDS, security );
|
||||
for( final ICellProvider cc : this.activeCellProviders )
|
||||
{
|
||||
for( final IMEInventoryHandler<IAEFluidStack> h : cc.getCellArray( chan ) )
|
||||
{
|
||||
this.myFluidNetwork.addNewStorage( h );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ITEMS:
|
||||
this.myItemNetwork = new NetworkInventoryHandler<>( StorageChannel.ITEMS, security );
|
||||
for( final ICellProvider cc : this.activeCellProviders )
|
||||
{
|
||||
for( final IMEInventoryHandler<IAEItemStack> h : cc.getCellArray( chan ) )
|
||||
{
|
||||
this.myItemNetwork.addNewStorage( h );
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
final NetworkInventoryHandler<T> storageNetwork = new NetworkInventoryHandler<>( chan, security );
|
||||
|
||||
IMEInventoryHandler<IAEFluidStack> getFluidInventoryHandler()
|
||||
{
|
||||
if( this.myFluidNetwork == null )
|
||||
for( final ICellProvider cc : this.activeCellProviders )
|
||||
{
|
||||
this.buildNetworkStorage( StorageChannel.FLUIDS );
|
||||
for( final IMEInventoryHandler<T> h : cc.getCellArray( chan ) )
|
||||
{
|
||||
storageNetwork.addNewStorage( h );
|
||||
}
|
||||
}
|
||||
return this.myFluidNetwork;
|
||||
|
||||
return storageNetwork;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postAlterationOfStoredItems( final StorageChannel chan, final Iterable<? extends IAEStack> input, final IActionSource src )
|
||||
public void postAlterationOfStoredItems( final IStorageChannel chan, final Iterable<? extends IAEStack> input, final IActionSource src )
|
||||
{
|
||||
if( chan == StorageChannel.ITEMS )
|
||||
{
|
||||
this.itemMonitor.postChange( true, (Iterable<IAEItemStack>) input, src );
|
||||
}
|
||||
else if( chan == StorageChannel.FLUIDS )
|
||||
{
|
||||
this.fluidMonitor.postChange( true, (Iterable<IAEFluidStack>) input, src );
|
||||
}
|
||||
this.storageMonitors.get( chan ).postChange( true, (Iterable) input, src );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -344,18 +295,6 @@ public class GridStorageCache implements IStorageGrid
|
||||
this.inactiveCellProviders.remove( provider );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEItemStack> getItemInventory()
|
||||
{
|
||||
return this.itemMonitor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEFluidStack> getFluidInventory()
|
||||
{
|
||||
return this.fluidMonitor;
|
||||
}
|
||||
|
||||
public GenericInterestManager<ItemWatcher> getInterestManager()
|
||||
{
|
||||
return this.interestManager;
|
||||
@@ -366,32 +305,21 @@ public class GridStorageCache implements IStorageGrid
|
||||
return this.myGrid;
|
||||
}
|
||||
|
||||
private class CellChangeTrackerRecord
|
||||
private class CellChangeTrackerRecord<T extends IAEStack<T>>
|
||||
{
|
||||
|
||||
final StorageChannel channel;
|
||||
final IStorageChannel<T> channel;
|
||||
final int up_or_down;
|
||||
final IItemList list;
|
||||
final IItemList<T> list;
|
||||
final IActionSource src;
|
||||
|
||||
public CellChangeTrackerRecord( final StorageChannel channel, final int i, final IMEInventoryHandler<? extends IAEStack> h, final IActionSource actionSrc )
|
||||
public CellChangeTrackerRecord( final IStorageChannel<T> channel, final int i, final IMEInventoryHandler<T> h, final IActionSource actionSrc )
|
||||
{
|
||||
this.channel = channel;
|
||||
this.up_or_down = i;
|
||||
this.src = actionSrc;
|
||||
|
||||
if( channel == StorageChannel.ITEMS )
|
||||
{
|
||||
this.list = ( (IMEInventoryHandler<IAEItemStack>) h ).getAvailableItems( AEApi.instance().storage().createItemList() );
|
||||
}
|
||||
else if( channel == StorageChannel.FLUIDS )
|
||||
{
|
||||
this.list = ( (IMEInventoryHandler<IAEFluidStack>) h ).getAvailableItems( AEApi.instance().storage().createFluidList() );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.list = null;
|
||||
}
|
||||
this.list = h.getAvailableItems( channel.createList() );
|
||||
}
|
||||
|
||||
public void applyChanges()
|
||||
@@ -400,19 +328,19 @@ public class GridStorageCache implements IStorageGrid
|
||||
}
|
||||
}
|
||||
|
||||
private class CellChangeTracker
|
||||
private class CellChangeTracker<T extends IAEStack<T>>
|
||||
{
|
||||
|
||||
final List<CellChangeTrackerRecord> data = new LinkedList<>();
|
||||
final List<CellChangeTrackerRecord<T>> data = new LinkedList<>();
|
||||
|
||||
public void postChanges( final StorageChannel channel, final int i, final IMEInventoryHandler<? extends IAEStack> h, final IActionSource actionSrc )
|
||||
public void postChanges( final IStorageChannel<T> channel, final int i, final IMEInventoryHandler<T> h, final IActionSource actionSrc )
|
||||
{
|
||||
this.data.add( new CellChangeTrackerRecord( channel, i, h, actionSrc ) );
|
||||
this.data.add( new CellChangeTrackerRecord<T>( channel, i, h, actionSrc ) );
|
||||
}
|
||||
|
||||
public void applyChanges()
|
||||
{
|
||||
for( final CellChangeTrackerRecord rec : this.data )
|
||||
for( final CellChangeTrackerRecord<T> rec : this.data )
|
||||
{
|
||||
rec.applyChanges();
|
||||
}
|
||||
|
||||
+10
-20
@@ -40,7 +40,7 @@ import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.IMEMonitorHandlerReceiver;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.me.storage.ItemWatcher;
|
||||
@@ -54,7 +54,7 @@ public class NetworkMonitor<T extends IAEStack<T>> implements IMEMonitor<T>
|
||||
@Nonnull
|
||||
private final GridStorageCache myGridCache;
|
||||
@Nonnull
|
||||
private final StorageChannel myChannel;
|
||||
private final IStorageChannel<T> myChannel;
|
||||
@Nonnull
|
||||
private final IItemList<T> cachedList;
|
||||
@Nonnull
|
||||
@@ -65,11 +65,11 @@ public class NetworkMonitor<T extends IAEStack<T>> implements IMEMonitor<T>
|
||||
@Nonnegative
|
||||
private int localDepthSemaphore = 0;
|
||||
|
||||
public NetworkMonitor( final GridStorageCache cache, final StorageChannel chan )
|
||||
public NetworkMonitor( final GridStorageCache cache, final IStorageChannel<T> chan )
|
||||
{
|
||||
this.myGridCache = cache;
|
||||
this.myChannel = chan;
|
||||
this.cachedList = (IItemList<T>) chan.createList();
|
||||
this.cachedList = chan.createList();
|
||||
this.listeners = new HashMap<>();
|
||||
}
|
||||
|
||||
@@ -112,13 +112,13 @@ public class NetworkMonitor<T extends IAEStack<T>> implements IMEMonitor<T>
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemList<T> getAvailableItems( final IItemList out )
|
||||
public IItemList<T> getAvailableItems( final IItemList<T> out )
|
||||
{
|
||||
return this.getHandler().getAvailableItems( out );
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getChannel()
|
||||
public IStorageChannel<T> getChannel()
|
||||
{
|
||||
return this.getHandler().getChannel();
|
||||
}
|
||||
@@ -188,18 +188,9 @@ public class NetworkMonitor<T extends IAEStack<T>> implements IMEMonitor<T>
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@SuppressWarnings( "unchecked" )
|
||||
private IMEInventoryHandler<T> getHandler()
|
||||
{
|
||||
switch( this.myChannel )
|
||||
{
|
||||
case ITEMS:
|
||||
return (IMEInventoryHandler<T>) this.myGridCache.getItemInventoryHandler();
|
||||
case FLUIDS:
|
||||
return (IMEInventoryHandler<T>) this.myGridCache.getFluidInventoryHandler();
|
||||
default:
|
||||
}
|
||||
return null;
|
||||
return this.myGridCache.getInventoryHandler( this.myChannel );
|
||||
}
|
||||
|
||||
private Iterator<Entry<IMEMonitorHandlerReceiver<T>, Object>> getListeners()
|
||||
@@ -207,9 +198,9 @@ public class NetworkMonitor<T extends IAEStack<T>> implements IMEMonitor<T>
|
||||
return this.listeners.entrySet().iterator();
|
||||
}
|
||||
|
||||
private T monitorDifference( final IAEStack original, final T leftOvers, final boolean extraction, final IActionSource src )
|
||||
private T monitorDifference( final IAEStack<T> original, final T leftOvers, final boolean extraction, final IActionSource src )
|
||||
{
|
||||
final T diff = (T) original.copy();
|
||||
final T diff = original.copy();
|
||||
|
||||
if( extraction )
|
||||
{
|
||||
@@ -283,7 +274,7 @@ public class NetworkMonitor<T extends IAEStack<T>> implements IMEMonitor<T>
|
||||
|
||||
if( !list.isEmpty() )
|
||||
{
|
||||
IAEStack fullStack = this.getStorageList().findPrecise( changedItem );
|
||||
IAEStack<T> fullStack = this.getStorageList().findPrecise( changedItem );
|
||||
|
||||
if( fullStack == null )
|
||||
{
|
||||
@@ -341,5 +332,4 @@ public class NetworkMonitor<T extends IAEStack<T>> implements IMEMonitor<T>
|
||||
this.myGridCache.getGrid().postEvent( new MENetworkStorageEvent( this, this.myChannel ) );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -59,8 +59,8 @@ import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.networking.storage.IStorageGrid;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IMEMonitorHandlerReceiver;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.api.util.WorldCoord;
|
||||
import appeng.container.ContainerNull;
|
||||
@@ -102,7 +102,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
private MECraftingInventory inventory = new MECraftingInventory();
|
||||
private IAEItemStack finalOutput;
|
||||
private boolean waiting = false;
|
||||
private IItemList<IAEItemStack> waitingFor = AEApi.instance().storage().createItemList();
|
||||
private IItemList<IAEItemStack> waitingFor = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
private long availableStorage = 0;
|
||||
private MachineSource machineSrc = null;
|
||||
private int accelerator = 0;
|
||||
@@ -223,7 +223,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canAccept( final IAEStack input )
|
||||
public boolean canAccept( final IAEItemStack input )
|
||||
{
|
||||
if( input instanceof IAEItemStack )
|
||||
{
|
||||
@@ -236,7 +236,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
return false;
|
||||
}
|
||||
|
||||
public IAEStack injectItems( final IAEStack input, final Actionable type, final IActionSource src )
|
||||
public IAEItemStack injectItems( final IAEItemStack input, final Actionable type, final IActionSource src )
|
||||
{
|
||||
if( !( input instanceof IAEItemStack ) )
|
||||
{
|
||||
@@ -303,7 +303,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
|
||||
if( this.finalOutput.equals( what ) )
|
||||
{
|
||||
IAEStack leftover = what;
|
||||
IAEItemStack leftover = what;
|
||||
|
||||
this.finalOutput.decStackSize( what.getStackSize() );
|
||||
|
||||
@@ -334,7 +334,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
|
||||
if( this.finalOutput.equals( insert ) )
|
||||
{
|
||||
IAEStack leftover = input;
|
||||
IAEItemStack leftover = input;
|
||||
|
||||
this.finalOutput.decStackSize( insert.getStackSize() );
|
||||
|
||||
@@ -546,7 +546,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
}
|
||||
|
||||
final IItemList<IAEItemStack> list;
|
||||
this.getListOfItem( list = AEApi.instance().storage().createItemList(), CraftingItemList.ALL );
|
||||
this.getListOfItem( list = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList(), CraftingItemList.ALL );
|
||||
for( final IAEItemStack is : list )
|
||||
{
|
||||
this.postChange( is, this.machineSrc );
|
||||
@@ -697,7 +697,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
this.postChange( AEItemStack.create( is ), this.machineSrc );
|
||||
this.postChange( AEItemStack.fromItemStack( is ), this.machineSrc );
|
||||
ic.setInventorySlotContents( x, is );
|
||||
found = true;
|
||||
break;
|
||||
@@ -737,7 +737,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
final ItemStack is = ic.getStackInSlot( x );
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
this.inventory.injectItems( AEItemStack.create( is ), Actionable.MODULATE, this.machineSrc );
|
||||
this.inventory.injectItems( AEItemStack.fromItemStack( is ), Actionable.MODULATE, this.machineSrc );
|
||||
}
|
||||
}
|
||||
ic = null;
|
||||
@@ -767,7 +767,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
final ItemStack output = Platform.getContainerItem( ic.getStackInSlot( x ) );
|
||||
if( !output.isEmpty() )
|
||||
{
|
||||
final IAEItemStack cItem = AEItemStack.create( output );
|
||||
final IAEItemStack cItem = AEItemStack.fromItemStack( output );
|
||||
this.postChange( cItem, this.machineSrc );
|
||||
this.waitingFor.add( cItem );
|
||||
this.postCraftingStatusChange( cItem );
|
||||
@@ -800,7 +800,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
final ItemStack is = ic.getStackInSlot( x );
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
this.inventory.injectItems( AEItemStack.create( is ), Actionable.MODULATE, this.machineSrc );
|
||||
this.inventory.injectItems( AEItemStack.fromItemStack( is ), Actionable.MODULATE, this.machineSrc );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -818,7 +818,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
}
|
||||
|
||||
final IStorageGrid sg = g.getCache( IStorageGrid.class );
|
||||
final IMEInventory<IAEItemStack> ii = sg.getItemInventory();
|
||||
final IMEInventory<IAEItemStack> ii = sg.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
|
||||
for( IAEItemStack is : this.inventory.getItemList() )
|
||||
{
|
||||
@@ -862,7 +862,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
}
|
||||
|
||||
final IStorageGrid sg = g.getCache( IStorageGrid.class );
|
||||
final IMEInventory<IAEItemStack> storage = sg.getItemInventory();
|
||||
final IMEInventory<IAEItemStack> storage = sg.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
final MECraftingInventory ci = new MECraftingInventory( storage, true, false, false );
|
||||
|
||||
try
|
||||
@@ -893,7 +893,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
this.submitLink( this.myLastLink );
|
||||
this.submitLink( whatLink );
|
||||
|
||||
final IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
|
||||
final IItemList<IAEItemStack> list = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
this.getListOfItem( list, CraftingItemList.ALL );
|
||||
for( final IAEItemStack ge : list )
|
||||
{
|
||||
@@ -1138,7 +1138,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
final NBTTagList list = new NBTTagList();
|
||||
for( final Entry<ICraftingPatternDetails, TaskProgress> e : this.tasks.entrySet() )
|
||||
{
|
||||
final NBTTagCompound item = this.writeItem( AEItemStack.create( e.getKey().getPattern() ) );
|
||||
final NBTTagCompound item = this.writeItem( AEItemStack.fromItemStack( e.getKey().getPattern() ) );
|
||||
item.setLong( "craftingProgress", e.getValue().value );
|
||||
list.appendTag( item );
|
||||
}
|
||||
@@ -1193,7 +1193,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
|
||||
public void readFromNBT( final NBTTagCompound data )
|
||||
{
|
||||
this.finalOutput = AEItemStack.loadItemStackFromNBT( (NBTTagCompound) data.getTag( "finalOutput" ) );
|
||||
this.finalOutput = AEItemStack.fromNBT( (NBTTagCompound) data.getTag( "finalOutput" ) );
|
||||
for( final IAEItemStack ais : this.readList( (NBTTagList) data.getTag( "inventory" ) ) )
|
||||
{
|
||||
this.inventory.injectItems( ais, Actionable.MODULATE, this.machineSrc );
|
||||
@@ -1213,7 +1213,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
for( int x = 0; x < list.tagCount(); x++ )
|
||||
{
|
||||
final NBTTagCompound item = list.getCompoundTagAt( x );
|
||||
final IAEItemStack pattern = AEItemStack.loadItemStackFromNBT( item );
|
||||
final IAEItemStack pattern = AEItemStack.fromNBT( item );
|
||||
if( pattern != null && pattern.getItem() instanceof ICraftingPatternItem )
|
||||
{
|
||||
final ICraftingPatternItem cpi = (ICraftingPatternItem) pattern.getItem();
|
||||
@@ -1261,7 +1261,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
|
||||
private IItemList<IAEItemStack> readList( final NBTTagList tag )
|
||||
{
|
||||
final IItemList<IAEItemStack> out = AEApi.instance().storage().createItemList();
|
||||
final IItemList<IAEItemStack> out = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
|
||||
if( tag == null )
|
||||
{
|
||||
@@ -1270,7 +1270,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
|
||||
for( int x = 0; x < tag.tagCount(); x++ )
|
||||
{
|
||||
final IAEItemStack ais = AEItemStack.loadItemStackFromNBT( tag.getCompoundTagAt( x ) );
|
||||
final IAEItemStack ais = AEItemStack.fromNBT( tag.getCompoundTagAt( x ) );
|
||||
if( ais != null )
|
||||
{
|
||||
out.add( ais );
|
||||
@@ -1306,7 +1306,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
this.lastTime = System.nanoTime();
|
||||
this.elapsedTime = 0;
|
||||
|
||||
final IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
|
||||
final IItemList<IAEItemStack> list = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
|
||||
this.getListOfItem( list, CraftingItemList.ACTIVE );
|
||||
this.getListOfItem( list, CraftingItemList.PENDING );
|
||||
|
||||
@@ -155,7 +155,8 @@ public class QuantumCluster implements ILocatable, IAECluster
|
||||
}
|
||||
}
|
||||
|
||||
sideA.connection = sideB.connection = new ConnectionWrapper( AEApi.instance().createGridConnection( sideA.getNode(), sideB.getNode() ) );
|
||||
sideA.connection = sideB.connection = new ConnectionWrapper( AEApi.instance().grid().createGridConnection( sideA.getNode(),
|
||||
sideB.getNode() ) );
|
||||
}
|
||||
catch( final FailedConnection e )
|
||||
{
|
||||
|
||||
@@ -147,7 +147,7 @@ public class AENetworkProxy implements IGridBlock
|
||||
{
|
||||
if( this.node == null && Platform.isServer() && this.isReady )
|
||||
{
|
||||
this.node = AEApi.instance().createGridNode( this );
|
||||
this.node = AEApi.instance().grid().createGridNode( this );
|
||||
this.readFromNBT( this.data );
|
||||
this.node.updateState();
|
||||
}
|
||||
|
||||
@@ -37,7 +37,8 @@ import appeng.api.storage.ICellInventory;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.ISaveProvider;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.core.AEConfig;
|
||||
@@ -197,7 +198,7 @@ public class CellInventory implements ICellInventory
|
||||
|
||||
private boolean isEmpty( final IMEInventory meInventory )
|
||||
{
|
||||
return meInventory.getAvailableItems( AEApi.instance().storage().createItemList() ).isEmpty();
|
||||
return meInventory.getAvailableItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList() ).isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -275,12 +276,12 @@ public class CellInventory implements ICellInventory
|
||||
final ItemStack toWrite = sharedItemStack.copy();
|
||||
toWrite.setCount( remainingItemCount );
|
||||
|
||||
this.cellItems.add( AEItemStack.create( toWrite ) );
|
||||
this.cellItems.add( AEItemStack.fromItemStack( toWrite ) );
|
||||
this.updateItemCount( toWrite.getCount() );
|
||||
|
||||
this.saveChanges();
|
||||
}
|
||||
return AEItemStack.create( toReturn );
|
||||
return AEItemStack.fromItemStack( toReturn );
|
||||
}
|
||||
|
||||
if( mode == Actionable.MODULATE )
|
||||
@@ -343,7 +344,7 @@ public class CellInventory implements ICellInventory
|
||||
{
|
||||
if( this.cellItems == null )
|
||||
{
|
||||
this.cellItems = AEApi.instance().storage().createItemList();
|
||||
this.cellItems = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
this.loadCellItems();
|
||||
}
|
||||
|
||||
@@ -424,7 +425,7 @@ public class CellInventory implements ICellInventory
|
||||
{
|
||||
if( this.cellItems == null )
|
||||
{
|
||||
this.cellItems = AEApi.instance().storage().createItemList();
|
||||
this.cellItems = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
}
|
||||
|
||||
this.cellItems.resetStatus(); // clears totals and stuff.
|
||||
@@ -471,7 +472,7 @@ public class CellInventory implements ICellInventory
|
||||
{
|
||||
try
|
||||
{
|
||||
this.cellItems.add( AEItemStack.create( t ) );
|
||||
this.cellItems.add( AEItemStack.fromItemStack( t ) );
|
||||
}
|
||||
catch( Throwable ex )
|
||||
{
|
||||
@@ -497,9 +498,9 @@ public class CellInventory implements ICellInventory
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getChannel()
|
||||
public IStorageChannel getChannel()
|
||||
{
|
||||
return StorageChannel.ITEMS;
|
||||
return AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -31,7 +31,7 @@ import appeng.api.implementations.items.IUpgradeModule;
|
||||
import appeng.api.storage.ICellInventory;
|
||||
import appeng.api.storage.ICellInventoryHandler;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.util.Platform;
|
||||
@@ -45,12 +45,12 @@ public class CellInventoryHandler extends MEInventoryHandler<IAEItemStack> imple
|
||||
|
||||
CellInventoryHandler( final IMEInventory c )
|
||||
{
|
||||
super( c, StorageChannel.ITEMS );
|
||||
super( c, AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
|
||||
final ICellInventory ci = this.getCellInv();
|
||||
if( ci != null )
|
||||
{
|
||||
final IItemList<IAEItemStack> priorityList = AEApi.instance().storage().createItemList();
|
||||
final IItemList<IAEItemStack> priorityList = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
|
||||
final IItemHandler upgrades = ci.getUpgradesInventory();
|
||||
final IItemHandler config = ci.getConfigInventory();
|
||||
@@ -86,7 +86,7 @@ public class CellInventoryHandler extends MEInventoryHandler<IAEItemStack> imple
|
||||
final ItemStack is = config.getStackInSlot( x );
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
priorityList.add( AEItemStack.create( is ) );
|
||||
priorityList.add( AEItemStack.fromItemStack( is ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,8 @@ import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.items.contents.CellConfig;
|
||||
@@ -36,7 +37,7 @@ import appeng.util.item.AEItemStack;
|
||||
public class CreativeCellInventory implements IMEInventoryHandler<IAEItemStack>
|
||||
{
|
||||
|
||||
private final IItemList<IAEItemStack> itemListCache = AEApi.instance().storage().createItemList();
|
||||
private final IItemList<IAEItemStack> itemListCache = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
|
||||
protected CreativeCellInventory( final ItemStack o )
|
||||
{
|
||||
@@ -45,7 +46,7 @@ public class CreativeCellInventory implements IMEInventoryHandler<IAEItemStack>
|
||||
{
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
final IAEItemStack i = AEItemStack.create( is );
|
||||
final IAEItemStack i = AEItemStack.fromItemStack( is );
|
||||
i.setStackSize( Integer.MAX_VALUE );
|
||||
this.itemListCache.add( i );
|
||||
}
|
||||
@@ -92,9 +93,9 @@ public class CreativeCellInventory implements IMEInventoryHandler<IAEItemStack>
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getChannel()
|
||||
public IStorageChannel getChannel()
|
||||
{
|
||||
return StorageChannel.ITEMS;
|
||||
return AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,7 +25,7 @@ import appeng.api.config.IncludeExclude;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.util.prioritylist.DefaultPriorityList;
|
||||
@@ -45,7 +45,7 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
|
||||
private boolean hasReadAccess;
|
||||
private boolean hasWriteAccess;
|
||||
|
||||
public MEInventoryHandler( final IMEInventory<T> i, final StorageChannel channel )
|
||||
public MEInventoryHandler( final IMEInventory<T> i, final IStorageChannel<T> channel )
|
||||
{
|
||||
if( i instanceof IMEInventoryHandler )
|
||||
{
|
||||
@@ -129,7 +129,7 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getChannel()
|
||||
public IStorageChannel getChannel()
|
||||
{
|
||||
return this.internal.getChannel();
|
||||
}
|
||||
|
||||
@@ -36,7 +36,8 @@ import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.networking.ticking.TickRateModulation;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.IMEMonitorHandlerReceiver;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
@@ -48,7 +49,7 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>, ITickingMo
|
||||
{
|
||||
|
||||
private final InventoryAdaptor adaptor;
|
||||
private final IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
|
||||
private final IItemList<IAEItemStack> list = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
private final HashMap<IMEMonitorHandlerReceiver<IAEItemStack>, Object> listeners = new HashMap<>();
|
||||
private final NavigableMap<Integer, CachedItemStack> memory;
|
||||
private IActionSource mySource;
|
||||
@@ -134,9 +135,9 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>, ITickingMo
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getChannel()
|
||||
public IStorageChannel getChannel()
|
||||
{
|
||||
return StorageChannel.ITEMS;
|
||||
return AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -180,7 +181,10 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>, ITickingMo
|
||||
final int newSize = ( newIS.isEmpty() ? 0 : newIS.getCount() );
|
||||
final int diff = newSize - ( oldIS.isEmpty() ? 0 : oldIS.getCount() );
|
||||
|
||||
final IAEItemStack stack = ( old == null || old.aeStack == null ? AEApi.instance().storage().createItemStack( newIS ) : old.aeStack.copy() );
|
||||
final IAEItemStack stack = ( old == null || old.aeStack == null ? AEApi.instance()
|
||||
.storage()
|
||||
.getStorageChannel( IItemStorageChannel.class )
|
||||
.createStack( newIS ) : old.aeStack.copy() );
|
||||
if( stack != null )
|
||||
{
|
||||
stack.setStackSize( newSize );
|
||||
@@ -352,7 +356,7 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>, ITickingMo
|
||||
else
|
||||
{
|
||||
this.itemStack = is.copy();
|
||||
this.aeStack = AEApi.instance().storage().createItemStack( is );
|
||||
this.aeStack = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( is );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import appeng.api.networking.storage.IBaseMonitor;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.IMEMonitorHandlerReceiver;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.util.Platform;
|
||||
@@ -42,7 +42,7 @@ public class MEMonitorPassThrough<T extends IAEStack<T>> extends MEPassThrough<T
|
||||
private IActionSource changeSource;
|
||||
private IMEMonitor<T> monitor;
|
||||
|
||||
public MEMonitorPassThrough( final IMEInventory<T> i, final StorageChannel channel )
|
||||
public MEMonitorPassThrough( final IMEInventory<T> i, final IStorageChannel channel )
|
||||
{
|
||||
super( i, channel );
|
||||
if( i instanceof IMEMonitor )
|
||||
|
||||
@@ -24,7 +24,7 @@ import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
|
||||
@@ -32,10 +32,10 @@ import appeng.api.storage.data.IItemList;
|
||||
public class MEPassThrough<T extends IAEStack<T>> implements IMEInventoryHandler<T>
|
||||
{
|
||||
|
||||
private final StorageChannel wrappedChannel;
|
||||
private final IStorageChannel wrappedChannel;
|
||||
private IMEInventory<T> internal;
|
||||
|
||||
public MEPassThrough( final IMEInventory<T> i, final StorageChannel channel )
|
||||
public MEPassThrough( final IMEInventory<T> i, final IStorageChannel channel )
|
||||
{
|
||||
this.wrappedChannel = channel;
|
||||
this.setInternal( i );
|
||||
@@ -70,7 +70,7 @@ public class MEPassThrough<T extends IAEStack<T>> implements IMEInventoryHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getChannel()
|
||||
public IStorageChannel getChannel()
|
||||
{
|
||||
return this.internal.getChannel();
|
||||
}
|
||||
@@ -111,7 +111,7 @@ public class MEPassThrough<T extends IAEStack<T>> implements IMEInventoryHandler
|
||||
return true;
|
||||
}
|
||||
|
||||
StorageChannel getWrappedChannel()
|
||||
IStorageChannel getWrappedChannel()
|
||||
{
|
||||
return this.wrappedChannel;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.networking.security.ISecurityGrid;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.me.cache.SecurityCache;
|
||||
@@ -50,12 +50,12 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
|
||||
private static final Comparator<Integer> PRIORITY_SORTER = ( o1, o2 ) -> ItemSorters.compareInt( o2, o1 );
|
||||
|
||||
private static int currentPass = 0;
|
||||
private final StorageChannel myChannel;
|
||||
private final IStorageChannel<T> myChannel;
|
||||
private final SecurityCache security;
|
||||
private final NavigableMap<Integer, List<IMEInventoryHandler<T>>> priorityInventory;
|
||||
private int myPass = 0;
|
||||
|
||||
public NetworkInventoryHandler( final StorageChannel chan, final SecurityCache security )
|
||||
public NetworkInventoryHandler( final IStorageChannel<T> chan, final SecurityCache security )
|
||||
{
|
||||
this.myChannel = chan;
|
||||
this.security = security;
|
||||
@@ -240,7 +240,7 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemList<T> getAvailableItems( IItemList out )
|
||||
public IItemList<T> getAvailableItems( IItemList<T> out )
|
||||
{
|
||||
if( this.diveIteration( this, Actionable.SIMULATE ) )
|
||||
{
|
||||
@@ -286,7 +286,7 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getChannel()
|
||||
public IStorageChannel<T> getChannel()
|
||||
{
|
||||
return this.myChannel;
|
||||
}
|
||||
|
||||
@@ -19,11 +19,13 @@
|
||||
package appeng.me.storage;
|
||||
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
|
||||
@@ -50,9 +52,9 @@ public class NullInventory<T extends IAEStack<T>> implements IMEInventoryHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getChannel()
|
||||
public IStorageChannel getChannel()
|
||||
{
|
||||
return StorageChannel.ITEMS;
|
||||
return AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -28,7 +28,8 @@ import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.implementations.items.IBiometricCard;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.me.GridAccessException;
|
||||
@@ -38,7 +39,7 @@ import appeng.tile.misc.TileSecurityStation;
|
||||
public class SecurityStationInventory implements IMEInventoryHandler<IAEItemStack>
|
||||
{
|
||||
|
||||
private final IItemList<IAEItemStack> storedItems = AEApi.instance().storage().createItemList();
|
||||
private final IItemList<IAEItemStack> storedItems = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
private final TileSecurityStation securityTile;
|
||||
|
||||
public SecurityStationInventory( final TileSecurityStation ts )
|
||||
@@ -120,9 +121,9 @@ public class SecurityStationInventory implements IMEInventoryHandler<IAEItemStac
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getChannel()
|
||||
public IStorageChannel getChannel()
|
||||
{
|
||||
return StorageChannel.ITEMS;
|
||||
return AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -632,7 +632,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
{
|
||||
try
|
||||
{
|
||||
AEApi.instance().createGridConnection( cn, sn );
|
||||
AEApi.instance().grid().createGridConnection( cn, sn );
|
||||
}
|
||||
catch( final FailedConnection e )
|
||||
{
|
||||
|
||||
@@ -37,6 +37,7 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
import appeng.api.networking.IGridNode;
|
||||
@@ -53,6 +54,7 @@ import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartCollisionHelper;
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.api.parts.IPartModel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
@@ -327,12 +329,13 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
||||
*/
|
||||
private IAEItemStack storeItemStack( final ItemStack item )
|
||||
{
|
||||
final IAEItemStack itemToStore = AEItemStack.create( item );
|
||||
final IAEItemStack itemToStore = AEItemStack.fromItemStack( item );
|
||||
try
|
||||
{
|
||||
final IStorageGrid storage = this.getProxy().getStorage();
|
||||
final IEnergyGrid energy = this.getProxy().getEnergy();
|
||||
final IAEItemStack overflow = Platform.poweredInsert( energy, storage.getItemInventory(), itemToStore, this.mySrc );
|
||||
final IAEItemStack overflow = Platform.poweredInsert( energy,
|
||||
storage.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ), itemToStore, this.mySrc );
|
||||
|
||||
this.isAccepting = overflow == null;
|
||||
|
||||
@@ -552,8 +555,9 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
||||
|
||||
for( final ItemStack itemStack : itemStacks )
|
||||
{
|
||||
final IAEItemStack itemToTest = AEItemStack.create( itemStack );
|
||||
final IAEItemStack overflow = storage.getItemInventory().injectItems( itemToTest, Actionable.SIMULATE, this.mySrc );
|
||||
final IAEItemStack itemToTest = AEItemStack.fromItemStack( itemStack );
|
||||
final IAEItemStack overflow = storage.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
|
||||
.injectItems( itemToTest, Actionable.SIMULATE, this.mySrc );
|
||||
if( overflow == null || itemToTest.getStackSize() > overflow.getStackSize() )
|
||||
{
|
||||
canStore = true;
|
||||
|
||||
@@ -29,6 +29,7 @@ import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
@@ -49,6 +50,7 @@ import appeng.api.parts.IPartCollisionHelper;
|
||||
import appeng.api.parts.IPartModel;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.core.AELog;
|
||||
@@ -128,7 +130,8 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
|
||||
try
|
||||
{
|
||||
final InventoryAdaptor destination = this.getHandler();
|
||||
final IMEMonitor<IAEItemStack> inv = this.getProxy().getStorage().getItemInventory();
|
||||
final IMEMonitor<IAEItemStack> inv = this.getProxy().getStorage().getInventory(
|
||||
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
final IEnergyGrid energy = this.getProxy().getEnergy();
|
||||
final ICraftingGrid cg = this.getProxy().getCrafting();
|
||||
final FuzzyMode fzMode = (FuzzyMode) this.getConfigManager().getSetting( Settings.FUZZY_MODE );
|
||||
@@ -266,9 +269,9 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
|
||||
{
|
||||
if( mode == Actionable.MODULATE )
|
||||
{
|
||||
return AEItemStack.create( d.addItems( items.createItemStack() ) );
|
||||
return AEItemStack.fromItemStack( d.addItems( items.createItemStack() ) );
|
||||
}
|
||||
return AEItemStack.create( d.simulateAdd( items.createItemStack() ) );
|
||||
return AEItemStack.fromItemStack( d.simulateAdd( items.createItemStack() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,8 @@ import appeng.api.parts.IPartModel;
|
||||
import appeng.api.storage.ICellContainer;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.api.util.AECableType;
|
||||
@@ -96,7 +97,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
return MODELS.getModels();
|
||||
}
|
||||
|
||||
private final MEInventoryHandler myHandler = new MEInventoryHandler( this, StorageChannel.ITEMS );
|
||||
private final MEInventoryHandler myHandler = new MEInventoryHandler( this, AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
private final AppEngInternalAEInventory Config = new AppEngInternalAEInventory( this, 63 );
|
||||
private int priority = 0;
|
||||
private boolean wasActive = false;
|
||||
@@ -117,7 +118,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
this.myHandler.setWhitelist( this.getInstalledUpgrades( Upgrades.INVERTER ) > 0 ? IncludeExclude.BLACKLIST : IncludeExclude.WHITELIST );
|
||||
this.myHandler.setPriority( this.priority );
|
||||
|
||||
final IItemList<IAEItemStack> priorityList = AEApi.instance().storage().createItemList();
|
||||
final IItemList<IAEItemStack> priorityList = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
|
||||
final int slotsToUse = 18 + this.getInstalledUpgrades( Upgrades.CAPACITY ) * 9;
|
||||
for( int x = 0; x < this.Config.getSlots() && x < slotsToUse; x++ )
|
||||
@@ -395,9 +396,9 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IMEInventoryHandler> getCellArray( final StorageChannel channel )
|
||||
public List<IMEInventoryHandler> getCellArray( final IStorageChannel channel )
|
||||
{
|
||||
if( this.getProxy().isActive() && channel == StorageChannel.ITEMS )
|
||||
if( this.getProxy().isActive() && channel == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
|
||||
{
|
||||
final List<IMEInventoryHandler> Handler = new ArrayList<>( 1 );
|
||||
Handler.add( this.myHandler );
|
||||
@@ -611,9 +612,9 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getChannel()
|
||||
public IStorageChannel getChannel()
|
||||
{
|
||||
return StorageChannel.ITEMS;
|
||||
return AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -43,6 +43,7 @@ import appeng.api.parts.IPartCollisionHelper;
|
||||
import appeng.api.parts.IPartModel;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.core.AppEng;
|
||||
@@ -94,7 +95,8 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
|
||||
return false;
|
||||
}
|
||||
|
||||
final IAEItemStack out = this.destination.injectItems( this.lastItemChecked = AEApi.instance().storage().createItemStack( stack ), Actionable.SIMULATE,
|
||||
final IAEItemStack out = this.destination.injectItems(
|
||||
this.lastItemChecked = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( stack ), Actionable.SIMULATE,
|
||||
this.source );
|
||||
if( out == null )
|
||||
{
|
||||
@@ -167,7 +169,8 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
|
||||
this.itemToSend = Math.min( this.itemToSend,
|
||||
(int) ( 0.01 + this.getProxy().getEnergy().extractAEPower( this.itemToSend, Actionable.SIMULATE, PowerMultiplier.CONFIG ) ) );
|
||||
|
||||
final IMEMonitor<IAEItemStack> inv = this.getProxy().getStorage().getItemInventory();
|
||||
final IMEMonitor<IAEItemStack> inv = this.getProxy().getStorage().getInventory(
|
||||
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
final IEnergyGrid energy = this.getProxy().getEnergy();
|
||||
|
||||
boolean Configured = false;
|
||||
@@ -234,7 +237,7 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
|
||||
|
||||
if( this.lastItemChecked == null || !this.lastItemChecked.isSameType( newItems ) )
|
||||
{
|
||||
this.lastItemChecked = AEApi.instance().storage().createItemStack( newItems );
|
||||
this.lastItemChecked = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( newItems );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -280,12 +283,12 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
|
||||
if( this.getInstalledUpgrades( Upgrades.FUZZY ) > 0 )
|
||||
{
|
||||
simResult = myAdaptor.simulateSimilarRemove( toSend, itemStackToImport, fzMode, this.configDestination( inv ) );
|
||||
itemAmountNotStorable = this.destination.injectItems( AEItemStack.create( simResult ), Actionable.SIMULATE, this.source );
|
||||
itemAmountNotStorable = this.destination.injectItems( AEItemStack.fromItemStack( simResult ), Actionable.SIMULATE, this.source );
|
||||
}
|
||||
else
|
||||
{
|
||||
simResult = myAdaptor.simulateRemove( toSend, itemStackToImport, this.configDestination( inv ) );
|
||||
itemAmountNotStorable = this.destination.injectItems( AEItemStack.create( simResult ), Actionable.SIMULATE, this.source );
|
||||
itemAmountNotStorable = this.destination.injectItems( AEItemStack.fromItemStack( simResult ), Actionable.SIMULATE, this.source );
|
||||
}
|
||||
|
||||
if( itemAmountNotStorable != null )
|
||||
|
||||
@@ -35,6 +35,7 @@ import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.LevelType;
|
||||
import appeng.api.config.RedstoneMode;
|
||||
@@ -62,7 +63,8 @@ import appeng.api.parts.IPartCollisionHelper;
|
||||
import appeng.api.parts.IPartModel;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.IMEMonitorHandlerReceiver;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
@@ -274,7 +276,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
||||
this.updateState();
|
||||
|
||||
// no more item stuff..
|
||||
this.getProxy().getStorage().getItemInventory().removeListener( this );
|
||||
this.getProxy().getStorage().getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ).removeListener( this );
|
||||
}
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
@@ -288,11 +290,12 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
||||
{
|
||||
if( this.getInstalledUpgrades( Upgrades.FUZZY ) > 0 || myStack == null )
|
||||
{
|
||||
this.getProxy().getStorage().getItemInventory().addListener( this, this.getProxy().getGrid() );
|
||||
this.getProxy().getStorage().getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ).addListener( this,
|
||||
this.getProxy().getGrid() );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.getProxy().getStorage().getItemInventory().removeListener( this );
|
||||
this.getProxy().getStorage().getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ).removeListener( this );
|
||||
|
||||
if( this.myWatcher != null )
|
||||
{
|
||||
@@ -300,7 +303,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
||||
}
|
||||
}
|
||||
|
||||
this.updateReportingValue( this.getProxy().getStorage().getItemInventory() );
|
||||
this.updateReportingValue( this.getProxy().getStorage().getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ) );
|
||||
}
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
@@ -354,9 +357,10 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStackChange( final IItemList o, final IAEStack fullStack, final IAEStack diffStack, final IActionSource src, final StorageChannel chan )
|
||||
public void onStackChange( final IItemList o, final IAEStack fullStack, final IAEStack diffStack, final IActionSource src, final IStorageChannel chan )
|
||||
{
|
||||
if( chan == StorageChannel.ITEMS && fullStack.equals( this.config.getAEStackInSlot( 0 ) ) && this.getInstalledUpgrades( Upgrades.FUZZY ) == 0 )
|
||||
if( chan == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) && fullStack.equals( this.config.getAEStackInSlot( 0 ) ) && this
|
||||
.getInstalledUpgrades( Upgrades.FUZZY ) == 0 )
|
||||
{
|
||||
this.lastReportedValue = fullStack.getStackSize();
|
||||
this.updateState();
|
||||
@@ -401,7 +405,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
||||
{
|
||||
try
|
||||
{
|
||||
this.updateReportingValue( this.getProxy().getStorage().getItemInventory() );
|
||||
this.updateReportingValue( this.getProxy().getStorage().getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ) );
|
||||
}
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
|
||||
@@ -29,13 +29,15 @@ import java.util.Map;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.networking.storage.IBaseMonitor;
|
||||
import appeng.api.networking.ticking.TickRateModulation;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IMEMonitorHandlerReceiver;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.core.AELog;
|
||||
@@ -92,7 +94,7 @@ class ItemHandlerAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<IAE
|
||||
this.onTick();
|
||||
}
|
||||
|
||||
return AEItemStack.create( remaining );
|
||||
return AEItemStack.fromItemStack( remaining );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -168,7 +170,7 @@ class ItemHandlerAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<IAE
|
||||
this.onTick();
|
||||
}
|
||||
|
||||
return AEItemStack.create( gathered );
|
||||
return AEItemStack.fromItemStack( gathered );
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -255,7 +257,7 @@ class ItemHandlerAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<IAE
|
||||
{
|
||||
// Completely different item
|
||||
this.cachedStacks[slot] = newIS;
|
||||
this.cachedAeStacks[slot] = AEItemStack.create( newIS );
|
||||
this.cachedAeStacks[slot] = AEItemStack.fromItemStack( newIS );
|
||||
|
||||
// If we had a stack previously in this slot, notify the newtork about its disappearance
|
||||
if( oldAeIS != null )
|
||||
@@ -330,16 +332,16 @@ class ItemHandlerAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<IAE
|
||||
|
||||
for( int i = 0; i < this.itemHandler.getSlots(); i++ )
|
||||
{
|
||||
out.addStorage( AEItemStack.create( this.itemHandler.getStackInSlot( i ) ) );
|
||||
out.addStorage( AEItemStack.fromItemStack( this.itemHandler.getStackInSlot( i ) ) );
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getChannel()
|
||||
public IStorageChannel getChannel()
|
||||
{
|
||||
return StorageChannel.ITEMS;
|
||||
return AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -51,9 +51,10 @@ import appeng.api.networking.ticking.TickingRequest;
|
||||
import appeng.api.parts.IPartCollisionHelper;
|
||||
import appeng.api.parts.IPartModel;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.IStorageMonitorable;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.core.AppEng;
|
||||
@@ -192,15 +193,9 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEItemStack> getItemInventory()
|
||||
public <T extends IAEStack<T>> IMEMonitor<T> getInventory( IStorageChannel<T> channel )
|
||||
{
|
||||
return this.duality.getItemInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEFluidStack> getFluidInventory()
|
||||
{
|
||||
return this.duality.getFluidInventory();
|
||||
return this.duality.getInventory( channel );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -62,9 +62,10 @@ import appeng.api.storage.ICellContainer;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.IMEMonitorHandlerReceiver;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.IStorageMonitorable;
|
||||
import appeng.api.storage.IStorageMonitorableAccessor;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
@@ -257,7 +258,8 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
{
|
||||
if( this.getProxy().isActive() )
|
||||
{
|
||||
this.getProxy().getStorage().postAlterationOfStoredItems( StorageChannel.ITEMS, change, this.mySrc );
|
||||
this.getProxy().getStorage().postAlterationOfStoredItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ), change,
|
||||
this.mySrc );
|
||||
}
|
||||
}
|
||||
catch( final GridAccessException e )
|
||||
@@ -340,7 +342,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
this.resetCacheLogic = 0;
|
||||
|
||||
final IMEInventory<IAEItemStack> in = this.getInternalHandler();
|
||||
IItemList<IAEItemStack> before = AEApi.instance().storage().createItemList();
|
||||
IItemList<IAEItemStack> before = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
if( in != null )
|
||||
{
|
||||
before = in.getAvailableItems( before );
|
||||
@@ -359,7 +361,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
this.monitor.onTick();
|
||||
}
|
||||
|
||||
IItemList<IAEItemStack> after = AEApi.instance().storage().createItemList();
|
||||
IItemList<IAEItemStack> after = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
if( out != null )
|
||||
{
|
||||
after = out.getAvailableItems( after );
|
||||
@@ -382,7 +384,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
IStorageMonitorable inventory = accessor.getInventory( this.mySrc );
|
||||
if( inventory != null )
|
||||
{
|
||||
return inventory.getItemInventory();
|
||||
return inventory.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
}
|
||||
|
||||
// So this could / can be a design decision. If the tile does support our custom capability,
|
||||
@@ -469,13 +471,13 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
{
|
||||
this.checkInterfaceVsStorageBus( target, this.getSide().getOpposite() );
|
||||
|
||||
this.handler = new MEInventoryHandler<>( inv, StorageChannel.ITEMS );
|
||||
this.handler = new MEInventoryHandler( inv, AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
|
||||
this.handler.setBaseAccess( (AccessRestriction) this.getConfigManager().getSetting( Settings.ACCESS ) );
|
||||
this.handler.setWhitelist( this.getInstalledUpgrades( Upgrades.INVERTER ) > 0 ? IncludeExclude.BLACKLIST : IncludeExclude.WHITELIST );
|
||||
this.handler.setPriority( this.priority );
|
||||
|
||||
final IItemList<IAEItemStack> priorityList = AEApi.instance().storage().createItemList();
|
||||
final IItemList<IAEItemStack> priorityList = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
|
||||
final int slotsToUse = 18 + this.getInstalledUpgrades( Upgrades.CAPACITY ) * 9;
|
||||
for( int x = 0; x < this.Config.getSlots() && x < slotsToUse; x++ )
|
||||
@@ -565,9 +567,9 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IMEInventoryHandler> getCellArray( final StorageChannel channel )
|
||||
public List<IMEInventoryHandler> getCellArray( final IStorageChannel channel )
|
||||
{
|
||||
if( channel == StorageChannel.ITEMS )
|
||||
if( channel == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
|
||||
{
|
||||
final IMEInventoryHandler out = this.getProxy().isActive() ? this.getInternalHandler() : null;
|
||||
if( out != null )
|
||||
|
||||
@@ -203,7 +203,7 @@ public class PartToggleBus extends PartBasicState
|
||||
{
|
||||
try
|
||||
{
|
||||
this.connection = AEApi.instance().createGridConnection( this.getProxy().getNode(), this.getOuterProxy().getNode() );
|
||||
this.connection = AEApi.instance().grid().createGridConnection( this.getProxy().getNode(), this.getOuterProxy().getNode() );
|
||||
}
|
||||
catch( final FailedConnection e )
|
||||
{
|
||||
|
||||
@@ -240,7 +240,8 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
|
||||
try
|
||||
{
|
||||
connections.getConnections().put( me.getGridNode(),
|
||||
new TunnelConnection( me, AEApi.instance().createGridConnection( this.outerProxy.getNode(), me.outerProxy.getNode() ) ) );
|
||||
new TunnelConnection( me, AEApi.instance().grid().createGridConnection( this.outerProxy.getNode(),
|
||||
me.outerProxy.getNode() ) ) );
|
||||
}
|
||||
catch( final FailedConnection e )
|
||||
{
|
||||
|
||||
@@ -35,13 +35,15 @@ import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.implementations.parts.IPartStorageMonitor;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.networking.storage.IStackWatcher;
|
||||
import appeng.api.networking.storage.IStackWatcherHost;
|
||||
import appeng.api.parts.IPartModel;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
@@ -88,7 +90,7 @@ public abstract class AbstractPartMonitor extends AbstractPartDisplay implements
|
||||
this.isLocked = data.getBoolean( "isLocked" );
|
||||
|
||||
final NBTTagCompound myItem = data.getCompoundTag( "configuredItem" );
|
||||
this.configuredItem = AEItemStack.loadItemStackFromNBT( myItem );
|
||||
this.configuredItem = AEItemStack.fromNBT( myItem );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -133,7 +135,7 @@ public abstract class AbstractPartMonitor extends AbstractPartDisplay implements
|
||||
final boolean val = data.readBoolean();
|
||||
if( val )
|
||||
{
|
||||
this.configuredItem = AEItemStack.loadItemStackFromPacket( data );
|
||||
this.configuredItem = AEItemStack.fromPacket( data );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -172,7 +174,7 @@ public abstract class AbstractPartMonitor extends AbstractPartDisplay implements
|
||||
}
|
||||
else if( !this.isLocked )
|
||||
{
|
||||
this.configuredItem = AEItemStack.create( eq );
|
||||
this.configuredItem = AEItemStack.fromItemStack( eq );
|
||||
this.configureWatchers();
|
||||
this.getHost().markForUpdate();
|
||||
}
|
||||
@@ -201,7 +203,8 @@ public abstract class AbstractPartMonitor extends AbstractPartDisplay implements
|
||||
this.myWatcher.add( this.configuredItem );
|
||||
}
|
||||
|
||||
this.updateReportingValue( this.getProxy().getStorage().getItemInventory() );
|
||||
this.updateReportingValue(
|
||||
this.getProxy().getStorage().getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ) );
|
||||
}
|
||||
}
|
||||
catch( final GridAccessException e )
|
||||
@@ -287,7 +290,7 @@ public abstract class AbstractPartMonitor extends AbstractPartDisplay implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStackChange( final IItemList o, final IAEStack fullStack, final IAEStack diffStack, final IActionSource src, final StorageChannel chan )
|
||||
public void onStackChange( final IItemList o, final IAEStack fullStack, final IAEStack diffStack, final IActionSource src, final IStorageChannel chan )
|
||||
{
|
||||
if( this.configuredItem != null )
|
||||
{
|
||||
|
||||
@@ -34,9 +34,9 @@ import appeng.api.config.SortOrder;
|
||||
import appeng.api.config.ViewItems;
|
||||
import appeng.api.implementations.tiles.IViewCellStorage;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.me.GridAccessException;
|
||||
@@ -136,25 +136,11 @@ public abstract class AbstractPartTerminal extends AbstractPartDisplay implement
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEItemStack> getItemInventory()
|
||||
public <T extends IAEStack<T>> IMEMonitor<T> getInventory( IStorageChannel<T> channel )
|
||||
{
|
||||
try
|
||||
{
|
||||
return this.getProxy().getStorage().getItemInventory();
|
||||
}
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
// err nope?
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEFluidStack> getFluidInventory()
|
||||
{
|
||||
try
|
||||
{
|
||||
return this.getProxy().getStorage().getFluidInventory();
|
||||
return this.getProxy().getStorage().getInventory( channel );
|
||||
}
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
|
||||
@@ -29,9 +29,11 @@ import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.networking.energy.IEnergySource;
|
||||
import appeng.api.parts.IPartModel;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.helpers.Reflected;
|
||||
@@ -106,8 +108,9 @@ public class PartConversionMonitor extends AbstractPartMonitor
|
||||
}
|
||||
|
||||
final IEnergySource energy = this.getProxy().getEnergy();
|
||||
final IMEMonitor<IAEItemStack> cell = this.getProxy().getStorage().getItemInventory();
|
||||
final IAEItemStack input = AEItemStack.create( item );
|
||||
final IMEMonitor<IAEItemStack> cell = this.getProxy().getStorage().getInventory(
|
||||
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
final IAEItemStack input = AEItemStack.fromItemStack( item );
|
||||
|
||||
if( ModeB )
|
||||
{
|
||||
@@ -152,7 +155,8 @@ public class PartConversionMonitor extends AbstractPartMonitor
|
||||
}
|
||||
|
||||
final IEnergySource energy = this.getProxy().getEnergy();
|
||||
final IMEMonitor<IAEItemStack> cell = this.getProxy().getStorage().getItemInventory();
|
||||
final IMEMonitor<IAEItemStack> cell = this.getProxy().getStorage().getInventory(
|
||||
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
|
||||
final ItemStack is = input.createItemStack();
|
||||
input.setStackSize( is.getMaxStackSize() );
|
||||
|
||||
@@ -41,7 +41,7 @@ import appeng.api.definitions.IItemDefinition;
|
||||
import appeng.api.definitions.IItems;
|
||||
import appeng.api.definitions.IMaterials;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
|
||||
@@ -105,10 +105,12 @@ public final class DisassembleRecipe extends net.minecraftforge.registries.IForg
|
||||
{
|
||||
ItemStack storageCellStack = maybeCellOutput.get();
|
||||
// make sure the storage cell stackInSlot empty...
|
||||
final IMEInventory<IAEItemStack> cellInv = AEApi.instance().registries().cell().getCellInventory( stackInSlot, null, StorageChannel.ITEMS );
|
||||
final IMEInventory<IAEItemStack> cellInv = AEApi.instance().registries().cell().getCellInventory( stackInSlot, null,
|
||||
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
if( cellInv != null )
|
||||
{
|
||||
final IItemList<IAEItemStack> list = cellInv.getAvailableItems( StorageChannel.ITEMS.createList() );
|
||||
final IItemList<IAEItemStack> list = cellInv
|
||||
.getAvailableItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList() );
|
||||
if( !list.isEmpty() )
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
|
||||
@@ -58,7 +58,7 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora
|
||||
|
||||
if( hasItem )
|
||||
{
|
||||
this.dspPlay = AEItemStack.loadItemStackFromPacket( data );
|
||||
this.dspPlay = AEItemStack.fromPacket( data );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -40,6 +40,7 @@ import appeng.api.networking.events.MENetworkChannelsChanged;
|
||||
import appeng.api.networking.events.MENetworkEventSubscribe;
|
||||
import appeng.api.networking.events.MENetworkPowerStatusChange;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.WorldCoord;
|
||||
@@ -314,7 +315,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
|
||||
throw new IllegalStateException( this.cluster + " does not contain any kind of blocks, which were destroyed." );
|
||||
}
|
||||
|
||||
for( IAEItemStack ais : inv.getAvailableItems( AEApi.instance().storage().createItemList() ) )
|
||||
for( IAEItemStack ais : inv.getAvailableItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList() ) )
|
||||
{
|
||||
ais = ais.copy();
|
||||
ais.setStackSize( ais.getDefinition().getMaxStackSize() );
|
||||
|
||||
@@ -479,7 +479,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
try
|
||||
{
|
||||
final TargetPoint where = new TargetPoint( this.world.provider.getDimension(), this.pos.getX(), this.pos.getY(), this.pos.getZ(), 32 );
|
||||
final IAEItemStack item = AEItemStack.create( output );
|
||||
final IAEItemStack item = AEItemStack.fromItemStack( output );
|
||||
NetworkHandler.instance().sendToAllAround( new PacketAssemblerAnimation( this.pos, (byte) speed, item ), where );
|
||||
}
|
||||
catch( final IOException e )
|
||||
|
||||
@@ -28,6 +28,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.core.AELog;
|
||||
import appeng.util.Platform;
|
||||
@@ -111,7 +112,7 @@ public class AppEngInternalAEInventory implements IInternalItemHandler, Iterable
|
||||
|
||||
if( c != null )
|
||||
{
|
||||
this.inv[x] = AEItemStack.loadItemStackFromNBT( c );
|
||||
this.inv[x] = AEItemStack.fromNBT( c );
|
||||
}
|
||||
}
|
||||
catch( final Exception e )
|
||||
@@ -175,7 +176,8 @@ public class AppEngInternalAEInventory implements IInternalItemHandler, Iterable
|
||||
{
|
||||
if( existing.isEmpty() )
|
||||
{
|
||||
this.inv[slot] = AEApi.instance().storage().createItemStack( reachedLimit ? ItemHandlerHelper.copyStackWithSize( stack, limit ) : stack );
|
||||
this.inv[slot] = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack(
|
||||
reachedLimit ? ItemHandlerHelper.copyStackWithSize( stack, limit ) : stack );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -220,7 +222,7 @@ public class AppEngInternalAEInventory implements IInternalItemHandler, Iterable
|
||||
public void setStackInSlot( final int slot, final ItemStack newItemStack )
|
||||
{
|
||||
ItemStack oldStack = this.getStackInSlot( slot ).copy();
|
||||
this.inv[slot] = AEApi.instance().storage().createItemStack( newItemStack );
|
||||
this.inv[slot] = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( newItemStack );
|
||||
|
||||
if( this.te != null && Platform.isServer() )
|
||||
{
|
||||
|
||||
@@ -19,12 +19,14 @@
|
||||
package appeng.tile.misc;
|
||||
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.IMEMonitorHandlerReceiver;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.channels.IFluidStorageChannel;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.util.item.FluidList;
|
||||
@@ -74,9 +76,9 @@ class CondenserFluidInventory implements IMEMonitor<IAEFluidStack>
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getChannel()
|
||||
public IStorageChannel<IAEFluidStack> getChannel()
|
||||
{
|
||||
return StorageChannel.FLUIDS;
|
||||
return AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,12 +19,14 @@
|
||||
package appeng.tile.misc;
|
||||
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.IMEMonitorHandlerReceiver;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.util.item.ItemList;
|
||||
@@ -70,9 +72,9 @@ class CondenserItemInventory implements IMEMonitor<IAEItemStack>
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getChannel()
|
||||
public IStorageChannel getChannel()
|
||||
{
|
||||
return StorageChannel.ITEMS;
|
||||
return AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -85,7 +85,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IGrid
|
||||
final boolean c = super.readFromStream( data );
|
||||
try
|
||||
{
|
||||
final IAEItemStack item = AEItemStack.loadItemStackFromPacket( data );
|
||||
final IAEItemStack item = AEItemStack.fromPacket( data );
|
||||
final ItemStack is = item.createItemStack();
|
||||
this.inv.setStackInSlot( 0, is );
|
||||
}
|
||||
@@ -100,7 +100,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IGrid
|
||||
protected void writeToStream( final ByteBuf data ) throws IOException
|
||||
{
|
||||
super.writeToStream( data );
|
||||
final AEItemStack is = AEItemStack.create( this.inv.getStackInSlot( 0 ) );
|
||||
final AEItemStack is = AEItemStack.fromItemStack( this.inv.getStackInSlot( 0 ) );
|
||||
if( is != null )
|
||||
{
|
||||
is.writeToPacket( data );
|
||||
|
||||
@@ -40,10 +40,12 @@ import appeng.api.definitions.IMaterials;
|
||||
import appeng.api.implementations.items.IStorageComponent;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.IStorageMonitorable;
|
||||
import appeng.api.storage.IStorageMonitorableAccessor;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.channels.IFluidStorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.api.util.IConfigurableObject;
|
||||
import appeng.capabilities.Capabilities;
|
||||
@@ -342,15 +344,17 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost,
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEItemStack> getItemInventory()
|
||||
public <T extends IAEStack<T>> IMEMonitor<T> getInventory( IStorageChannel<T> channel )
|
||||
{
|
||||
return this.itemInventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEFluidStack> getFluidInventory()
|
||||
{
|
||||
return this.fluidInventory;
|
||||
if( channel == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
|
||||
{
|
||||
return (IMEMonitor<T>) this.itemInventory;
|
||||
}
|
||||
else if( channel == AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) )
|
||||
{
|
||||
return (IMEMonitor<T>) this.fluidInventory;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
{
|
||||
if( ( slot & ( 1 << num ) ) > 0 )
|
||||
{
|
||||
this.inv.setStackInSlot( num, AEItemStack.loadItemStackFromPacket( data ).createItemStack() );
|
||||
this.inv.setStackInSlot( num, AEItemStack.fromPacket( data ).createItemStack() );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -195,7 +195,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
{
|
||||
if( ( slot & ( 1 << num ) ) > 0 )
|
||||
{
|
||||
final AEItemStack st = AEItemStack.create( this.inv.getStackInSlot( num ) );
|
||||
final AEItemStack st = AEItemStack.fromItemStack( this.inv.getStackInSlot( num ) );
|
||||
st.writeToPacket( data );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,10 +57,12 @@ import appeng.api.networking.events.MENetworkSecurityChange;
|
||||
import appeng.api.networking.security.ISecurityProvider;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.MEMonitorHandler;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
@@ -199,7 +201,7 @@ public class TileSecurityStation extends AENetworkTile implements ITerminalHost,
|
||||
final NBTBase obj = storedItems.getTag( (String) key );
|
||||
if( obj instanceof NBTTagCompound )
|
||||
{
|
||||
this.inventory.getStoredItems().add( AEItemStack.create( new ItemStack( (NBTTagCompound) obj ) ) );
|
||||
this.inventory.getStoredItems().add( AEItemStack.fromItemStack( new ItemStack( (NBTTagCompound) obj ) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -274,15 +276,14 @@ public class TileSecurityStation extends AENetworkTile implements ITerminalHost,
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEItemStack> getItemInventory()
|
||||
{
|
||||
return this.securityMonitor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEFluidStack> getFluidInventory()
|
||||
public <T extends IAEStack<T>> IMEMonitor<T> getInventory( IStorageChannel<T> channel )
|
||||
{
|
||||
if( channel == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
|
||||
{
|
||||
return (IMEMonitor<T>) this.securityMonitor;
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -74,11 +74,13 @@ import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.IMEMonitorHandlerReceiver;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.IStorageMonitorable;
|
||||
import appeng.api.storage.IStorageMonitorableAccessor;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.MEMonitorHandler;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.channels.IFluidStorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
@@ -209,7 +211,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
|
||||
return 1;
|
||||
}
|
||||
|
||||
private IMEInventoryHandler getHandler( final StorageChannel channel ) throws ChestNoHandler
|
||||
private IMEInventoryHandler getHandler( final IStorageChannel channel ) throws ChestNoHandler
|
||||
{
|
||||
if( !this.isCached )
|
||||
{
|
||||
@@ -228,8 +230,10 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
|
||||
{
|
||||
double power = 1.0;
|
||||
|
||||
final IMEInventoryHandler<IAEItemStack> itemCell = this.cellHandler.getCellInventory( is, this, StorageChannel.ITEMS );
|
||||
final IMEInventoryHandler<IAEFluidStack> fluidCell = this.cellHandler.getCellInventory( is, this, StorageChannel.FLUIDS );
|
||||
final IMEInventoryHandler<IAEItemStack> itemCell = this.cellHandler.getCellInventory( is, this,
|
||||
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
final IMEInventoryHandler<IAEFluidStack> fluidCell = this.cellHandler.getCellInventory( is, this,
|
||||
AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) );
|
||||
|
||||
if( itemCell != null )
|
||||
{
|
||||
@@ -259,37 +263,38 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
|
||||
}
|
||||
}
|
||||
|
||||
switch( channel )
|
||||
if( channel == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
|
||||
{
|
||||
case FLUIDS:
|
||||
if( this.fluidCell == null )
|
||||
{
|
||||
throw NO_HANDLER;
|
||||
}
|
||||
return this.fluidCell;
|
||||
case ITEMS:
|
||||
if( this.itemCell == null )
|
||||
{
|
||||
throw NO_HANDLER;
|
||||
}
|
||||
return this.itemCell;
|
||||
default:
|
||||
if( this.itemCell == null )
|
||||
{
|
||||
throw NO_HANDLER;
|
||||
}
|
||||
return this.itemCell;
|
||||
}
|
||||
else if( channel == AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) && this.fluidCell != null )
|
||||
{
|
||||
if( this.fluidCell == null )
|
||||
{
|
||||
throw NO_HANDLER;
|
||||
}
|
||||
return this.fluidCell;
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private <StackType extends IAEStack> MEMonitorHandler<StackType> wrap( final IMEInventoryHandler h )
|
||||
private <T extends IAEStack<T>> MEMonitorHandler<T> wrap( final IMEInventoryHandler<T> h )
|
||||
{
|
||||
if( h == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
final MEInventoryHandler ih = new MEInventoryHandler( h, h.getChannel() );
|
||||
final MEInventoryHandler<T> ih = new MEInventoryHandler( h, h.getChannel() );
|
||||
ih.setPriority( this.priority );
|
||||
|
||||
final MEMonitorHandler<StackType> g = new ChestMonitorHandler<StackType>( ih );
|
||||
final MEMonitorHandler<T> g = new ChestMonitorHandler<T>( ih );
|
||||
g.addListener( new ChestNetNotifier( h.getChannel() ), g );
|
||||
|
||||
return g;
|
||||
@@ -310,7 +315,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
|
||||
{
|
||||
try
|
||||
{
|
||||
final IMEInventoryHandler handler = this.getHandler( StorageChannel.ITEMS );
|
||||
final IMEInventoryHandler handler = this.getHandler( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
if( handler instanceof ChestMonitorHandler )
|
||||
{
|
||||
return ch.getStatusForCell( cell, ( (ChestMonitorHandler) handler ).getInternalHandler() );
|
||||
@@ -322,7 +327,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
|
||||
|
||||
try
|
||||
{
|
||||
final IMEInventoryHandler handler = this.getHandler( StorageChannel.FLUIDS );
|
||||
final IMEInventoryHandler handler = this.getHandler( AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) );
|
||||
if( handler instanceof ChestMonitorHandler )
|
||||
{
|
||||
return ch.getStatusForCell( cell, ( (ChestMonitorHandler) handler ).getInternalHandler() );
|
||||
@@ -538,15 +543,17 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor getItemInventory()
|
||||
public <T extends IAEStack<T>> IMEMonitor<T> getInventory( IStorageChannel<T> channel )
|
||||
{
|
||||
return this.itemCell;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor getFluidInventory()
|
||||
{
|
||||
return this.fluidCell;
|
||||
if( channel == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
|
||||
{
|
||||
return this.itemCell;
|
||||
}
|
||||
else if( channel == AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) )
|
||||
{
|
||||
return this.fluidCell;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -608,10 +615,10 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
|
||||
{
|
||||
if( !ItemHandlerUtil.isEmpty( this.inputInventory ) )
|
||||
{
|
||||
final IMEInventory<IAEItemStack> cell = this.getHandler( StorageChannel.ITEMS );
|
||||
final IMEInventory<IAEItemStack> cell = this.getHandler( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
|
||||
final IAEItemStack returns = Platform.poweredInsert( this, cell,
|
||||
AEApi.instance().storage().createItemStack( this.inputInventory.getStackInSlot( 0 ) ),
|
||||
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( this.inputInventory.getStackInSlot( 0 ) ),
|
||||
this.mySrc );
|
||||
|
||||
if( returns == null )
|
||||
@@ -630,7 +637,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IMEInventoryHandler> getCellArray( final StorageChannel channel )
|
||||
public List<IMEInventoryHandler> getCellArray( final IStorageChannel channel )
|
||||
{
|
||||
if( this.getProxy().isActive() )
|
||||
{
|
||||
@@ -711,10 +718,10 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
|
||||
{
|
||||
try
|
||||
{
|
||||
final IMEInventoryHandler invHandler = this.getHandler( StorageChannel.ITEMS );
|
||||
final IMEInventoryHandler invHandler = this.getHandler( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
if( ch != null && invHandler != null )
|
||||
{
|
||||
ch.openChestGui( p, this, ch, invHandler, cell, StorageChannel.ITEMS );
|
||||
ch.openChestGui( p, this, ch, invHandler, cell, AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -725,10 +732,10 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
|
||||
|
||||
try
|
||||
{
|
||||
final IMEInventoryHandler invHandler = this.getHandler( StorageChannel.FLUIDS );
|
||||
final IMEInventoryHandler invHandler = this.getHandler( AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) );
|
||||
if( ch != null && invHandler != null )
|
||||
{
|
||||
ch.openChestGui( p, this, ch, invHandler, cell, StorageChannel.FLUIDS );
|
||||
ch.openChestGui( p, this, ch, invHandler, cell, AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -774,9 +781,9 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
|
||||
private class ChestNetNotifier<T extends IAEStack<T>> implements IMEMonitorHandlerReceiver<T>
|
||||
{
|
||||
|
||||
private final StorageChannel chan;
|
||||
private final IStorageChannel chan;
|
||||
|
||||
public ChestNetNotifier( final StorageChannel chan )
|
||||
public ChestNetNotifier( final IStorageChannel chan )
|
||||
{
|
||||
this.chan = chan;
|
||||
}
|
||||
@@ -784,11 +791,11 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
|
||||
@Override
|
||||
public boolean isValid( final Object verificationToken )
|
||||
{
|
||||
if( this.chan == StorageChannel.ITEMS )
|
||||
if( this.chan == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
|
||||
{
|
||||
return verificationToken == TileChest.this.itemCell;
|
||||
}
|
||||
if( this.chan == StorageChannel.FLUIDS )
|
||||
if( this.chan == AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) )
|
||||
{
|
||||
return verificationToken == TileChest.this.fluidCell;
|
||||
}
|
||||
@@ -823,7 +830,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
|
||||
}
|
||||
}
|
||||
|
||||
private class ChestMonitorHandler<T extends IAEStack> extends MEMonitorHandler<T>
|
||||
private class ChestMonitorHandler<T extends IAEStack<T>> extends MEMonitorHandler<T>
|
||||
{
|
||||
|
||||
public ChestMonitorHandler( final IMEInventoryHandler<T> t )
|
||||
@@ -951,11 +958,11 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
|
||||
{
|
||||
try
|
||||
{
|
||||
final IMEInventoryHandler h = TileChest.this.getHandler( StorageChannel.FLUIDS );
|
||||
final IMEInventoryHandler h = TileChest.this.getHandler( AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) );
|
||||
|
||||
TileChest.this.extractAEPower( req, Actionable.MODULATE, PowerMultiplier.CONFIG );
|
||||
|
||||
final IAEStack results = h.injectItems( AEFluidStack.create( resource ), doFill ? Actionable.MODULATE : Actionable.SIMULATE,
|
||||
final IAEStack results = h.injectItems( AEFluidStack.fromFluidStack( resource ), doFill ? Actionable.MODULATE : Actionable.SIMULATE,
|
||||
TileChest.this.mySrc );
|
||||
|
||||
if( results == null )
|
||||
@@ -989,9 +996,9 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
|
||||
{
|
||||
try
|
||||
{
|
||||
final IMEInventoryHandler h = TileChest.this.getHandler( StorageChannel.FLUIDS );
|
||||
final IMEInventoryHandler h = TileChest.this.getHandler( AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) );
|
||||
|
||||
if( h.getChannel() == StorageChannel.FLUIDS )
|
||||
if( h.getChannel() == AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) )
|
||||
{
|
||||
return new IFluidTankProperties[] { new FluidTankProperties( null, 1 ) }; // eh?
|
||||
}
|
||||
@@ -1019,10 +1026,12 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
|
||||
{
|
||||
try
|
||||
{
|
||||
final IMEInventory<IAEItemStack> cell = TileChest.this.getHandler( StorageChannel.ITEMS );
|
||||
final IMEInventory<IAEItemStack> cell = TileChest.this
|
||||
.getHandler( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
if( cell != null )
|
||||
{
|
||||
final IAEItemStack returns = cell.injectItems( AEApi.instance().storage().createItemStack( stack ), Actionable.SIMULATE,
|
||||
final IAEItemStack returns = cell.injectItems(
|
||||
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( stack ), Actionable.SIMULATE,
|
||||
TileChest.this.mySrc );
|
||||
return returns == null || returns.getStackSize() != stack.getCount();
|
||||
}
|
||||
@@ -1048,8 +1057,11 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
|
||||
public boolean allowInsert( IItemHandler inv, int slot, ItemStack stack )
|
||||
{
|
||||
return AEApi.instance().registries().cell().getCellInventory( stack, TileChest.this,
|
||||
StorageChannel.ITEMS ) != null || AEApi.instance().registries().cell().getCellInventory( stack, TileChest.this,
|
||||
StorageChannel.FLUIDS ) != null;
|
||||
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ) != null || AEApi.instance()
|
||||
.registries()
|
||||
.cell()
|
||||
.getCellInventory( stack, TileChest.this,
|
||||
AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) ) != null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -42,7 +42,9 @@ import appeng.api.networking.storage.IStorageGrid;
|
||||
import appeng.api.storage.ICellHandler;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.channels.IFluidStorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
@@ -149,7 +151,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( handler.getChannel() == StorageChannel.ITEMS )
|
||||
if( handler.getChannel() == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
|
||||
{
|
||||
if( ch != null )
|
||||
{
|
||||
@@ -157,7 +159,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
|
||||
}
|
||||
}
|
||||
|
||||
if( handler.getChannel() == StorageChannel.FLUIDS )
|
||||
if( handler.getChannel() == AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) )
|
||||
{
|
||||
if( ch != null )
|
||||
{
|
||||
@@ -310,7 +312,8 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
|
||||
|
||||
if( this.handlersBySlot[x] != null )
|
||||
{
|
||||
IMEInventoryHandler cell = this.handlersBySlot[x].getCellInventory( is, this, StorageChannel.ITEMS );
|
||||
IMEInventoryHandler cell = this.handlersBySlot[x].getCellInventory( is, this,
|
||||
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
|
||||
if( cell != null )
|
||||
{
|
||||
@@ -323,7 +326,8 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
|
||||
}
|
||||
else
|
||||
{
|
||||
cell = this.handlersBySlot[x].getCellInventory( is, this, StorageChannel.FLUIDS );
|
||||
cell = this.handlersBySlot[x].getCellInventory( is, this,
|
||||
AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) );
|
||||
|
||||
if( cell != null )
|
||||
{
|
||||
@@ -353,12 +357,12 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IMEInventoryHandler> getCellArray( final StorageChannel channel )
|
||||
public List<IMEInventoryHandler> getCellArray( final IStorageChannel channel )
|
||||
{
|
||||
if( this.getProxy().isActive() )
|
||||
{
|
||||
this.updateState();
|
||||
return (List) ( channel == StorageChannel.ITEMS ? this.items : this.fluids );
|
||||
return (List) ( channel == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ? this.items : this.fluids );
|
||||
}
|
||||
return new ArrayList();
|
||||
}
|
||||
|
||||
@@ -47,7 +47,9 @@ import appeng.api.networking.ticking.TickRateModulation;
|
||||
import appeng.api.networking.ticking.TickingRequest;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.channels.IFluidStorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
@@ -292,8 +294,10 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
|
||||
|
||||
try
|
||||
{
|
||||
final IMEInventory<IAEItemStack> itemNet = this.getProxy().getStorage().getItemInventory();
|
||||
final IMEInventory<IAEFluidStack> fluidNet = this.getProxy().getStorage().getFluidInventory();
|
||||
final IMEInventory<IAEItemStack> itemNet = this.getProxy().getStorage().getInventory(
|
||||
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
final IMEInventory<IAEFluidStack> fluidNet = this.getProxy().getStorage().getInventory(
|
||||
AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) );
|
||||
final IEnergySource energy = this.getProxy().getEnergy();
|
||||
for( int x = 0; x < 6; x++ )
|
||||
{
|
||||
@@ -302,29 +306,34 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
|
||||
{
|
||||
if( ItemsToMove > 0 )
|
||||
{
|
||||
final IMEInventory<IAEItemStack> itemInv = this.getInv( is, StorageChannel.ITEMS );
|
||||
final IMEInventory<IAEFluidStack> fluidInv = this.getInv( is, StorageChannel.FLUIDS );
|
||||
final IMEInventory<IAEItemStack> itemInv = this.getInv( is, AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
final IMEInventory<IAEFluidStack> fluidInv = this.getInv( is,
|
||||
AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) );
|
||||
|
||||
if( this.manager.getSetting( Settings.OPERATION_MODE ) == OperationMode.EMPTY )
|
||||
{
|
||||
if( itemInv != null )
|
||||
{
|
||||
ItemsToMove = this.transferContents( energy, itemInv, itemNet, ItemsToMove, StorageChannel.ITEMS );
|
||||
ItemsToMove = this.transferContents( energy, itemInv, itemNet, ItemsToMove,
|
||||
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
}
|
||||
if( fluidInv != null )
|
||||
{
|
||||
ItemsToMove = this.transferContents( energy, fluidInv, fluidNet, ItemsToMove, StorageChannel.FLUIDS );
|
||||
ItemsToMove = this.transferContents( energy, fluidInv, fluidNet, ItemsToMove,
|
||||
AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( itemInv != null )
|
||||
{
|
||||
ItemsToMove = this.transferContents( energy, itemNet, itemInv, ItemsToMove, StorageChannel.ITEMS );
|
||||
ItemsToMove = this.transferContents( energy, itemNet, itemInv, ItemsToMove,
|
||||
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
}
|
||||
if( fluidInv != null )
|
||||
{
|
||||
ItemsToMove = this.transferContents( energy, fluidNet, fluidInv, ItemsToMove, StorageChannel.FLUIDS );
|
||||
ItemsToMove = this.transferContents( energy, fluidNet, fluidInv, ItemsToMove,
|
||||
AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -357,16 +366,18 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
|
||||
return this.upgrades.getInstalledUpgrades( u );
|
||||
}
|
||||
|
||||
private IMEInventory getInv( final ItemStack is, final StorageChannel chan )
|
||||
private IMEInventory getInv( final ItemStack is, final IStorageChannel chan )
|
||||
{
|
||||
if( this.currentCell != is )
|
||||
{
|
||||
this.currentCell = is;
|
||||
this.cachedFluid = AEApi.instance().registries().cell().getCellInventory( is, null, StorageChannel.FLUIDS );
|
||||
this.cachedItem = AEApi.instance().registries().cell().getCellInventory( is, null, StorageChannel.ITEMS );
|
||||
this.cachedFluid = AEApi.instance().registries().cell().getCellInventory( is, null,
|
||||
AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) );
|
||||
this.cachedItem = AEApi.instance().registries().cell().getCellInventory( is, null,
|
||||
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
}
|
||||
|
||||
if( StorageChannel.ITEMS == chan )
|
||||
if( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) == chan )
|
||||
{
|
||||
return this.cachedItem;
|
||||
}
|
||||
@@ -374,7 +385,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
|
||||
return this.cachedFluid;
|
||||
}
|
||||
|
||||
private long transferContents( final IEnergySource energy, final IMEInventory src, final IMEInventory destination, long itemsToMove, final StorageChannel chan )
|
||||
private long transferContents( final IEnergySource energy, final IMEInventory src, final IMEInventory destination, long itemsToMove, final IStorageChannel chan )
|
||||
{
|
||||
final IItemList<? extends IAEStack> myList;
|
||||
if( src instanceof IMEMonitor )
|
||||
|
||||
@@ -99,7 +99,8 @@ import appeng.api.networking.storage.IStorageGrid;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.IMEMonitorHandlerReceiver;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.channels.IFluidStorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
@@ -1135,9 +1136,9 @@ public class Platform
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static <StackType extends IAEStack> StackType poweredExtraction( final IEnergySource energy, final IMEInventory<StackType> cell, final StackType request, final IActionSource src )
|
||||
public static <T extends IAEStack<T>> T poweredExtraction( final IEnergySource energy, final IMEInventory<T> cell, final T request, final IActionSource src )
|
||||
{
|
||||
final StackType possible = cell.extractItems( (StackType) request.copy(), Actionable.SIMULATE, src );
|
||||
final T possible = cell.extractItems( (T) request.copy(), Actionable.SIMULATE, src );
|
||||
|
||||
long retrieved = 0;
|
||||
if( possible != null )
|
||||
@@ -1154,7 +1155,7 @@ public class Platform
|
||||
energy.extractAEPower( retrieved, Actionable.MODULATE, PowerMultiplier.CONFIG );
|
||||
|
||||
possible.setStackSize( itemToExtract );
|
||||
final StackType ret = cell.extractItems( possible, Actionable.MODULATE, src );
|
||||
final T ret = cell.extractItems( possible, Actionable.MODULATE, src );
|
||||
|
||||
if( ret != null )
|
||||
{
|
||||
@@ -1167,9 +1168,9 @@ public class Platform
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <StackType extends IAEStack> StackType poweredInsert( final IEnergySource energy, final IMEInventory<StackType> cell, final StackType input, final IActionSource src )
|
||||
public static <T extends IAEStack<T>> T poweredInsert( final IEnergySource energy, final IMEInventory<T> cell, final T input, final IActionSource src )
|
||||
{
|
||||
final StackType possible = cell.injectItems( (StackType) input.copy(), Actionable.SIMULATE, src );
|
||||
final T possible = cell.injectItems( (T) input.copy(), Actionable.SIMULATE, src );
|
||||
|
||||
long stored = input.getStackSize();
|
||||
if( possible != null )
|
||||
@@ -1188,7 +1189,7 @@ public class Platform
|
||||
if( itemToAdd < input.getStackSize() )
|
||||
{
|
||||
final long original = input.getStackSize();
|
||||
final StackType split = (StackType) input.copy();
|
||||
final T split = (T) input.copy();
|
||||
split.decStackSize( itemToAdd );
|
||||
input.setStackSize( itemToAdd );
|
||||
split.add( cell.injectItems( input, Actionable.MODULATE, src ) );
|
||||
@@ -1202,7 +1203,7 @@ public class Platform
|
||||
return split;
|
||||
}
|
||||
|
||||
final StackType ret = cell.injectItems( input, Actionable.MODULATE, src );
|
||||
final T ret = cell.injectItems( input, Actionable.MODULATE, src );
|
||||
|
||||
src.player().ifPresent( player ->
|
||||
{
|
||||
@@ -1218,12 +1219,15 @@ public class Platform
|
||||
|
||||
public static void postChanges( final IStorageGrid gs, final ItemStack removed, final ItemStack added, final IActionSource src )
|
||||
{
|
||||
final IItemList<IAEItemStack> itemChanges = AEApi.instance().storage().createItemList();
|
||||
final IItemList<IAEFluidStack> fluidChanges = AEApi.instance().storage().createFluidList();
|
||||
|
||||
final IItemStorageChannel itemChannel = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class );
|
||||
final IFluidStorageChannel fluidChannel = AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class );
|
||||
final IItemList<IAEItemStack> itemChanges = itemChannel.createList();
|
||||
final IItemList<IAEFluidStack> fluidChanges = fluidChannel.createList();
|
||||
|
||||
if( !removed.isEmpty() )
|
||||
{
|
||||
final IMEInventory<IAEItemStack> myItems = AEApi.instance().registries().cell().getCellInventory( removed, null, StorageChannel.ITEMS );
|
||||
final IMEInventory<IAEItemStack> myItems = AEApi.instance().registries().cell().getCellInventory( removed, null, itemChannel );
|
||||
|
||||
if( myItems != null )
|
||||
{
|
||||
@@ -1233,7 +1237,7 @@ public class Platform
|
||||
}
|
||||
}
|
||||
|
||||
final IMEInventory<IAEFluidStack> myFluids = AEApi.instance().registries().cell().getCellInventory( removed, null, StorageChannel.FLUIDS );
|
||||
final IMEInventory<IAEFluidStack> myFluids = AEApi.instance().registries().cell().getCellInventory( removed, null, fluidChannel );
|
||||
|
||||
if( myFluids != null )
|
||||
{
|
||||
@@ -1246,14 +1250,14 @@ public class Platform
|
||||
|
||||
if( !added.isEmpty() )
|
||||
{
|
||||
final IMEInventory<IAEItemStack> myItems = AEApi.instance().registries().cell().getCellInventory( added, null, StorageChannel.ITEMS );
|
||||
final IMEInventory<IAEItemStack> myItems = AEApi.instance().registries().cell().getCellInventory( added, null, itemChannel );
|
||||
|
||||
if( myItems != null )
|
||||
{
|
||||
myItems.getAvailableItems( itemChanges );
|
||||
}
|
||||
|
||||
final IMEInventory<IAEFluidStack> myFluids = AEApi.instance().registries().cell().getCellInventory( added, null, StorageChannel.FLUIDS );
|
||||
final IMEInventory<IAEFluidStack> myFluids = AEApi.instance().registries().cell().getCellInventory( added, null, fluidChannel );
|
||||
|
||||
if( myFluids != null )
|
||||
{
|
||||
@@ -1261,7 +1265,7 @@ public class Platform
|
||||
}
|
||||
}
|
||||
|
||||
gs.postAlterationOfStoredItems( StorageChannel.ITEMS, itemChanges, src );
|
||||
gs.postAlterationOfStoredItems( itemChannel, itemChanges, src );
|
||||
}
|
||||
|
||||
public static <T extends IAEStack<T>> void postListChanges( final IItemList<T> before, final IItemList<T> after, final IMEMonitorHandlerReceiver<T> meMonitorPassthrough, final IActionSource source )
|
||||
@@ -1444,7 +1448,7 @@ public class Platform
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
final AEItemStack ae_req = AEItemStack.create( providedTemplate );
|
||||
final AEItemStack ae_req = AEItemStack.fromItemStack( providedTemplate );
|
||||
ae_req.setStackSize( 1 );
|
||||
|
||||
if( filter == null || filter.isListed( ae_req ) )
|
||||
|
||||
@@ -30,6 +30,7 @@ import appeng.api.config.Actionable;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
@@ -63,7 +64,7 @@ public class IMEAdaptor extends InventoryAdaptor
|
||||
|
||||
private IItemList<IAEItemStack> getList()
|
||||
{
|
||||
return this.target.getAvailableItems( AEApi.instance().storage().createItemList() );
|
||||
return this.target.getAvailableItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList() );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -86,7 +87,7 @@ public class IMEAdaptor extends InventoryAdaptor
|
||||
}
|
||||
else
|
||||
{
|
||||
req = AEItemStack.create( filter );
|
||||
req = AEItemStack.fromItemStack( filter );
|
||||
}
|
||||
|
||||
IAEItemStack out = null;
|
||||
@@ -123,7 +124,7 @@ public class IMEAdaptor extends InventoryAdaptor
|
||||
|
||||
private ItemStack doRemoveItemsFuzzy( final int amount, final ItemStack filter, final IInventoryDestination destination, final Actionable type, final FuzzyMode fuzzyMode )
|
||||
{
|
||||
final IAEItemStack reqFilter = AEItemStack.create( filter );
|
||||
final IAEItemStack reqFilter = AEItemStack.fromItemStack( filter );
|
||||
if( reqFilter == null )
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
@@ -160,7 +161,7 @@ public class IMEAdaptor extends InventoryAdaptor
|
||||
@Override
|
||||
public ItemStack addItems( final ItemStack toBeAdded )
|
||||
{
|
||||
final IAEItemStack in = AEItemStack.create( toBeAdded );
|
||||
final IAEItemStack in = AEItemStack.fromItemStack( toBeAdded );
|
||||
if( in != null )
|
||||
{
|
||||
final IAEItemStack out = this.target.injectItems( in, Actionable.MODULATE, this.src );
|
||||
@@ -175,7 +176,7 @@ public class IMEAdaptor extends InventoryAdaptor
|
||||
@Override
|
||||
public ItemStack simulateAdd( final ItemStack toBeSimulated )
|
||||
{
|
||||
final IAEItemStack in = AEItemStack.create( toBeSimulated );
|
||||
final IAEItemStack in = AEItemStack.fromItemStack( toBeSimulated );
|
||||
if( in != null )
|
||||
{
|
||||
final IAEItemStack out = this.target.injectItems( in, Actionable.SIMULATE, this.src );
|
||||
|
||||
@@ -46,7 +46,7 @@ public class IMEInventoryDestination implements IInventoryDestination
|
||||
return false;
|
||||
}
|
||||
|
||||
final IAEItemStack failed = this.me.injectItems( AEItemStack.create( stack ), Actionable.SIMULATE, null );
|
||||
final IAEItemStack failed = this.me.injectItems( AEItemStack.fromItemStack( stack ), Actionable.SIMULATE, null );
|
||||
|
||||
if( failed == null )
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
|
||||
|
||||
public class ItemListIgnoreCrafting<T extends IAEStack> implements IItemList<T>
|
||||
public class ItemListIgnoreCrafting<T extends IAEStack<T>> implements IItemList<T>
|
||||
{
|
||||
|
||||
private final IItemList<T> target;
|
||||
|
||||
@@ -48,7 +48,7 @@ public class ItemSlot
|
||||
|
||||
public IAEItemStack getAEItemStack()
|
||||
{
|
||||
return this.aeItemStack == null ? ( this.itemStack.isEmpty() ? null : ( this.aeItemStack = AEItemStack.create( this.itemStack ) ) ) : this.aeItemStack;
|
||||
return this.aeItemStack == null ? ( this.itemStack.isEmpty() ? null : ( this.aeItemStack = AEItemStack.fromItemStack( this.itemStack ) ) ) : this.aeItemStack;
|
||||
}
|
||||
|
||||
void setAEItemStack( final IAEItemStack is )
|
||||
|
||||
@@ -37,10 +37,11 @@ import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidUtil;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.channels.IFluidStorageChannel;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
@@ -80,14 +81,26 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
|
||||
this.myHash = this.fluid.hashCode() ^ ( this.tagCompound == null ? 0 : System.identityHashCode( this.tagCompound ) );
|
||||
}
|
||||
|
||||
public static IAEFluidStack loadFluidStackFromNBT( final NBTTagCompound i )
|
||||
public static AEFluidStack fromFluidStack( final FluidStack input )
|
||||
{
|
||||
final ItemStack itemstack = new ItemStack( i );
|
||||
if( itemstack.isEmpty() )
|
||||
if( input == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
final AEFluidStack fluid = AEFluidStack.create( itemstack );
|
||||
|
||||
return new AEFluidStack( input );
|
||||
}
|
||||
|
||||
public static IAEFluidStack fromNBT( final NBTTagCompound i )
|
||||
{
|
||||
final FluidStack fluidStack = FluidStack.loadFluidStackFromNBT( i );
|
||||
|
||||
if( fluidStack == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
final AEFluidStack fluid = AEFluidStack.fromFluidStack( fluidStack );
|
||||
// fluid.priority = i.getInteger( "Priority" );
|
||||
fluid.setStackSize( i.getLong( "Cnt" ) );
|
||||
fluid.setCountRequestable( i.getLong( "Req" ) );
|
||||
@@ -95,24 +108,7 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
|
||||
return fluid;
|
||||
}
|
||||
|
||||
public static AEFluidStack create( final Object a )
|
||||
{
|
||||
if( a == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if( a instanceof AEFluidStack )
|
||||
{
|
||||
( (IAEStack<IAEFluidStack>) a ).copy();
|
||||
}
|
||||
if( a instanceof FluidStack )
|
||||
{
|
||||
return new AEFluidStack( (FluidStack) a );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static IAEFluidStack loadFluidStackFromPacket( final ByteBuf data ) throws IOException
|
||||
public static IAEFluidStack fromPacket( final ByteBuf data ) throws IOException
|
||||
{
|
||||
final byte mask = data.readByte();
|
||||
// byte PriorityType = (byte) (mask & 0x03);
|
||||
@@ -159,7 +155,7 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
|
||||
return null;
|
||||
}
|
||||
|
||||
final AEFluidStack fluid = AEFluidStack.create( fluidStack );
|
||||
final AEFluidStack fluid = AEFluidStack.fromFluidStack( fluidStack );
|
||||
// fluid.priority = (int) priority;
|
||||
fluid.setStackSize( stackSize );
|
||||
fluid.setCountRequestable( countRequestable );
|
||||
@@ -275,9 +271,9 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getChannel()
|
||||
public IStorageChannel<IAEFluidStack> getChannel()
|
||||
{
|
||||
return StorageChannel.FLUIDS;
|
||||
return AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
@@ -36,8 +37,10 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.util.Platform;
|
||||
|
||||
@@ -72,7 +75,18 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
|
||||
this.oreReference = OreHelper.INSTANCE.getOre( is.getDefinition() );
|
||||
}
|
||||
|
||||
public static IAEItemStack loadItemStackFromNBT( final NBTTagCompound i )
|
||||
@Nullable
|
||||
public static AEItemStack fromItemStack( @Nonnull final ItemStack stack )
|
||||
{
|
||||
if( stack.isEmpty() )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new AEItemStack( AEItemStackRegistry.getRegisteredStack( stack ), stack.getCount() );
|
||||
}
|
||||
|
||||
public static IAEItemStack fromNBT( final NBTTagCompound i )
|
||||
{
|
||||
if( i == null )
|
||||
{
|
||||
@@ -85,25 +99,14 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
|
||||
return null;
|
||||
}
|
||||
|
||||
final AEItemStack item = AEItemStack.create( itemstack );
|
||||
final AEItemStack item = AEItemStack.fromItemStack( itemstack );
|
||||
item.setStackSize( i.getLong( "Cnt" ) );
|
||||
item.setCountRequestable( i.getLong( "Req" ) );
|
||||
item.setCraftable( i.getBoolean( "Craft" ) );
|
||||
return item;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static AEItemStack create( final ItemStack stack )
|
||||
{
|
||||
if( stack.isEmpty() )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new AEItemStack( AEItemStackRegistry.getRegisteredStack( stack ), stack.getCount() );
|
||||
}
|
||||
|
||||
public static IAEItemStack loadItemStackFromPacket( final ByteBuf data ) throws IOException
|
||||
public static IAEItemStack fromPacket( final ByteBuf data ) throws IOException
|
||||
{
|
||||
final byte mask = data.readByte();
|
||||
// byte PriorityType = (byte) (mask & 0x03);
|
||||
@@ -120,7 +123,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
|
||||
return null;
|
||||
}
|
||||
|
||||
final AEItemStack item = AEItemStack.create( itemstack );
|
||||
final AEItemStack item = AEItemStack.fromItemStack( itemstack );
|
||||
item.setStackSize( stackSize );
|
||||
item.setCountRequestable( countRequestable );
|
||||
item.setCraftable( isCraftable );
|
||||
@@ -298,9 +301,9 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getChannel()
|
||||
public IStorageChannel<IAEItemStack> getChannel()
|
||||
{
|
||||
return StorageChannel.ITEMS;
|
||||
return AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.util.Collection;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemContainer;
|
||||
|
||||
@@ -31,7 +32,7 @@ public class ItemModList implements IItemContainer<IAEItemStack>
|
||||
{
|
||||
|
||||
private final IItemContainer<IAEItemStack> backingStore;
|
||||
private final IItemContainer<IAEItemStack> overrides = AEApi.instance().storage().createItemList();
|
||||
private final IItemContainer<IAEItemStack> overrides = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
|
||||
public ItemModList( final IItemContainer<IAEItemStack> backend )
|
||||
{
|
||||
|
||||
@@ -57,7 +57,7 @@ public class OreReference
|
||||
{
|
||||
if( is.getItem() != Items.AIR )
|
||||
{
|
||||
this.aeOtherOptions.add( AEItemStack.create( is ) );
|
||||
this.aeOtherOptions.add( AEItemStack.fromItemStack( is ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
package appeng.util.prioritylist;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Collections;
|
||||
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
|
||||
@@ -28,8 +27,6 @@ import appeng.api.storage.data.IAEStack;
|
||||
public class DefaultPriorityList<T extends IAEStack<T>> implements IPartitionList<T>
|
||||
{
|
||||
|
||||
private static final List NULL_LIST = new ArrayList();
|
||||
|
||||
@Override
|
||||
public boolean isListed( final T input )
|
||||
{
|
||||
@@ -45,6 +42,6 @@ public class DefaultPriorityList<T extends IAEStack<T>> implements IPartitionLis
|
||||
@Override
|
||||
public Iterable<T> getItems()
|
||||
{
|
||||
return NULL_LIST;
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user