Use standard inheritance to propagage NBT events (#3058)
* Remove the old annotation system * Use TileEntity#onLoad instead of onChunkLoad event * Do not call invalidate in onChunkUnload and validate in onLoad
This commit is contained in:
@@ -43,8 +43,6 @@ import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.hooks.TickHandler;
|
||||
import appeng.me.cache.SpatialPylonCache;
|
||||
import appeng.tile.TileEvent;
|
||||
import appeng.tile.events.TileEventType;
|
||||
import appeng.tile.grid.AENetworkInvTile;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.util.IWorldCallable;
|
||||
@@ -66,15 +64,18 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl
|
||||
this.getProxy().setFlags( GridFlags.REQUIRE_CHANNEL );
|
||||
}
|
||||
|
||||
@TileEvent( TileEventType.WORLD_NBT_WRITE )
|
||||
public void writeToNBT_TileSpatialIOPort( final NBTTagCompound data )
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT( final NBTTagCompound data )
|
||||
{
|
||||
super.writeToNBT( data );
|
||||
data.setInteger( "lastRedstoneState", this.lastRedstoneState.ordinal() );
|
||||
return data;
|
||||
}
|
||||
|
||||
@TileEvent( TileEventType.WORLD_NBT_READ )
|
||||
public void readFromNBT_TileSpatialIOPort( final NBTTagCompound data )
|
||||
@Override
|
||||
public void readFromNBT( final NBTTagCompound data )
|
||||
{
|
||||
super.readFromNBT( data );
|
||||
if( data.hasKey( "lastRedstoneState" ) )
|
||||
{
|
||||
this.lastRedstoneState = YesNo.values()[data.getInteger( "lastRedstoneState" )];
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
package appeng.tile.spatial;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
@@ -35,8 +36,6 @@ import appeng.me.cluster.implementations.SpatialPylonCalculator;
|
||||
import appeng.me.cluster.implementations.SpatialPylonCluster;
|
||||
import appeng.me.helpers.AENetworkProxy;
|
||||
import appeng.me.helpers.AENetworkProxyMultiblock;
|
||||
import appeng.tile.TileEvent;
|
||||
import appeng.tile.events.TileEventType;
|
||||
import appeng.tile.grid.AENetworkTile;
|
||||
|
||||
|
||||
@@ -217,17 +216,19 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
|
||||
return 0;
|
||||
}
|
||||
|
||||
@TileEvent( TileEventType.NETWORK_READ )
|
||||
public boolean readFromStream_TileSpatialPylon( final ByteBuf data )
|
||||
@Override
|
||||
protected boolean readFromStream( final ByteBuf data ) throws IOException
|
||||
{
|
||||
final boolean c = super.readFromStream( data );
|
||||
final int old = this.displayBits;
|
||||
this.displayBits = data.readByte();
|
||||
return old != this.displayBits;
|
||||
return old != this.displayBits || c;
|
||||
}
|
||||
|
||||
@TileEvent( TileEventType.NETWORK_WRITE )
|
||||
public void writeToStream_TileSpatialPylon( final ByteBuf data )
|
||||
@Override
|
||||
protected void writeToStream( final ByteBuf data ) throws IOException
|
||||
{
|
||||
super.writeToStream( data );
|
||||
data.writeByte( this.displayBits );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user