Applied-Energistics-2-tiler.../tile/misc/TileInterface.java

165 lines
3.7 KiB
Java
Raw Normal View History

package appeng.tile.misc;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
2013-12-28 22:07:48 +01:00
import net.minecraft.nbt.NBTTagCompound;
2014-01-05 09:44:31 +01:00
import net.minecraft.tileentity.TileEntity;
2014-02-09 02:34:52 +01:00
import net.minecraftforge.common.util.ForgeDirection;
2014-01-23 20:02:48 +01:00
import appeng.api.implementations.tiles.ISegmentedInventory;
import appeng.api.implementations.tiles.ITileStorageMonitorable;
import appeng.api.networking.IGridNode;
import appeng.api.networking.ticking.IGridTickable;
import appeng.api.networking.ticking.TickRateModulation;
import appeng.api.networking.ticking.TickingRequest;
import appeng.api.storage.IMEMonitor;
2014-01-05 09:44:31 +01:00
import appeng.api.storage.IStorageMonitorable;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.util.AECableType;
import appeng.api.util.DimensionalCoord;
2014-01-05 09:44:31 +01:00
import appeng.api.util.IConfigManager;
import appeng.api.util.IConfigureableObject;
import appeng.helpers.DualityInterface;
import appeng.helpers.IInterfaceHost;
2013-12-28 22:07:48 +01:00
import appeng.tile.events.AETileEventHandler;
import appeng.tile.events.TileEventType;
import appeng.tile.grid.AENetworkInvTile;
import appeng.tile.inventory.InvOperation;
2013-12-28 22:07:48 +01:00
import appeng.util.inv.IInventoryDestination;
2014-01-05 09:44:31 +01:00
public class TileInterface extends AENetworkInvTile implements IGridTickable, ISegmentedInventory, ITileStorageMonitorable, IStorageMonitorable,
IInventoryDestination, IInterfaceHost, IConfigureableObject
{
2014-01-05 09:44:31 +01:00
DualityInterface duality = new DualityInterface( gridProxy, this );
2013-12-28 22:07:48 +01:00
@Override
2014-01-05 09:44:31 +01:00
public void gridChanged()
2013-12-28 22:07:48 +01:00
{
2014-01-05 09:44:31 +01:00
duality.gridChanged();
2013-12-28 22:07:48 +01:00
}
class TileInterfaceHandler extends AETileEventHandler
{
public TileInterfaceHandler() {
2014-01-26 07:46:16 +01:00
super( TileEventType.WORLD_NBT );
2013-12-28 22:07:48 +01:00
}
@Override
public void writeToNBT(NBTTagCompound data)
{
2014-01-05 09:44:31 +01:00
duality.writeToNBT( data );
2013-12-28 22:07:48 +01:00
}
@Override
public void readFromNBT(NBTTagCompound data)
{
2014-01-05 09:44:31 +01:00
duality.readFromNBT( data );
2013-12-28 22:07:48 +01:00
}
};
public TileInterface() {
addNewHandler( new TileInterfaceHandler() );
}
@Override
2014-01-05 09:44:31 +01:00
public AECableType getCableConnectionType(ForgeDirection dir)
{
2014-01-05 09:44:31 +01:00
return duality.getCableConnectionType( dir );
}
@Override
2014-01-05 09:44:31 +01:00
public DimensionalCoord getLocation()
{
2014-01-05 09:44:31 +01:00
return duality.getLocation();
}
@Override
2014-01-05 09:44:31 +01:00
public TileEntity getTileEntity()
{
2014-01-05 09:44:31 +01:00
return this;
}
@Override
2014-01-05 09:44:31 +01:00
public boolean canInsert(ItemStack stack)
{
2014-01-05 09:44:31 +01:00
return duality.canInsert( stack );
2013-12-28 22:07:48 +01:00
}
@Override
2014-01-05 09:44:31 +01:00
public IMEMonitor<IAEItemStack> getItemInventory()
2013-12-28 22:07:48 +01:00
{
2014-01-05 09:44:31 +01:00
return duality.getItemInventory();
}
@Override
2014-01-05 09:44:31 +01:00
public IMEMonitor<IAEFluidStack> getFluidInventory()
{
2014-01-05 09:44:31 +01:00
return duality.getFluidInventory();
}
2014-01-05 09:44:31 +01:00
@Override
public IInventory getInventoryByName(String name)
{
2014-01-05 09:44:31 +01:00
return duality.getInventoryByName( name );
}
2014-01-05 09:44:31 +01:00
@Override
public TickingRequest getTickingRequest(IGridNode node)
{
2014-01-05 09:44:31 +01:00
return duality.getTickingRequest( node );
}
2014-01-05 09:44:31 +01:00
@Override
public TickRateModulation tickingRequest(IGridNode node, int TicksSinceLastCall)
{
2014-01-05 09:44:31 +01:00
return duality.tickingRequest( node, TicksSinceLastCall );
}
@Override
2014-01-05 09:44:31 +01:00
public IInventory getInternalInventory()
{
2014-01-05 09:44:31 +01:00
return duality.getInternalInventory();
}
@Override
2014-02-09 02:34:52 +01:00
public void markDirty()
{
2014-02-09 02:34:52 +01:00
duality.markDirty();
}
@Override
2014-01-05 09:44:31 +01:00
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removed, ItemStack added)
{
2014-01-05 09:44:31 +01:00
duality.onChangeInventory( inv, slot, mc, removed, added );
}
@Override
2014-01-05 09:44:31 +01:00
public int[] getAccessibleSlotsFromSide(int side)
{
2014-01-05 09:44:31 +01:00
return duality.getAccessibleSlotsFromSide( side );
}
@Override
2014-01-05 09:44:31 +01:00
public DualityInterface getInterfaceDuality()
{
2014-01-05 09:44:31 +01:00
return duality;
}
@Override
2014-01-05 09:44:31 +01:00
public IStorageMonitorable getMonitorable(ForgeDirection side)
{
2014-01-05 09:44:31 +01:00
return this;
}
@Override
2014-01-05 09:44:31 +01:00
public IConfigManager getConfigManager()
{
2014-01-05 09:44:31 +01:00
// TODO Auto-generated method stub
return null;
}
}