mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-23 10:35:12 +01:00
Unroll uuid reading/writing
This commit is contained in:
parent
a7ab4153ef
commit
f746fda5a8
@ -13,19 +13,22 @@ public class UUIDIntArrayType extends Type<UUID> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UUID read(ByteBuf buffer) {
|
public UUID read(ByteBuf buffer) {
|
||||||
int[] ints = new int[4];
|
int[] ints = {
|
||||||
for (int i = 0; i < 4; ++i) {
|
buffer.readInt(),
|
||||||
ints[i] = buffer.readInt();
|
buffer.readInt(),
|
||||||
}
|
buffer.readInt(),
|
||||||
|
buffer.readInt()
|
||||||
|
};
|
||||||
return uuidFromIntArray(ints);
|
return uuidFromIntArray(ints);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(ByteBuf buffer, UUID object) {
|
public void write(ByteBuf buffer, UUID object) {
|
||||||
int[] ints = uuidToIntArray(object);
|
int[] ints = uuidToIntArray(object);
|
||||||
for (int i = 0; i < 4; i++) {
|
buffer.writeInt(ints[0]);
|
||||||
buffer.writeInt(ints[i]);
|
buffer.writeInt(ints[1]);
|
||||||
}
|
buffer.writeInt(ints[2]);
|
||||||
|
buffer.writeInt(ints[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UUID uuidFromIntArray(int[] ints) {
|
public static UUID uuidFromIntArray(int[] ints) {
|
||||||
|
Loading…
Reference in New Issue
Block a user