fix: storage monitor correctly sends data packet

This commit is contained in:
LordMZTE 2023-01-08 16:51:00 +01:00
parent 15dd2c4a2f
commit 1e7b8c759f
Signed by: LordMZTE
GPG Key ID: B64802DC33A64FF6
2 changed files with 5 additions and 10 deletions

View File

@ -15,19 +15,17 @@ public class TileLegacyDisplay extends AENetworkTile {
}
@TileEvent(TileEventType.NETWORK_WRITE)
public boolean writeToStreamTileLegacyDisplay(ByteBuf data) {
public void writeToStreamTileLegacyDisplay(ByteBuf data) {
data.writeBoolean(this.displayPowered);
return true;
}
@TileEvent(TileEventType.NETWORK_READ)
public boolean readFromStreamTileLegacyDisplay(ByteBuf data) {
public void readFromStreamTileLegacyDisplay(ByteBuf data) {
this.displayPowered = data.readBoolean();
this.worldObj.func_147451_t(this.xCoord, this.yCoord, this.zCoord);
this.worldObj.markBlockRangeForRenderUpdate(
this.xCoord, this.yCoord, this.zCoord, this.xCoord, this.yCoord, this.zCoord
);
return true;
}
@MENetworkEventSubscribe

View File

@ -56,23 +56,22 @@ public class TileStorageMonitor extends TileLegacyDisplay implements IStackWatch
}
@TileEvent(TileEventType.NETWORK_WRITE)
public boolean writeToStreamTileStorageMonitor(ByteBuf data) {
public void writeToStreamTileStorageMonitor(ByteBuf data) {
try {
super.writeToStreamTileLegacyDisplay(data);
int flags = (this.isLocked ? 1 : 0) | (this.upgraded ? 0b10 : 0)
| (this.myItem != null ? 0b100 : 0);
data.writeByte(flags);
if (this.myItem != null)
this.myItem.writeToPacket(data);
return true;
} catch (IOException kek) {
throw new RuntimeException(kek);
}
}
@TileEvent(TileEventType.NETWORK_READ)
public boolean readFromStreamTileStorageMonitor(ByteBuf data) {
public void readFromStreamTileStorageMonitor(ByteBuf data) {
try {
super.readFromStreamTileLegacyDisplay(data);
byte flags = data.readByte();
@ -85,8 +84,6 @@ public class TileStorageMonitor extends TileLegacyDisplay implements IStackWatch
}
this.updateDisplayList = true;
return true;
} catch (IOException kek) {
throw new RuntimeException(kek);
}