From 7ba0c3c8fcc1ed064a811236ff2a4959b35e12b0 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Fri, 8 Sep 2017 15:08:45 -0700 Subject: [PATCH] Don't hardcode the ID of TeleportConfirm Also, always send the teleport confirm packet, even when terrain and movements is not enabled. --- .../Protocol/Handlers/Protocol18.cs | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/MinecraftClient/Protocol/Handlers/Protocol18.cs b/MinecraftClient/Protocol/Handlers/Protocol18.cs index 6cdb83ca..0daf7b99 100644 --- a/MinecraftClient/Protocol/Handlers/Protocol18.cs +++ b/MinecraftClient/Protocol/Handlers/Protocol18.cs @@ -292,7 +292,8 @@ namespace MinecraftClient.Protocol.Handlers PluginMessage, TabComplete, PlayerPosition, - PlayerPositionAndLook + PlayerPositionAndLook, + TeleportConfirm } /// @@ -316,6 +317,7 @@ namespace MinecraftClient.Protocol.Handlers case PacketOutgoingType.TabComplete: return 0x14; case PacketOutgoingType.PlayerPosition: return 0x04; case PacketOutgoingType.PlayerPositionAndLook: return 0x06; + case PacketOutgoingType.TeleportConfirm: throw new InvalidOperationException("Teleport confirm is not supported in protocol " + protocol); } } else if (protocol < MC17w13aVersion) @@ -331,6 +333,7 @@ namespace MinecraftClient.Protocol.Handlers case PacketOutgoingType.TabComplete: return 0x01; case PacketOutgoingType.PlayerPosition: return 0x0C; case PacketOutgoingType.PlayerPositionAndLook: return 0x0D; + case PacketOutgoingType.TeleportConfirm: return 0x00; } } else if (protocolversion < MC112pre5Version) @@ -346,6 +349,7 @@ namespace MinecraftClient.Protocol.Handlers case PacketOutgoingType.TabComplete: return 0x02; case PacketOutgoingType.PlayerPosition: return 0x0D; case PacketOutgoingType.PlayerPositionAndLook: return 0x0E; + case PacketOutgoingType.TeleportConfirm: return 0x00; } } else if (protocol < MC17w31aVersion) @@ -361,6 +365,7 @@ namespace MinecraftClient.Protocol.Handlers case PacketOutgoingType.TabComplete: return 0x02; case PacketOutgoingType.PlayerPosition: return 0x0E; case PacketOutgoingType.PlayerPositionAndLook: return 0x0F; + case PacketOutgoingType.TeleportConfirm: return 0x00; } } else @@ -376,6 +381,7 @@ namespace MinecraftClient.Protocol.Handlers case PacketOutgoingType.TabComplete: return 0x01; case PacketOutgoingType.PlayerPosition: return 0x0D; case PacketOutgoingType.PlayerPositionAndLook: return 0x0E; + case PacketOutgoingType.TeleportConfirm: return 0x00; } } @@ -459,13 +465,13 @@ namespace MinecraftClient.Protocol.Handlers handler.UpdateLocation(location, yawpitch); } else handler.UpdateLocation(new Location(x, y, z), yawpitch); + } - if (protocolversion >= MC19Version) - { - int teleportID = readNextVarInt(packetData); - // Teleport confirm packet - SendPacket(0x00, getVarInt(teleportID)); - } + if (protocolversion >= MC19Version) + { + int teleportID = readNextVarInt(packetData); + // Teleport confirm packet + SendPacket(PacketOutgoingType.TeleportConfirm, getVarInt(teleportID)); } break; case PacketIncomingType.ChunkData: