mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-22 04:27:59 +01:00
Make the constants static and use buffer.writeShort instead of doing it manually
This commit is contained in:
parent
42d45b3a9e
commit
4ab3ce224d
1 changed files with 3 additions and 5 deletions
|
@ -16,10 +16,9 @@ import java.util.UUID;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
public class MsgPonyData implements IPonyData {
|
public class MsgPonyData implements IPonyData {
|
||||||
|
private static final short API_IDENTIFIER = (short) 0xABCD;
|
||||||
private final short API_IDENTIFIER = (short) 0xABCD;
|
|
||||||
// API version - increment this number before any time any data is added/removed/moved in the data stream
|
// 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 Race race;
|
||||||
private final TailLength tailLength;
|
private final TailLength tailLength;
|
||||||
|
@ -87,8 +86,7 @@ public class MsgPonyData implements IPonyData {
|
||||||
}
|
}
|
||||||
|
|
||||||
public PacketByteBuf toBuffer(PacketByteBuf buffer) {
|
public PacketByteBuf toBuffer(PacketByteBuf buffer) {
|
||||||
buffer.writeByte((API_IDENTIFIER & 0xFF00) >> 8);
|
buffer.writeShort(API_IDENTIFIER);
|
||||||
buffer.writeByte(API_IDENTIFIER & 0x00FF);
|
|
||||||
buffer.writeByte(API_VERSION);
|
buffer.writeByte(API_VERSION);
|
||||||
buffer.writeEnumConstant(race);
|
buffer.writeEnumConstant(race);
|
||||||
buffer.writeEnumConstant(tailLength);
|
buffer.writeEnumConstant(tailLength);
|
||||||
|
|
Loading…
Reference in a new issue