mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-12-23 17:08:15 +01:00
Remove unneeded indirection in NBTType
ByteBufInputStream implements DataInput, ByteBufOutputStream implements DataOutput. Use them to exploit native Netty ByteBuf calls where possible.
This commit is contained in:
parent
c1b11a55d5
commit
a42e724f50
@ -36,10 +36,7 @@ public class NBTType extends Type<CompoundTag> {
|
||||
return null;
|
||||
} else {
|
||||
buffer.readerIndex(readerIndex);
|
||||
ByteBufInputStream bytebufStream = new ByteBufInputStream(buffer);
|
||||
try (DataInputStream dataInputStream = new DataInputStream(bytebufStream)) {
|
||||
return (CompoundTag) NBTIO.readTag((DataInput) dataInputStream);
|
||||
}
|
||||
return (CompoundTag) NBTIO.readTag((DataInput) new ByteBufInputStream(buffer));
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,11 +46,7 @@ public class NBTType extends Type<CompoundTag> {
|
||||
buffer.writeByte(0);
|
||||
} else {
|
||||
ByteBufOutputStream bytebufStream = new ByteBufOutputStream(buffer);
|
||||
DataOutputStream dataOutputStream = new DataOutputStream(bytebufStream);
|
||||
|
||||
NBTIO.writeTag((DataOutput) dataOutputStream, object);
|
||||
|
||||
dataOutputStream.close();
|
||||
NBTIO.writeTag((DataOutput) bytebufStream, object);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user