From 626eb14960a7e76fe0ba2dcd02b3cc7c5284dbe9 Mon Sep 17 00:00:00 2001 From: KennyTV <28825609+KennyTV@users.noreply.github.com> Date: Fri, 4 Oct 2019 13:26:51 +0200 Subject: [PATCH] Fix an error in the player spawn packet --- .../packets/EntityPackets.java | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/EntityPackets.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/EntityPackets.java index 9c76c258a..57638ac2b 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/EntityPackets.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/EntityPackets.java @@ -60,27 +60,28 @@ public class EntityPackets { protocol.registerOutgoing(State.PLAY, 0x03, 0x03, new PacketRemapper() { @Override public void registerMap() { + map(Type.VAR_INT); // 0 - Entity ID + map(Type.UUID); // 1 - Entity UUID + map(Type.VAR_INT); // 2 - Entity Type + map(Type.DOUBLE); // 3 - X + map(Type.DOUBLE); // 4 - Y + map(Type.DOUBLE); // 5 - Z + map(Type.BYTE); // 6 - Yaw + map(Type.BYTE); // 7 - Pitch + map(Type.BYTE); // 8 - Head Pitch + map(Type.SHORT); // 9 - Velocity X + map(Type.SHORT); // 10 - Velocity Y + map(Type.SHORT); // 11 - Velocity Z + map(Types1_14.METADATA_LIST, Type.NOTHING); // removed - probably sent in an update packet? + handler(new PacketHandler() { @Override public void handle(PacketWrapper wrapper) throws Exception { - int entityId = wrapper.passthrough(Type.VAR_INT); - wrapper.passthrough(Type.UUID); - - int typeId = wrapper.read(Type.VAR_INT); + int entityId = wrapper.get(Type.VAR_INT, 0); + int typeId = wrapper.get(Type.VAR_INT, 1); Entity1_15Types.EntityType entityType = Entity1_15Types.getTypeFromId(getNewEntityId(typeId)); wrapper.user().get(EntityTracker.class).addEntity(entityId, entityType); - wrapper.write(Type.VAR_INT, entityType.getId()); - - wrapper.passthrough(Type.DOUBLE); - wrapper.passthrough(Type.DOUBLE); - wrapper.passthrough(Type.DOUBLE); - wrapper.passthrough(Type.BYTE); - wrapper.passthrough(Type.BYTE); - wrapper.passthrough(Type.BYTE); - wrapper.passthrough(Type.SHORT); - wrapper.passthrough(Type.SHORT); - wrapper.passthrough(Type.SHORT); - wrapper.read(Types1_14.METADATA_LIST); // removed - probably sent in an update packet? + wrapper.set(Type.VAR_INT, 1, entityType.getId()); } }); } @@ -90,23 +91,22 @@ public class EntityPackets { protocol.registerOutgoing(State.PLAY, 0x05, 0x05, new PacketRemapper() { @Override public void registerMap() { + map(Type.VAR_INT); // 0 - Entity ID + map(Type.UUID); // 1 - Player UUID + map(Type.DOUBLE); // 2 - X + map(Type.DOUBLE); // 3 - Y + map(Type.DOUBLE); // 4 - Z + map(Type.BYTE); // 5 - Yaw + map(Type.BYTE); // 6 - Pitch + map(Types1_14.METADATA_LIST, Type.NOTHING); // removed - probably sent in an update packet? + handler(new PacketHandler() { @Override public void handle(PacketWrapper wrapper) throws Exception { - int entityId = wrapper.passthrough(Type.VAR_INT); - wrapper.passthrough(Type.UUID); + int entityId = wrapper.get(Type.VAR_INT, 0); - int typeId = wrapper.read(Type.VAR_INT); - Entity1_15Types.EntityType entityType = Entity1_15Types.getTypeFromId(getNewEntityId(typeId)); + Entity1_15Types.EntityType entityType = Entity1_15Types.EntityType.PLAYER; wrapper.user().get(EntityTracker.class).addEntity(entityId, entityType); - wrapper.write(Type.VAR_INT, entityType.getId()); - - wrapper.passthrough(Type.DOUBLE); - wrapper.passthrough(Type.DOUBLE); - wrapper.passthrough(Type.DOUBLE); - wrapper.passthrough(Type.BYTE); - wrapper.passthrough(Type.BYTE); - wrapper.read(Types1_14.METADATA); // removed - probably sent in an update packet? } }); }