terrain handling for 1.18(1.18.1) and 1.18.2

This commit is contained in:
BruceChen 2022-07-24 21:41:56 +08:00
parent af574b654e
commit 516effa81d
6 changed files with 384 additions and 120 deletions

View file

@ -16,6 +16,11 @@ namespace MinecraftClient.Mapping
/// </summary>
private Dictionary<int, Dictionary<int, ChunkColumn>> chunks = new Dictionary<int, Dictionary<int, ChunkColumn>>();
/// <summary>
/// The dimension info of the world
/// </summary>
private Dimension dimension;
/// <summary>
/// Lock for thread safety
/// </summary>
@ -78,6 +83,30 @@ namespace MinecraftClient.Mapping
}
}
public World()
{
Location.world = this;
}
/// <summary>
/// Set dimension type
/// </summary>
/// <param name="name"> The name of the dimension type</param>
/// <param name="nbt">The dimension type (NBT Tag Compound)</param>
public void SetDimension(string name, Dictionary<string, object> nbt)
{
this.dimension = new Dimension(name, nbt);
}
/// <summary>
/// Get dimension type
/// </summary>
/// <returns>The chunk column</returns>
public Dimension GetDimension()
{
return this.dimension;
}
/// <summary>
/// Get chunk column at the specified location
/// </summary>
@ -176,6 +205,7 @@ namespace MinecraftClient.Mapping
try
{
chunks = new Dictionary<int, Dictionary<int, ChunkColumn>>();
dimension = null;
}
finally
{