2013-12-27 23:59:59 +01:00
|
|
|
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;
|
2013-12-27 23:59:59 +01:00
|
|
|
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;
|
2013-12-27 23:59:59 +01:00
|
|
|
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;
|
2013-12-27 23:59:59 +01:00
|
|
|
import appeng.tile.grid.AENetworkInvTile;
|
|
|
|
import appeng.tile.inventory.InvOperation;
|
2013-12-28 22:07:48 +01:00
|
|
|
import appeng.util.inv.IInventoryDestination;
|
2013-12-27 23:59:59 +01:00
|
|
|
|
2014-01-05 09:44:31 +01:00
|
|
|
public class TileInterface extends AENetworkInvTile implements IGridTickable, ISegmentedInventory, ITileStorageMonitorable, IStorageMonitorable,
|
|
|
|
IInventoryDestination, IInterfaceHost, IConfigureableObject
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
|
|
|
|
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() );
|
|
|
|
}
|
|
|
|
|
2013-12-27 23:59:59 +01:00
|
|
|
@Override
|
2014-01-05 09:44:31 +01:00
|
|
|
public AECableType getCableConnectionType(ForgeDirection dir)
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
2014-01-05 09:44:31 +01:00
|
|
|
return duality.getCableConnectionType( dir );
|
2013-12-27 23:59:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2014-01-05 09:44:31 +01:00
|
|
|
public DimensionalCoord getLocation()
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
2014-01-05 09:44:31 +01:00
|
|
|
return duality.getLocation();
|
2013-12-27 23:59:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2014-01-05 09:44:31 +01:00
|
|
|
public TileEntity getTileEntity()
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
2014-01-05 09:44:31 +01:00
|
|
|
return this;
|
2013-12-27 23:59:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2014-01-05 09:44:31 +01:00
|
|
|
public boolean canInsert(ItemStack stack)
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
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();
|
2013-12-27 23:59:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2014-01-05 09:44:31 +01:00
|
|
|
public IMEMonitor<IAEFluidStack> getFluidInventory()
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
2014-01-05 09:44:31 +01:00
|
|
|
return duality.getFluidInventory();
|
2013-12-27 23:59:59 +01:00
|
|
|
}
|
|
|
|
|
2014-01-05 09:44:31 +01:00
|
|
|
@Override
|
|
|
|
public IInventory getInventoryByName(String name)
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
2014-01-05 09:44:31 +01:00
|
|
|
return duality.getInventoryByName( name );
|
2013-12-27 23:59:59 +01:00
|
|
|
}
|
|
|
|
|
2014-01-05 09:44:31 +01:00
|
|
|
@Override
|
|
|
|
public TickingRequest getTickingRequest(IGridNode node)
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
2014-01-05 09:44:31 +01:00
|
|
|
return duality.getTickingRequest( node );
|
2013-12-27 23:59:59 +01:00
|
|
|
}
|
|
|
|
|
2014-01-05 09:44:31 +01:00
|
|
|
@Override
|
|
|
|
public TickRateModulation tickingRequest(IGridNode node, int TicksSinceLastCall)
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
2014-01-05 09:44:31 +01:00
|
|
|
return duality.tickingRequest( node, TicksSinceLastCall );
|
2013-12-27 23:59:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2014-01-05 09:44:31 +01:00
|
|
|
public IInventory getInternalInventory()
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
2014-01-05 09:44:31 +01:00
|
|
|
return duality.getInternalInventory();
|
2013-12-27 23:59:59 +01:00
|
|
|
}
|
|
|
|
|
2014-01-31 02:23:12 +01:00
|
|
|
@Override
|
2014-02-09 02:34:52 +01:00
|
|
|
public void markDirty()
|
2014-01-31 02:23:12 +01:00
|
|
|
{
|
2014-02-09 02:34:52 +01:00
|
|
|
duality.markDirty();
|
2014-01-31 02:23:12 +01:00
|
|
|
}
|
|
|
|
|
2013-12-27 23:59:59 +01:00
|
|
|
@Override
|
2014-01-05 09:44:31 +01:00
|
|
|
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removed, ItemStack added)
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
2014-01-05 09:44:31 +01:00
|
|
|
duality.onChangeInventory( inv, slot, mc, removed, added );
|
2013-12-27 23:59:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2014-01-05 09:44:31 +01:00
|
|
|
public int[] getAccessibleSlotsFromSide(int side)
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
2014-01-05 09:44:31 +01:00
|
|
|
return duality.getAccessibleSlotsFromSide( side );
|
2013-12-27 23:59:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2014-01-05 09:44:31 +01:00
|
|
|
public DualityInterface getInterfaceDuality()
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
2014-01-05 09:44:31 +01:00
|
|
|
return duality;
|
2013-12-27 23:59:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2014-01-05 09:44:31 +01:00
|
|
|
public IStorageMonitorable getMonitorable(ForgeDirection side)
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
2014-01-05 09:44:31 +01:00
|
|
|
return this;
|
2013-12-27 23:59:59 +01:00
|
|
|
}
|
|
|
|
|
2013-12-30 06:58:51 +01:00
|
|
|
@Override
|
2014-01-05 09:44:31 +01:00
|
|
|
public IConfigManager getConfigManager()
|
2013-12-30 06:58:51 +01:00
|
|
|
{
|
2014-01-05 09:44:31 +01:00
|
|
|
// TODO Auto-generated method stub
|
2013-12-30 06:58:51 +01:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2013-12-27 23:59:59 +01:00
|
|
|
}
|