From 3706b728556a64f272907a7274c80065539cea50 Mon Sep 17 00:00:00 2001 From: Marco Date: Sun, 19 May 2019 19:15:50 +0200 Subject: [PATCH] update 1.13.2 -> 1.14 Packet Ids --- .../Protocol1_13_2To1_14.java | 156 +++++++++++------- .../packets/BlockItemPackets1_14.java | 26 +-- .../packets/EntityPackets1_14.java | 25 ++- .../packets/PlayerPackets1_14.java | 14 +- .../packets/SoundPackets1_14.java | 2 +- 5 files changed, 141 insertions(+), 82 deletions(-) diff --git a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/Protocol1_13_2To1_14.java b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/Protocol1_13_2To1_14.java index b37a2a7a..6440bd70 100644 --- a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/Protocol1_13_2To1_14.java +++ b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/Protocol1_13_2To1_14.java @@ -35,72 +35,62 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol { new PlayerPackets1_14().register(this); new SoundPackets1_14().register(this); - out(State.PLAY, 0x2E, 0x2D); // c - out(State.PLAY, 0x2F, 0x2E); // c - out(State.PLAY, 0x30, 0x2F); // c - out(State.PLAY, 0x31, 0x30); // c - out(State.PLAY, 0x32, 0x31); // c - out(State.PLAY, 0x33, 0x32); // c - // Entity sound - out(State.PLAY, 0x4E, -1, new PacketRemapper() { - @Override - public void registerMap() { // c - handler(new PacketHandler() { - @Override - public void handle(PacketWrapper packetWrapper) throws Exception { - packetWrapper.cancel(); // todo - } - }); - } - }); + registerOutgoing(State.PLAY, 0x15, 0x16); - //Unknown packet added in 19w11a - 0x02 - registerIncoming(State.PLAY, 0x03, 0x02); // r - registerIncoming(State.PLAY, 0x04, 0x03); // r - registerIncoming(State.PLAY, 0x05, 0x04); // r - registerIncoming(State.PLAY, 0x06, 0x05); // r - registerIncoming(State.PLAY, 0x07, 0x06); // r - registerIncoming(State.PLAY, 0x08, 0x07); // r + registerOutgoing(State.PLAY, 0x17, 0x18); - registerIncoming(State.PLAY, 0x0A, 0x09); // r - registerIncoming(State.PLAY, 0x0B, 0x0A); // r + registerOutgoing(State.PLAY, 0x19, 0x1A); + registerOutgoing(State.PLAY, 0x1A, 0x1B); + registerOutgoing(State.PLAY, 0x1B, 0x1C); + registerOutgoing(State.PLAY, 0x54, 0x1D); + registerOutgoing(State.PLAY, 0x1C, 0x1E); + registerOutgoing(State.PLAY, 0x1D, 0x1F); + registerOutgoing(State.PLAY, 0x1E, 0x20); + registerOutgoing(State.PLAY, 0x20, 0x21); - registerIncoming(State.PLAY, 0x0D, 0x0C); // r - registerIncoming(State.PLAY, 0x0E, 0x0D); // r - //Unknown packet added in 19w11a - 0x0F - registerIncoming(State.PLAY, 0x10, 0x0E); // r - registerIncoming(State.PLAY, 0x11, 0x0F); // r - registerIncoming(State.PLAY, 0x12, 0x10); // r - registerIncoming(State.PLAY, 0x13, 0x11); // r - registerIncoming(State.PLAY, 0x14, 0x12); // r - registerIncoming(State.PLAY, 0x15, 0x13); // r - registerIncoming(State.PLAY, 0x16, 0x14); // r - registerIncoming(State.PLAY, 0x17, 0x15); // r - registerIncoming(State.PLAY, 0x18, 0x16); // r - registerIncoming(State.PLAY, 0x19, 0x17); // r + registerOutgoing(State.PLAY, 0x2B, 0x27); - registerIncoming(State.PLAY, 0x1B, 0x19); // r - registerIncoming(State.PLAY, 0x1C, 0x1A); // r + registerOutgoing(State.PLAY, 0x2C, 0x2B); - registerIncoming(State.PLAY, 0x1E, 0x1C); // r - registerIncoming(State.PLAY, 0x1F, 0x1D); // r - registerIncoming(State.PLAY, 0x20, 0x1E); // r - registerIncoming(State.PLAY, 0x21, 0x1F); // r - registerIncoming(State.PLAY, 0x22, 0x20); // r - registerIncoming(State.PLAY, 0x23, 0x21); // r + registerOutgoing(State.PLAY, 0x30, 0x2D); + registerOutgoing(State.PLAY, 0x31, 0x2E); + registerOutgoing(State.PLAY, 0x32, 0x2F); + registerOutgoing(State.PLAY, 0x33, 0x30); + registerOutgoing(State.PLAY, 0x34, 0x31); + // Position and look + registerOutgoing(State.PLAY, 0x35, 0x32); - registerIncoming(State.PLAY, 0x25, 0x23); // r + registerOutgoing(State.PLAY, 0x36, 0x34); - registerIncoming(State.PLAY, 0x29, 0x27); // r - registerIncoming(State.PLAY, 0x2A, 0x28); // r + registerOutgoing(State.PLAY, 0x38, 0x36); + registerOutgoing(State.PLAY, 0x39, 0x37); - registerIncoming(State.PLAY, 0x2C, 0x2A); // r + registerOutgoing(State.PLAY, 0x3B, 0x39); + registerOutgoing(State.PLAY, 0x3C, 0x3A); + registerOutgoing(State.PLAY, 0x3D, 0x3B); + registerOutgoing(State.PLAY, 0x3E, 0x3C); + registerOutgoing(State.PLAY, 0x3F, 0x3D); + registerOutgoing(State.PLAY, 0x42, 0x3E); - registerOutgoing(State.PLAY, 0x4F, 0x4E); // c - registerOutgoing(State.PLAY, 0x50, 0x4F); // c - registerOutgoing(State.PLAY, 0x51, 0x50); // c + registerOutgoing(State.PLAY, 0x44, 0x40); + registerOutgoing(State.PLAY, 0x45, 0x41); - registerOutgoing(State.PLAY, 0x52, 0x51, new PacketRemapper() { // c + registerOutgoing(State.PLAY, 0x47, 0x43); + registerOutgoing(State.PLAY, 0x48, 0x44); + registerOutgoing(State.PLAY, 0x49, 0x45); + registerOutgoing(State.PLAY, 0x4A, 0x46); + registerOutgoing(State.PLAY, 0x4B, 0x47); + registerOutgoing(State.PLAY, 0x4C, 0x48); + + registerOutgoing(State.PLAY, 0x4E, 0x4A); + registerOutgoing(State.PLAY, 0x4F, 0x4B); + registerOutgoing(State.PLAY, 0x52, 0x4C); + + registerOutgoing(State.PLAY, 0x53, 0x4E); // c + registerOutgoing(State.PLAY, 0x55, 0x4F); // c + registerOutgoing(State.PLAY, 0x56, 0x50); // c + + registerOutgoing(State.PLAY, 0x57, 0x51, new PacketRemapper() { // c @Override public void registerMap() { handler(new PacketHandler() { @@ -141,11 +131,11 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol { } }); - registerOutgoing(State.PLAY, 0x53, 0x52); // c - registerOutgoing(State.PLAY, 0x54, 0x53); // c + registerOutgoing(State.PLAY, 0x58, 0x52); // c + registerOutgoing(State.PLAY, 0x59, 0x53); // c // tags - registerOutgoing(State.PLAY, 0x56, 0x55, new PacketRemapper() { + registerOutgoing(State.PLAY, 0x5B, 0x55, new PacketRemapper() { @Override public void registerMap() { // c handler(new PacketHandler() { @@ -187,7 +177,7 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol { // Light update - out(State.PLAY, 0x57, -1, new PacketRemapper() { + out(State.PLAY, 0x24, -1, new PacketRemapper() { @Override public void registerMap() { handler(new PacketHandler() { @@ -198,6 +188,52 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol { }); } }); + + + + //Incomming + + //Unknown packet added in 19w11a - 0x02 + registerIncoming(State.PLAY, 0x03, 0x02); // r + registerIncoming(State.PLAY, 0x04, 0x03); // r + registerIncoming(State.PLAY, 0x05, 0x04); // r + registerIncoming(State.PLAY, 0x06, 0x05); // r + registerIncoming(State.PLAY, 0x07, 0x06); // r + registerIncoming(State.PLAY, 0x08, 0x07); // r + + registerIncoming(State.PLAY, 0x0A, 0x09); // r + registerIncoming(State.PLAY, 0x0B, 0x0A); // r + + registerIncoming(State.PLAY, 0x0D, 0x0C); // r + registerIncoming(State.PLAY, 0x0E, 0x0D); // r + //Unknown packet added in 19w11a - 0x0F + registerIncoming(State.PLAY, 0x0F, 0x0E); // r + registerIncoming(State.PLAY, 0x11, 0x10); // r + registerIncoming(State.PLAY, 0x12, 0x11); // r + registerIncoming(State.PLAY, 0x13, 0x12); // r + registerIncoming(State.PLAY, 0x14, 0xF0); // r + registerIncoming(State.PLAY, 0x15, 0x13); // r + registerIncoming(State.PLAY, 0x16, 0x14); // r + registerIncoming(State.PLAY, 0x17, 0x15); // r + registerIncoming(State.PLAY, 0x18, 0x16); // r + registerIncoming(State.PLAY, 0x19, 0x17); // r + + registerIncoming(State.PLAY, 0x1B, 0x19); // r + registerIncoming(State.PLAY, 0x1C, 0x1A); // r + + registerIncoming(State.PLAY, 0x1E, 0x1C); // r + registerIncoming(State.PLAY, 0x1F, 0x1D); // r + registerIncoming(State.PLAY, 0x20, 0x1E); // r +// registerIncoming(State.PLAY, 0x21, 0x1F); // r TDO fix + registerIncoming(State.PLAY, 0x22, 0x20); // r + registerIncoming(State.PLAY, 0x23, 0x21); // r + + registerIncoming(State.PLAY, 0x25, 0x23); // r + +// registerIncoming(State.PLAY, 0x29, 0x27); // r + registerIncoming(State.PLAY, 0x2A, 0x27); // r + registerIncoming(State.PLAY, 0x2B, 0x28); // r + registerIncoming(State.PLAY, 0x2D, 0x2A); // r } public static int getNewBlockStateId(int id) { diff --git a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/packets/BlockItemPackets1_14.java b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/packets/BlockItemPackets1_14.java index c5d7b9fa..10b7ea01 100644 --- a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/packets/BlockItemPackets1_14.java +++ b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/packets/BlockItemPackets1_14.java @@ -34,7 +34,7 @@ public class BlockItemPackets1_14 extends BlockItemRewriter removedTypes = ImmutableSet.of("crafting_special_suspiciousstew", "blasting", "smoking", "campfire_cooking", "stonecutting"); // Declare Recipes - protocol.registerOutgoing(State.PLAY, 0x55, 0x54, new PacketRemapper() { // c + protocol.registerOutgoing(State.PLAY, 0x5A, 0x54, new PacketRemapper() { // c @Override public void registerMap() { handler(new PacketHandler() { @@ -403,7 +403,7 @@ public class BlockItemPackets1_14 extends BlockItemRewriter { @@ -212,9 +218,24 @@ public class EntityPackets1_14 extends EntityRewriter { } }); + // Destroy entities + protocol.registerOutgoing(State.PLAY, 0x37, 0x35, new PacketRemapper() { + @Override + public void registerMap() { + map(Type.VAR_INT_ARRAY); // 0 - Entity IDS + + handler(new PacketHandler() { + @Override + public void handle(PacketWrapper wrapper) throws Exception { + for (int entity : wrapper.get(Type.VAR_INT_ARRAY, 0)) + wrapper.user().get(EntityTracker.class).removeEntity(entity); + } + }); + } + }); // Metadata packet - protocol.registerOutgoing(State.PLAY, 0x3F, 0x3F, new PacketRemapper() { + protocol.registerOutgoing(State.PLAY, 0x43, 0x3F, new PacketRemapper() { @Override public void registerMap() { map(Type.VAR_INT); // 0 - Entity ID @@ -258,6 +279,8 @@ public class EntityPackets1_14 extends EntityRewriter { addTrackedEntity(wrapper.user(), entityId, EntityType1_14.EntityType.PLAYER); wrapper.write(Type.UNSIGNED_BYTE, (short) 0); + + wrapper.read(Type.VAR_INT); //Read View Distance } }); } diff --git a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/packets/PlayerPackets1_14.java b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/packets/PlayerPackets1_14.java index d3a7404c..b9cc6a5e 100644 --- a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/packets/PlayerPackets1_14.java +++ b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/packets/PlayerPackets1_14.java @@ -23,7 +23,7 @@ public class PlayerPackets1_14 extends Rewriter { }); // Open Sign Editor - protocol.registerOutgoing(State.PLAY, 0x2D, 0x2C, new PacketRemapper() { // c + protocol.registerOutgoing(State.PLAY, 0x2F, 0x2C, new PacketRemapper() { // c @Override public void registerMap() { map(Type.POSITION1_14, Type.POSITION); @@ -40,7 +40,7 @@ public class PlayerPackets1_14 extends Rewriter { }); // Edit Book - protocol.registerIncoming(State.PLAY, 0x0c, 0x0B, new PacketRemapper() { + protocol.registerIncoming(State.PLAY, 0x0C, 0x0B, new PacketRemapper() { @Override public void registerMap() { handler(new PacketHandler() { @@ -53,7 +53,7 @@ public class PlayerPackets1_14 extends Rewriter { }); // Player Digging - protocol.registerIncoming(State.PLAY, 0x1a, 0x18, new PacketRemapper() { + protocol.registerIncoming(State.PLAY, 0x1A, 0x18, new PacketRemapper() { @Override public void registerMap() { map(Type.VAR_INT); @@ -63,7 +63,7 @@ public class PlayerPackets1_14 extends Rewriter { }); // Recipe Book Data - protocol.registerIncoming(State.PLAY, 0x1d, 0x1B, new PacketRemapper() { + protocol.registerIncoming(State.PLAY, 0x1D, 0x1B, new PacketRemapper() { @Override public void registerMap() { map(Type.VAR_INT); @@ -99,7 +99,7 @@ public class PlayerPackets1_14 extends Rewriter { }); // Update Structure Block - protocol.registerIncoming(State.PLAY, 0x27, 0x25, new PacketRemapper() { + protocol.registerIncoming(State.PLAY, 0x28, 0x25, new PacketRemapper() { @Override public void registerMap() { map(Type.POSITION, Type.POSITION1_14); @@ -107,7 +107,7 @@ public class PlayerPackets1_14 extends Rewriter { }); // Update Sign - protocol.registerIncoming(State.PLAY, 0x28, 0x26, new PacketRemapper() { + protocol.registerIncoming(State.PLAY, 0x29, 0x26, new PacketRemapper() { @Override public void registerMap() { map(Type.POSITION, Type.POSITION1_14); @@ -115,7 +115,7 @@ public class PlayerPackets1_14 extends Rewriter { }); // Player Block Placement - protocol.registerIncoming(State.PLAY, 0x2b, 0x29, new PacketRemapper() { + protocol.registerIncoming(State.PLAY, 0x2C, 0x29, new PacketRemapper() { @Override public void registerMap() { handler(new PacketHandler() { diff --git a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/packets/SoundPackets1_14.java b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/packets/SoundPackets1_14.java index 5e803edb..ff20187e 100644 --- a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/packets/SoundPackets1_14.java +++ b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/packets/SoundPackets1_14.java @@ -13,7 +13,7 @@ public class SoundPackets1_14 extends Rewriter { @Override protected void registerPackets(Protocol1_13_2To1_14 protocol) { // Sound Effect - protocol.registerOutgoing(State.PLAY, 0x4D, 0x4D, new PacketRemapper() { + protocol.registerOutgoing(State.PLAY, 0x51, 0x4D, new PacketRemapper() { @Override public void registerMap() { map(Type.VAR_INT); // Sound Id