2022-12-04 17:18:15 +01:00
|
|
|
package appeng.tile.legacy;
|
|
|
|
|
|
|
|
import appeng.api.networking.events.MENetworkEventSubscribe;
|
|
|
|
import appeng.api.networking.events.MENetworkPowerStatusChange;
|
|
|
|
import appeng.tile.TileEvent;
|
|
|
|
import appeng.tile.events.TileEventType;
|
|
|
|
import appeng.tile.grid.AENetworkTile;
|
|
|
|
import io.netty.buffer.ByteBuf;
|
|
|
|
|
|
|
|
public class TileLegacyDisplay extends AENetworkTile {
|
|
|
|
private boolean displayPowered;
|
|
|
|
|
|
|
|
public boolean isDisplayPowered() {
|
|
|
|
return displayPowered;
|
|
|
|
}
|
|
|
|
|
|
|
|
@TileEvent(TileEventType.NETWORK_WRITE)
|
2022-12-26 15:10:51 +01:00
|
|
|
public boolean writeToStreamTileLegacyDisplay(ByteBuf data) {
|
2022-12-04 17:18:15 +01:00
|
|
|
data.writeBoolean(this.displayPowered);
|
2022-12-26 15:10:51 +01:00
|
|
|
return true;
|
2022-12-04 17:18:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@TileEvent(TileEventType.NETWORK_READ)
|
2022-12-26 15:10:51 +01:00
|
|
|
public boolean readFromStreamTileLegacyDisplay(ByteBuf data) {
|
2022-12-04 17:18:15 +01:00
|
|
|
this.displayPowered = data.readBoolean();
|
|
|
|
this.worldObj.func_147451_t(this.xCoord, this.yCoord, this.zCoord);
|
2022-12-12 19:31:01 +01:00
|
|
|
this.worldObj.markBlockRangeForRenderUpdate(
|
|
|
|
this.xCoord, this.yCoord, this.zCoord, this.xCoord, this.yCoord, this.zCoord
|
|
|
|
);
|
2022-12-26 15:10:51 +01:00
|
|
|
return true;
|
2022-12-04 17:18:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@MENetworkEventSubscribe
|
|
|
|
public void powerUpdate(final MENetworkPowerStatusChange changed) {
|
|
|
|
this.displayPowered = this.getProxy().isPowered();
|
|
|
|
this.worldObj.func_147451_t(this.xCoord, this.yCoord, this.zCoord);
|
|
|
|
this.markForUpdate();
|
|
|
|
}
|
|
|
|
}
|