From c85a80617a436c8eff38da819c0dfac19f6ed8eb Mon Sep 17 00:00:00 2001 From: Nikita Savyolov Date: Sat, 9 Oct 2021 20:52:45 +0300 Subject: [PATCH] fix: some tile write nbt returns --- .../client/render/TileEntityMonitorRenderer.java | 2 +- .../shared/computer/blocks/TileComputerBase.java | 3 +-- .../shared/peripheral/diskdrive/TileDiskDrive.java | 3 +-- .../peripheral/modem/wired/TileWiredModemFull.java | 3 +-- .../shared/peripheral/monitor/TileMonitor.java | 13 ++++++------- 5 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/main/java/dan200/computercraft/client/render/TileEntityMonitorRenderer.java b/src/main/java/dan200/computercraft/client/render/TileEntityMonitorRenderer.java index 788af6805..6c8c0ab74 100644 --- a/src/main/java/dan200/computercraft/client/render/TileEntityMonitorRenderer.java +++ b/src/main/java/dan200/computercraft/client/render/TileEntityMonitorRenderer.java @@ -35,7 +35,7 @@ import static dan200.computercraft.client.gui.FixedWidthFontRenderer.*; import static net.minecraft.client.util.GlAllocationUtils.allocateByteBuffer; public class TileEntityMonitorRenderer implements BlockEntityRenderer -{ //FIXME get rid of GL Calls. Buffered things or whatever, more research needed. +{ /** * {@link TileMonitor#RENDER_MARGIN}, but a tiny bit of additional padding to ensure that there is no space between the monitor frame and contents. */ diff --git a/src/main/java/dan200/computercraft/shared/computer/blocks/TileComputerBase.java b/src/main/java/dan200/computercraft/shared/computer/blocks/TileComputerBase.java index ae99ad33d..0e6955f9c 100644 --- a/src/main/java/dan200/computercraft/shared/computer/blocks/TileComputerBase.java +++ b/src/main/java/dan200/computercraft/shared/computer/blocks/TileComputerBase.java @@ -334,7 +334,6 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT @Override public NbtCompound writeNbt( @Nonnull NbtCompound nbt ) { - super.writeNbt( nbt ); // Save ID, label and power state if( computerID >= 0 ) { @@ -345,7 +344,7 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT nbt.putString( NBT_LABEL, label ); } nbt.putBoolean( NBT_ON, on ); - return nbt; + return super.writeNbt( nbt ); } @Override diff --git a/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/TileDiskDrive.java b/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/TileDiskDrive.java index 4bb75b4a9..957f209b3 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/TileDiskDrive.java +++ b/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/TileDiskDrive.java @@ -124,7 +124,6 @@ public final class TileDiskDrive extends TileGeneric implements DefaultInventory @Override public NbtCompound writeNbt( @Nonnull NbtCompound nbt ) { - super.writeNbt( nbt ); if( customName != null ) { nbt.putString( NBT_NAME, Text.Serializer.toJson( customName ) ); @@ -136,7 +135,7 @@ public final class TileDiskDrive extends TileGeneric implements DefaultInventory diskStack.writeNbt( item ); nbt.put( NBT_ITEM, item ); } - return nbt; + return super.writeNbt( nbt ); } @Override diff --git a/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/TileWiredModemFull.java b/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/TileWiredModemFull.java index 0de7d306a..abeebbe38 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/TileWiredModemFull.java +++ b/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/TileWiredModemFull.java @@ -329,13 +329,12 @@ public class TileWiredModemFull extends TileGeneric implements IPeripheralTile @Override public NbtCompound writeNbt( NbtCompound nbt ) { - super.writeNbt( nbt ); nbt.putBoolean( NBT_PERIPHERAL_ENABLED, peripheralAccessAllowed ); for( int i = 0; i < peripherals.length; i++ ) { peripherals[i].write( nbt, Integer.toString( i ) ); } - return nbt; + return super.writeNbt( nbt ); } @Override diff --git a/src/main/java/dan200/computercraft/shared/peripheral/monitor/TileMonitor.java b/src/main/java/dan200/computercraft/shared/peripheral/monitor/TileMonitor.java index b94cd8bd8..38fd20cfa 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/monitor/TileMonitor.java +++ b/src/main/java/dan200/computercraft/shared/peripheral/monitor/TileMonitor.java @@ -307,14 +307,13 @@ public class TileMonitor extends TileGeneric implements IPeripheralTile @Nonnull @Override - public NbtCompound writeNbt( NbtCompound tag ) + public NbtCompound writeNbt( NbtCompound nbt ) { - super.writeNbt( tag ); - tag.putInt( NBT_X, xIndex ); - tag.putInt( NBT_Y, yIndex ); - tag.putInt( NBT_WIDTH, width ); - tag.putInt( NBT_HEIGHT, height ); - return tag; + nbt.putInt( NBT_X, xIndex ); + nbt.putInt( NBT_Y, yIndex ); + nbt.putInt( NBT_WIDTH, width ); + nbt.putInt( NBT_HEIGHT, height ); + return super.writeNbt( nbt ); } // @Override //TODO: make BlockEntityRenderer work with this, i guess.