From 05019bd31ad924db0fa14684b53b8a54ce627ed3 Mon Sep 17 00:00:00 2001 From: md_5 Date: Wed, 24 Oct 2012 07:32:40 +1100 Subject: [PATCH] Create new OPTIONAL_MOTION instruction and use it in 0x17 --- .../net/md_5/mc/protocol/PacketDefinitions.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/md_5/mc/protocol/PacketDefinitions.java b/src/main/java/net/md_5/mc/protocol/PacketDefinitions.java index 8d1e003d..cecb25bb 100644 --- a/src/main/java/net/md_5/mc/protocol/PacketDefinitions.java +++ b/src/main/java/net/md_5/mc/protocol/PacketDefinitions.java @@ -19,7 +19,6 @@ public class PacketDefinitions { private static final Instruction BYTE_INT = new ByteHeader(INT); private static final Instruction INT_BYTE = new IntHeader(BYTE); private static final Instruction INT_3 = new IntHeader(new JumpOpCode(3)); - private static final Instruction INT_6 = new IntHeader(new JumpOpCode(6)); private static final Instruction STRING = new ShortHeader(SHORT); private static final Instruction ITEM = new Instruction() { @Override @@ -102,6 +101,20 @@ public class PacketDefinitions { return "Unsigned Byte Byte"; } }; + private static final Instruction OPTIONAL_MOTION = new Instruction() { + @Override + void read(DataInput in) throws IOException { + int data = in.readInt(); + if (data > 0) { + skip(in, 6); + } + } + + @Override + public String toString() { + return "Optional Motion"; + } + }; static { opCodes[0x00] = new Instruction[]{INT}; @@ -127,7 +140,7 @@ public class PacketDefinitions { opCodes[0x14] = new Instruction[]{INT, STRING, INT, INT, INT, BYTE, BYTE, SHORT, METADATA}; opCodes[0x15] = new Instruction[]{INT, SHORT, BYTE, SHORT, INT, INT, INT, BYTE, BYTE, BYTE}; opCodes[0x16] = new Instruction[]{INT, INT}; - opCodes[0x17] = new Instruction[]{INT, BYTE, INT, INT, INT, INT_6}; + opCodes[0x17] = new Instruction[]{INT, BYTE, INT, INT, INT, OPTIONAL_MOTION}; opCodes[0x18] = new Instruction[]{INT, BYTE, INT, INT, INT, BYTE, BYTE, BYTE, SHORT, SHORT, SHORT, METADATA}; opCodes[0x19] = new Instruction[]{INT, STRING, INT, INT, INT, INT}; opCodes[0x1A] = new Instruction[]{INT, INT, INT, INT, SHORT};