mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Another fix for #2159
This commit is contained in:
parent
7e71fbf241
commit
8ce5c40b28
2 changed files with 35 additions and 9 deletions
|
|
@ -21,9 +21,9 @@ namespace MinecraftClient.Mapping
|
|||
/// <summary>
|
||||
/// The dimension info of the world
|
||||
/// </summary>
|
||||
private static Dimension curDimension = new Dimension();
|
||||
private static Dimension curDimension = new();
|
||||
|
||||
private static Dictionary<string, Dimension>? dimensionList = null;
|
||||
private static Dictionary<string, Dimension> dimensionList = new();
|
||||
|
||||
/// <summary>
|
||||
/// Chunk data parsing progress
|
||||
|
|
@ -61,16 +61,29 @@ namespace MinecraftClient.Mapping
|
|||
/// <param name="registryCodec">Registry Codec nbt data</param>
|
||||
public static void StoreDimensionList(Dictionary<string, object> registryCodec)
|
||||
{
|
||||
dimensionList = new();
|
||||
var dimensionListNbt = (object[])(((Dictionary<string, object>)registryCodec["minecraft:dimension_type"])["value"]);
|
||||
foreach (Dictionary<string, object> dimensionNbt in dimensionListNbt)
|
||||
{
|
||||
string dimensionName = (string)dimensionNbt["name"];
|
||||
Dictionary<string, object> element = (Dictionary<string, object>)dimensionNbt["element"];
|
||||
if (dimensionList.ContainsKey(dimensionName))
|
||||
dimensionList.Remove(dimensionName);
|
||||
dimensionList.Add(dimensionName, new Dimension(dimensionName, element));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Store one dimension - 1.16.2 to 1.18.2
|
||||
/// </summary>
|
||||
/// <param name="dimensionName">Dimension name</param>
|
||||
/// <param name="dimensionType">Dimension Type nbt data</param>
|
||||
public static void StoreDimension(string dimensionName, Dictionary<string, object> dimensionType)
|
||||
{
|
||||
if (dimensionList.ContainsKey(dimensionName))
|
||||
dimensionList.Remove(dimensionName);
|
||||
dimensionList.Add(dimensionName, new Dimension(dimensionName, dimensionType));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Set current dimension - 1.16 and above
|
||||
|
|
@ -79,7 +92,7 @@ namespace MinecraftClient.Mapping
|
|||
/// <param name="nbt">The dimension type (NBT Tag Compound)</param>
|
||||
public static void SetDimension(string name)
|
||||
{
|
||||
curDimension = dimensionList![name]; // Should not fail
|
||||
curDimension = dimensionList[name]; // Should not fail
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue