Remove External Storage Handler (#2417) (#2508)

* 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:
shartte
2016-10-26 22:58:23 +02:00
committed by yueh
parent 057754c851
commit b977ee89ee
34 changed files with 1203 additions and 1065 deletions
@@ -24,14 +24,11 @@
package appeng.api.features;
import net.minecraftforge.items.IItemHandler;
import appeng.api.AEInjectable;
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;
/**
@@ -54,15 +51,6 @@ public interface IRegistryContainer
*/
IGridCacheRegistry gridCache();
/**
* Add additional storage bus handlers to improve interplay with mod blocks that contains special inventories that
* function unlike vanilla chests. AE uses this internally for barrels, DSU's, quantum chests, AE Networks and more.
*
* @deprecated in favour of {@link IItemHandler}
*/
@Deprecated
IExternalStorageRegistry externalStorage();
/**
* Add additional special comparison functionality, AE Uses this internally for Bees.
*/
@@ -27,7 +27,7 @@ package appeng.api.implementations.tiles;
import appeng.api.networking.energy.IEnergySource;
public interface IMEChest extends IChestOrDrive, ITileStorageMonitorable, IEnergySource
public interface IMEChest extends IChestOrDrive, IEnergySource
{
}
@@ -1,40 +0,0 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2013 AlgorithmX2
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package appeng.api.implementations.tiles;
import net.minecraft.util.EnumFacing;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.storage.IStorageMonitorable;
/**
* Implemented on inventories that can share their inventories with other networks, best example, ME Interface.
*/
public interface ITileStorageMonitorable
{
IStorageMonitorable getMonitorable( EnumFacing side, BaseActionSource src );
}
@@ -1,70 +0,0 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2013 AlgorithmX2
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package appeng.api.storage;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.items.IItemHandler;
import appeng.api.networking.security.BaseActionSource;
/**
* A Registration Record for {@link IExternalStorageRegistry}
*
* @deprecated in favour of {@link IItemHandler}
*/
@Deprecated
public interface IExternalStorageHandler
{
/**
* if this can handle the provided inventory, return true. ( Generally skipped by AE, and it just calls getInventory
* )
*
* @param te to be handled tile entity
* @param mySrc source
*
* @return true, if it can get a handler via getInventory
*/
@Deprecated
boolean canHandle( TileEntity te, EnumFacing d, StorageChannel channel, BaseActionSource mySrc );
/**
* if this can handle the given inventory, return the a IMEInventory implementing class for it, if not return null
*
* please note that if your inventory changes and requires polling, you must use an {@link IMEMonitor} instead of an
* {@link IMEInventory} failure to do so will result in invalid item counts and reporting of the inventory.
*
* @param te to be handled tile entity
* @param d direction
* @param channel channel
* @param src source
*
* @return The Handler for the inventory
*/
@Deprecated
IMEInventory getInventory( TileEntity te, EnumFacing d, StorageChannel channel, BaseActionSource src );
}
@@ -1,64 +0,0 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2013 AlgorithmX2
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package appeng.api.storage;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.items.IItemHandler;
import appeng.api.IAppEngApi;
import appeng.api.networking.security.BaseActionSource;
/**
* A Registry of External Storage handlers.
*
* Do not implement obtain via {@link IAppEngApi}.registries().getExternalStorageRegistry()
*
* @deprecated in favour of {@link IItemHandler}
*/
@Deprecated
public interface IExternalStorageRegistry
{
/**
* A registry for StorageBus interactions
*
* @param esh storage handler
*/
@Deprecated
void addExternalStorageInterface( IExternalStorageHandler esh );
/**
* @param te tile entity
* @param opposite direction
* @param channel channel
* @param mySrc source
*
* @return the handler for a given tile / forge direction
*/
@Deprecated
IExternalStorageHandler getHandler( TileEntity te, EnumFacing opposite, StorageChannel channel, BaseActionSource mySrc );
}
@@ -24,15 +24,13 @@
package appeng.api.storage;
import appeng.api.implementations.tiles.ITileStorageMonitorable;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack;
/**
* represents the internal behavior of a {@link ITileStorageMonitorable} use it to get this value for a tile, or part.
*
* never check a tile for this, always go though ITileStorageMonitorable if you wish to use this interface.
* Exposes the monitorable network inventories of a grid node that choses to export them.
* This interface can only be obtained using Forge capabilities for {@link IStorageMonitorableAccessor}.
*/
public interface IStorageMonitorable
{
@@ -0,0 +1,26 @@
package appeng.api.storage;
import javax.annotation.Nullable;
import appeng.api.networking.security.BaseActionSource;
/**
* Allows storage buses to request access to another ME network so it can be used as a subnetwork.
* This interface is used in conjunction with capabilities, so when an object of this is obtained,
* it already knows about which face the access was requested from.
* <p/>
* To get access to the capability for this, use @CapabilityInject with this interface as the argument
* to the annotation.
*/
public interface IStorageMonitorableAccessor
{
/**
* @return Null if the network cannot be accessed by the given action source (i.e. security doesn't permit it).
*/
@Nullable
IStorageMonitorable getInventory( BaseActionSource src );
}