From 4ab3ce224d4e05b559a65b0de53f47c5ac4572a3 Mon Sep 17 00:00:00 2001 From: Sollace Date: Thu, 23 Mar 2023 21:04:43 +0000 Subject: [PATCH] Make the constants static and use buffer.writeShort instead of doing it manually --- .../com/minelittlepony/api/pony/network/MsgPonyData.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/minelittlepony/api/pony/network/MsgPonyData.java b/src/main/java/com/minelittlepony/api/pony/network/MsgPonyData.java index 7aaa0feb..11262888 100644 --- a/src/main/java/com/minelittlepony/api/pony/network/MsgPonyData.java +++ b/src/main/java/com/minelittlepony/api/pony/network/MsgPonyData.java @@ -16,10 +16,9 @@ import java.util.UUID; import java.util.function.Supplier; public class MsgPonyData implements IPonyData { - - private final short API_IDENTIFIER = (short) 0xABCD; + private static final short API_IDENTIFIER = (short) 0xABCD; // API version - increment this number before any time any data is added/removed/moved in the data stream - private final byte API_VERSION = 2; + private static final byte API_VERSION = 2; private final Race race; private final TailLength tailLength; @@ -87,8 +86,7 @@ public class MsgPonyData implements IPonyData { } public PacketByteBuf toBuffer(PacketByteBuf buffer) { - buffer.writeByte((API_IDENTIFIER & 0xFF00) >> 8); - buffer.writeByte(API_IDENTIFIER & 0x00FF); + buffer.writeShort(API_IDENTIFIER); buffer.writeByte(API_VERSION); buffer.writeEnumConstant(race); buffer.writeEnumConstant(tailLength);