From f746fda5a8cfde7c085b939dc5953ba1cd21fe8b Mon Sep 17 00:00:00 2001 From: KennyTV Date: Wed, 18 Mar 2020 19:21:48 +0100 Subject: [PATCH] Unroll uuid reading/writing --- .../api/type/types/UUIDIntArrayType.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/common/src/main/java/us/myles/ViaVersion/api/type/types/UUIDIntArrayType.java b/common/src/main/java/us/myles/ViaVersion/api/type/types/UUIDIntArrayType.java index f37101f16..b27fc4280 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/type/types/UUIDIntArrayType.java +++ b/common/src/main/java/us/myles/ViaVersion/api/type/types/UUIDIntArrayType.java @@ -13,19 +13,22 @@ public class UUIDIntArrayType extends Type { @Override public UUID read(ByteBuf buffer) { - int[] ints = new int[4]; - for (int i = 0; i < 4; ++i) { - ints[i] = buffer.readInt(); - } + int[] ints = { + buffer.readInt(), + buffer.readInt(), + buffer.readInt(), + buffer.readInt() + }; return uuidFromIntArray(ints); } @Override public void write(ByteBuf buffer, UUID object) { int[] ints = uuidToIntArray(object); - for (int i = 0; i < 4; i++) { - buffer.writeInt(ints[i]); - } + buffer.writeInt(ints[0]); + buffer.writeInt(ints[1]); + buffer.writeInt(ints[2]); + buffer.writeInt(ints[3]); } public static UUID uuidFromIntArray(int[] ints) {