Try fix 1.19+ dimension processing

This commit is contained in:
BruceChen 2022-09-15 12:48:38 +08:00
parent 223c13561c
commit a2b2aeb748
2 changed files with 11 additions and 4 deletions

@ -1 +1 @@
Subproject commit b4fd7da2595ad54479880fc1c9c6e14975412d92 Subproject commit 7acaa0ab31809f0f6512e6a76e53e15441de8e7c

View file

@ -381,11 +381,12 @@ namespace MinecraftClient.Protocol.Handlers
// String identifier: 1.16 and 1.16.1 // String identifier: 1.16 and 1.16.1
// varInt: [1.9.1 to 1.15.2] // varInt: [1.9.1 to 1.15.2]
// byte: below 1.9.1 // byte: below 1.9.1
string? dimensionTypeName = null;
Dictionary<string, object>? dimensionType = null; Dictionary<string, object>? dimensionType = null;
if (protocolVersion >= MC_1_16_Version) if (protocolVersion >= MC_1_16_Version)
{ {
if (protocolVersion >= MC_1_19_Version) if (protocolVersion >= MC_1_19_Version)
dataTypes.ReadNextString(packetData); // Dimension Type: Identifier dimensionTypeName = dataTypes.ReadNextString(packetData); // Dimension Type: Identifier
else if (protocolVersion >= MC_1_16_2_Version) else if (protocolVersion >= MC_1_16_2_Version)
dimensionType = dataTypes.ReadNextNbt(packetData); // Dimension Type: NBT Tag Compound dimensionType = dataTypes.ReadNextNbt(packetData); // Dimension Type: NBT Tag Compound
else else
@ -405,10 +406,16 @@ namespace MinecraftClient.Protocol.Handlers
string dimensionName = dataTypes.ReadNextString(packetData); // Dimension Name (World Name) - 1.16 and above string dimensionName = dataTypes.ReadNextString(packetData); // Dimension Name (World Name) - 1.16 and above
if (handler.GetTerrainEnabled()) if (handler.GetTerrainEnabled())
{ {
if (protocolVersion >= MC_1_16_2_Version && protocolVersion < MC_1_19_Version) if (protocolVersion >= MC_1_16_2_Version && protocolVersion <= MC_1_18_2_Version)
{
World.StoreOneDimension(dimensionName, dimensionType!); World.StoreOneDimension(dimensionName, dimensionType!);
World.SetDimension(dimensionName); World.SetDimension(dimensionName);
} }
else if (protocolVersion >= MC_1_19_Version)
{
World.SetDimension(dimensionTypeName!);
}
}
} }
if (protocolVersion >= MC_1_15_Version) if (protocolVersion >= MC_1_15_Version)