Fix compilation errors

This commit is contained in:
ORelio 2020-06-29 22:15:56 +02:00
parent ff9ba2f2bb
commit 213c9ffc05

View file

@ -220,20 +220,25 @@ namespace MinecraftClient.Protocol.Handlers
int playerEntityID = dataTypes.ReadNextInt(packetData); int playerEntityID = dataTypes.ReadNextInt(packetData);
handler.OnReceivePlayerEntityID(playerEntityID); handler.OnReceivePlayerEntityID(playerEntityID);
handler.OnGamemodeUpdate(Guid.Empty, dataTypes.ReadNextByte(packetData)); handler.OnGamemodeUpdate(Guid.Empty, dataTypes.ReadNextByte(packetData));
if (protocolversion >= MC116Version)
dataTypes.ReadNextByte(packetData); // Previous Gamemode - 1.16 and above
if (protocolversion >= MC116Version)
dataTypes.ReadNextVarInt(packetData); // World Count - 1.16 and above
if (protocolversion >= MC116Version)
dataTypes.ReadNextString(packetData); // World Names - 1.16 and above
if (protocolversion >= MC116Version)
dataTypes.ReadNextNbt(packetData); // Dimension Codec - 1.16 and above
//Current dimension - String identifier in 1.16, number below 1.16 if (protocolversion >= MC116Version)
if (protocolversion >= MC191Version) {
dataTypes.ReadNextByte(packetData); // Previous Gamemode - 1.16 and above
int worldCount = dataTypes.ReadNextVarInt(packetData); // World Count - 1.16 and above
for (int i = 0; i < worldCount; i++)
dataTypes.ReadNextString(packetData); // World Names - 1.16 and above
dataTypes.ReadNextNbt(packetData); // Dimension Codec - 1.16 and above
}
//Current dimension - String identifier in 1.16, varInt below 1.16, byte below 1.9.1
if (protocolversion >= MC116Version)
{
// TODO handle dimensions for 1.16+, needed for terrain handling
dataTypes.ReadNextString(packetData);
this.currentDimension = 0;
}
else if (protocolversion >= MC191Version)
this.currentDimension = dataTypes.ReadNextInt(packetData); this.currentDimension = dataTypes.ReadNextInt(packetData);
else if (protocolversion >= MC116Version)
this.currentDimension = dataTypes.ReadNextString(packetData);
else else
this.currentDimension = (sbyte)dataTypes.ReadNextByte(packetData); this.currentDimension = (sbyte)dataTypes.ReadNextByte(packetData);
@ -254,10 +259,12 @@ namespace MinecraftClient.Protocol.Handlers
dataTypes.ReadNextBool(packetData); // Reduced debug info - 1.8 and above dataTypes.ReadNextBool(packetData); // Reduced debug info - 1.8 and above
if (protocolversion >= MC115Version) if (protocolversion >= MC115Version)
dataTypes.ReadNextBool(packetData); // Enable respawn screen - 1.15 and above dataTypes.ReadNextBool(packetData); // Enable respawn screen - 1.15 and above
if (protocolversion >= MC116Version) if (protocolversion >= MC116Version)
{
dataTypes.ReadNextBool(packetData); // Is Debug - 1.16 and above dataTypes.ReadNextBool(packetData); // Is Debug - 1.16 and above
if (protocolversion >= MC116Version)
dataTypes.ReadNextBool(packetData); // Is Flat - 1.16 and above dataTypes.ReadNextBool(packetData); // Is Flat - 1.16 and above
}
break; break;
case PacketIncomingType.ChatMessage: case PacketIncomingType.ChatMessage:
string message = dataTypes.ReadNextString(packetData); string message = dataTypes.ReadNextString(packetData);
@ -273,27 +280,34 @@ namespace MinecraftClient.Protocol.Handlers
handler.OnTextReceived(message, true); handler.OnTextReceived(message, true);
break; break;
case PacketIncomingType.Respawn: case PacketIncomingType.Respawn:
if (protocolversion >= MC116Version)
this.currentDimension = dataTypes.ReadNextString(packetData); //In 1.16 it was changed to "Identifier" which seems to be a string
else
this.currentDimension = dataTypes.ReadNextInt(packetData);
if (protocolversion >= MC116Version)
dataTypes.ReadNextString(packetData); // World Name - 1.16 and above
if (protocolversion < MC114Version)
dataTypes.ReadNextByte(packetData); // Difficulty - 1.13 and below
if (protocolversion >= MC115Version)
dataTypes.ReadNextLong(packetData); // Hashed world seed - 1.15 and above
dataTypes.ReadNextByte(packetData); // Gamemode
if (protocolversion >= MC116Version)
dataTypes.ReadNextByte(packetData); // Previous Game mode - 1.16 and above
if (protocolversion < MC116Version) if (protocolversion < MC116Version)
dataTypes.ReadNextString(packetData); // Level Type - 1.15 and below {
// TODO handle dimensions for 1.16+, needed for terrain handling
dataTypes.ReadNextString(packetData);
this.currentDimension = 0;
}
else
{
// 1.15 and below
this.currentDimension = dataTypes.ReadNextInt(packetData);
}
if (protocolversion >= MC116Version) if (protocolversion >= MC116Version)
dataTypes.ReadNextBool(packetData); // Is Debug - 1.16 and above dataTypes.ReadNextString(packetData); // World Name - 1.16 and above
if (protocolversion < MC114Version)
dataTypes.ReadNextByte(packetData); // Difficulty - 1.13 and below
if (protocolversion >= MC115Version)
dataTypes.ReadNextLong(packetData); // Hashed world seed - 1.15 and above
dataTypes.ReadNextByte(packetData); // Gamemode
if (protocolversion >= MC116Version) if (protocolversion >= MC116Version)
dataTypes.ReadNextBool(packetData); // Is Flat - 1.16 and above dataTypes.ReadNextByte(packetData); // Previous Game mode - 1.16 and above
if (protocolversion < MC116Version)
dataTypes.ReadNextString(packetData); // Level Type - 1.15 and below
if (protocolversion >= MC116Version) if (protocolversion >= MC116Version)
dataTypes.ReadNextBool(packetData); // Copy metadata - 1.16 and above {
dataTypes.ReadNextBool(packetData); // Is Debug - 1.16 and above
dataTypes.ReadNextBool(packetData); // Is Flat - 1.16 and above
dataTypes.ReadNextBool(packetData); // Copy metadata - 1.16 and above
}
handler.OnRespawn(); handler.OnRespawn();
break; break;
case PacketIncomingType.PlayerPositionAndLook: case PacketIncomingType.PlayerPositionAndLook: