Make readBlockEntityType() nullable again (#786)

The vanilla client does so too - it allows reading a null value, but wont write one.
This commit is contained in:
chris 2024-01-16 23:05:00 +01:00 committed by GitHub
parent cf4ccc3df6
commit eacfb2d037
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -620,15 +620,9 @@ public class MinecraftCodecHelper extends BasePacketCodecHelper {
} }
} }
@NotNull @Nullable
public BlockEntityType readBlockEntityType(ByteBuf buf) { public BlockEntityType readBlockEntityType(ByteBuf buf) {
int id = this.readVarInt(buf); return BlockEntityType.from(this.readVarInt(buf));
BlockEntityType type = BlockEntityType.from(id);
if (type == null) {
throw new IllegalArgumentException("Unknown BlockEntityType: " + id);
}
return type;
} }
public void writeBlockEntityType(ByteBuf buf, BlockEntityType type) { public void writeBlockEntityType(ByteBuf buf, BlockEntityType type) {