Create new OPTIONAL_MOTION instruction and use it in 0x17

This commit is contained in:
md_5 2012-10-24 07:32:40 +11:00
parent e0b38c9984
commit 05019bd31a

View File

@ -19,7 +19,6 @@ public class PacketDefinitions {
private static final Instruction BYTE_INT = new ByteHeader(INT); private static final Instruction BYTE_INT = new ByteHeader(INT);
private static final Instruction INT_BYTE = new IntHeader(BYTE); 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_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 STRING = new ShortHeader(SHORT);
private static final Instruction ITEM = new Instruction() { private static final Instruction ITEM = new Instruction() {
@Override @Override
@ -102,6 +101,20 @@ public class PacketDefinitions {
return "Unsigned Byte Byte"; 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 { static {
opCodes[0x00] = new Instruction[]{INT}; 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[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[0x15] = new Instruction[]{INT, SHORT, BYTE, SHORT, INT, INT, INT, BYTE, BYTE, BYTE};
opCodes[0x16] = new Instruction[]{INT, INT}; 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[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[0x19] = new Instruction[]{INT, STRING, INT, INT, INT, INT};
opCodes[0x1A] = new Instruction[]{INT, INT, INT, INT, SHORT}; opCodes[0x1A] = new Instruction[]{INT, INT, INT, INT, SHORT};