Auto Reflection Based TileEvents.
This commit is contained in:
@@ -7,35 +7,22 @@ import appeng.api.networking.security.IActionHost;
|
||||
import appeng.me.helpers.AENetworkProxy;
|
||||
import appeng.me.helpers.IGridProxyable;
|
||||
import appeng.tile.AEBaseInvTile;
|
||||
import appeng.tile.events.AETileEventHandler;
|
||||
import appeng.tile.TileEvent;
|
||||
import appeng.tile.events.TileEventType;
|
||||
|
||||
public abstract class AENetworkInvTile extends AEBaseInvTile implements IActionHost, IGridProxyable
|
||||
{
|
||||
|
||||
class AENetworkInvTileHandler extends AETileEventHandler
|
||||
@TileEvent(TileEventType.WORLD_NBT_READ)
|
||||
public void readFromNBT_AENetwork(NBTTagCompound data)
|
||||
{
|
||||
gridProxy.readFromNBT( data );
|
||||
}
|
||||
|
||||
public AENetworkInvTileHandler() {
|
||||
super( TileEventType.WORLD_NBT );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound data)
|
||||
{
|
||||
gridProxy.readFromNBT( data );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound data)
|
||||
{
|
||||
gridProxy.writeToNBT( data );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
public AENetworkInvTile() {
|
||||
addNewHandler( new AENetworkInvTileHandler() );
|
||||
@TileEvent(TileEventType.WORLD_NBT_WRITE)
|
||||
public void writeToNBT_AENetwork(NBTTagCompound data)
|
||||
{
|
||||
gridProxy.writeToNBT( data );
|
||||
}
|
||||
|
||||
protected AENetworkProxy gridProxy = new AENetworkProxy( this, "proxy", getItemFromTile( this ), true );
|
||||
|
||||
Reference in New Issue
Block a user