Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-07 16:50:14 +01:00
Remove unneeded indirection in NBTType
ByteBufInputStream implements DataInput, ByteBufOutputStream implements DataOutput. Use them to exploit native Netty ByteBuf calls where possible.
Dieser Commit ist enthalten in:
Ursprung
c1b11a55d5
Commit
a42e724f50
@ -36,10 +36,7 @@ public class NBTType extends Type<CompoundTag> {
|
|||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
buffer.readerIndex(readerIndex);
|
buffer.readerIndex(readerIndex);
|
||||||
ByteBufInputStream bytebufStream = new ByteBufInputStream(buffer);
|
return (CompoundTag) NBTIO.readTag((DataInput) new ByteBufInputStream(buffer));
|
||||||
try (DataInputStream dataInputStream = new DataInputStream(bytebufStream)) {
|
|
||||||
return (CompoundTag) NBTIO.readTag((DataInput) dataInputStream);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,11 +46,7 @@ public class NBTType extends Type<CompoundTag> {
|
|||||||
buffer.writeByte(0);
|
buffer.writeByte(0);
|
||||||
} else {
|
} else {
|
||||||
ByteBufOutputStream bytebufStream = new ByteBufOutputStream(buffer);
|
ByteBufOutputStream bytebufStream = new ByteBufOutputStream(buffer);
|
||||||
DataOutputStream dataOutputStream = new DataOutputStream(bytebufStream);
|
NBTIO.writeTag((DataOutput) bytebufStream, object);
|
||||||
|
|
||||||
NBTIO.writeTag((DataOutput) dataOutputStream, object);
|
|
||||||
|
|
||||||
dataOutputStream.close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren