From eacfb2d03729ffcc6b7328d911fddca748a0c340 Mon Sep 17 00:00:00 2001 From: chris Date: Tue, 16 Jan 2024 23:05:00 +0100 Subject: [PATCH] Make readBlockEntityType() nullable again (#786) The vanilla client does so too - it allows reading a null value, but wont write one. --- .../mc/protocol/codec/MinecraftCodecHelper.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/github/steveice10/mc/protocol/codec/MinecraftCodecHelper.java b/src/main/java/com/github/steveice10/mc/protocol/codec/MinecraftCodecHelper.java index 23eae663..e3e2b8f7 100644 --- a/src/main/java/com/github/steveice10/mc/protocol/codec/MinecraftCodecHelper.java +++ b/src/main/java/com/github/steveice10/mc/protocol/codec/MinecraftCodecHelper.java @@ -620,15 +620,9 @@ public class MinecraftCodecHelper extends BasePacketCodecHelper { } } - @NotNull + @Nullable public BlockEntityType readBlockEntityType(ByteBuf buf) { - int id = this.readVarInt(buf); - BlockEntityType type = BlockEntityType.from(id); - - if (type == null) { - throw new IllegalArgumentException("Unknown BlockEntityType: " + id); - } - return type; + return BlockEntityType.from(this.readVarInt(buf)); } public void writeBlockEntityType(ByteBuf buf, BlockEntityType type) {