Updated deprecated NBT methods

This commit is contained in:
Nanit 2022-01-23 12:14:57 +02:00
parent 2e69580271
commit 1d75272c83

View File

@ -33,7 +33,7 @@ public class ByteMessage extends ByteBuf {
return bytes; return bytes;
} }
/* Minecraft protocol methods */ /* Minecraft's protocol methods */
public int readVarInt() { public int readVarInt() {
int i = 0; int i = 0;
@ -149,7 +149,7 @@ public class ByteMessage extends ByteBuf {
writeVarInt(compoundTags.length); writeVarInt(compoundTags.length);
for (CompoundBinaryTag tag : compoundTags) { for (CompoundBinaryTag tag : compoundTags) {
BinaryTagIO.writeDataOutput(tag, stream); BinaryTagIO.writer().write(tag, (OutputStream) stream);
} }
} catch (IOException e) { } catch (IOException e) {
throw new EncoderException("Cannot write NBT CompoundTag"); throw new EncoderException("Cannot write NBT CompoundTag");
@ -158,7 +158,7 @@ public class ByteMessage extends ByteBuf {
public CompoundBinaryTag readCompoundTag() { public CompoundBinaryTag readCompoundTag() {
try { try {
return BinaryTagIO.readDataInput(new ByteBufInputStream(buf)); return BinaryTagIO.reader().read((InputStream) new ByteBufInputStream(buf));
} catch (IOException thrown) { } catch (IOException thrown) {
throw new DecoderException("Cannot read NBT CompoundTag"); throw new DecoderException("Cannot read NBT CompoundTag");
} }
@ -166,7 +166,7 @@ public class ByteMessage extends ByteBuf {
public void writeCompoundTag(CompoundBinaryTag compoundTag) { public void writeCompoundTag(CompoundBinaryTag compoundTag) {
try { try {
BinaryTagIO.writeDataOutput(compoundTag, new ByteBufOutputStream(buf)); BinaryTagIO.writer().write(compoundTag, (OutputStream) new ByteBufOutputStream(buf));
} catch (IOException e) { } catch (IOException e) {
throw new EncoderException("Cannot write NBT CompoundTag"); throw new EncoderException("Cannot write NBT CompoundTag");
} }