* Implemented an adapter for IItemHandler so it can be used by the Storage Bus. * Added update hook for inject/extract to ItemHandlerAdapter. * Implemented ItemHandler and FluidHandler capabilities for the condenser, as replacement for the Void Inventories. * Removed external storage handler, added capability-based way of accessing a monitorable ME network via the storage bus. Removed special case inventories for the matter condenser. * Implemented InventoryAdaptor for IItemHandler. This also now fixes molecular assemblers interaction with part interfaces.
This commit is contained in:
@@ -56,6 +56,7 @@ import appeng.api.networking.spatial.ISpatialCache;
|
||||
import appeng.api.networking.storage.IStorageGrid;
|
||||
import appeng.api.networking.ticking.ITickManager;
|
||||
import appeng.api.parts.IPartHelper;
|
||||
import appeng.capabilities.Capabilities;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.registries.P2PTunnelRegistry;
|
||||
import appeng.core.features.registries.entries.BasicCellHandler;
|
||||
@@ -75,7 +76,6 @@ import appeng.me.cache.PathGridCache;
|
||||
import appeng.me.cache.SecurityCache;
|
||||
import appeng.me.cache.SpatialPylonCache;
|
||||
import appeng.me.cache.TickManagerCache;
|
||||
import appeng.me.storage.AEExternalHandler;
|
||||
import appeng.parts.PartPlacement;
|
||||
import appeng.recipes.AEItemResolver;
|
||||
import appeng.recipes.CustomRecipeConfig;
|
||||
@@ -131,6 +131,8 @@ public final class Registration
|
||||
{
|
||||
this.registerSpatial( false );
|
||||
|
||||
Capabilities.register();
|
||||
|
||||
final Api api = Api.INSTANCE;
|
||||
final IRecipeHandlerRegistry recipeRegistry = api.registries().recipes();
|
||||
this.registerCraftHandlers( recipeRegistry );
|
||||
@@ -247,12 +249,6 @@ public final class Registration
|
||||
recipeLoader.run();
|
||||
|
||||
// TODO readd layers
|
||||
// partHelper.registerNewLayer( "appeng.parts.layers.LayerISidedInventory",
|
||||
// "net.minecraft.inventory.ISidedInventory" );
|
||||
// partHelper.registerNewLayer( "appeng.parts.layers.LayerIFluidHandler",
|
||||
// "net.minecraftforge.fluids.IFluidHandler" );
|
||||
// partHelper.registerNewLayer( "appeng.parts.layers.LayerITileStorageMonitorable",
|
||||
// "appeng.api.implementations.tiles.ITileStorageMonitorable" );
|
||||
|
||||
// if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.IC2 ) )
|
||||
// {
|
||||
@@ -292,8 +288,6 @@ public final class Registration
|
||||
gcr.registerGridCache( ISecurityGrid.class, SecurityCache.class );
|
||||
gcr.registerGridCache( ICraftingGrid.class, CraftingGridCache.class );
|
||||
|
||||
registries.externalStorage().addExternalStorageInterface( new AEExternalHandler() );
|
||||
|
||||
registries.cell().addCellHandler( new BasicCellHandler() );
|
||||
registries.cell().addCellHandler( new CreativeCellHandler() );
|
||||
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
/*
|
||||
* 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.features.registries;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.storage.IExternalStorageHandler;
|
||||
import appeng.api.storage.IExternalStorageRegistry;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.core.features.registries.entries.ExternalIInv;
|
||||
|
||||
|
||||
public class ExternalStorageRegistry implements IExternalStorageRegistry
|
||||
{
|
||||
|
||||
private final List<IExternalStorageHandler> Handlers;
|
||||
private final ExternalIInv lastHandler = new ExternalIInv();
|
||||
|
||||
public ExternalStorageRegistry()
|
||||
{
|
||||
this.Handlers = new ArrayList<IExternalStorageHandler>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addExternalStorageInterface( final IExternalStorageHandler ei )
|
||||
{
|
||||
this.Handlers.add( ei );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IExternalStorageHandler getHandler( final TileEntity te, final EnumFacing d, final StorageChannel chan, final BaseActionSource mySrc )
|
||||
{
|
||||
for( final IExternalStorageHandler x : this.Handlers )
|
||||
{
|
||||
if( x.canHandle( te, d, chan, mySrc ) )
|
||||
{
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
if( this.lastHandler.canHandle( te, d, chan, mySrc ) )
|
||||
{
|
||||
return this.lastHandler;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,6 @@ import appeng.api.movable.IMovableRegistry;
|
||||
import appeng.api.networking.IGridCacheRegistry;
|
||||
import appeng.api.parts.IPartModels;
|
||||
import appeng.api.storage.ICellRegistry;
|
||||
import appeng.api.storage.IExternalStorageRegistry;
|
||||
|
||||
|
||||
/**
|
||||
@@ -49,7 +48,6 @@ public class RegistryContainer implements IRegistryContainer
|
||||
{
|
||||
private final IGrinderRegistry grinder = new GrinderRecipeManager();
|
||||
private final IInscriberRegistry inscriber = new InscriberRegistry();
|
||||
private final IExternalStorageRegistry storage = new ExternalStorageRegistry();
|
||||
private final ICellRegistry cell = new CellRegistry();
|
||||
private final ILocatableRegistry locatable = new LocatableRegistry();
|
||||
private final ISpecialComparisonRegistry comparison = new SpecialComparisonRegistry();
|
||||
@@ -74,12 +72,6 @@ public class RegistryContainer implements IRegistryContainer
|
||||
return this.gridCache;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IExternalStorageRegistry externalStorage()
|
||||
{
|
||||
return this.storage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISpecialComparisonRegistry specialComparison()
|
||||
{
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
* 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.features.registries.entries;
|
||||
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.storage.IExternalStorageHandler;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.me.storage.MEMonitorIInventory;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
|
||||
|
||||
public class ExternalIInv implements IExternalStorageHandler
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean canHandle( final TileEntity te, final EnumFacing d, final StorageChannel channel, final BaseActionSource mySrc )
|
||||
{
|
||||
return channel == StorageChannel.ITEMS && te instanceof IInventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEInventory getInventory( final TileEntity te, final EnumFacing d, final StorageChannel channel, final BaseActionSource src )
|
||||
{
|
||||
final InventoryAdaptor ad = InventoryAdaptor.getAdaptor( te, d );
|
||||
|
||||
if( channel == StorageChannel.ITEMS && ad != null )
|
||||
{
|
||||
return new MEMonitorIInventory( ad );
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user