Don't hardcode the ID of TeleportConfirm

Also, always send the teleport confirm packet, even when terrain and movements is not enabled.
This commit is contained in:
Pokechu22 2017-09-08 15:08:45 -07:00 committed by ORelio
parent fd2e3d5797
commit 7ba0c3c8fc

View file

@ -292,7 +292,8 @@ namespace MinecraftClient.Protocol.Handlers
PluginMessage,
TabComplete,
PlayerPosition,
PlayerPositionAndLook
PlayerPositionAndLook,
TeleportConfirm
}
/// <summary>
@ -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));
}
SendPacket(PacketOutgoingType.TeleportConfirm, getVarInt(teleportID));
}
break;
case PacketIncomingType.ChunkData: