mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Improve ReadBlockStatesField
This commit is contained in:
parent
64915c87cf
commit
5f520e2cf4
3 changed files with 20 additions and 22 deletions
|
|
@ -18,7 +18,7 @@ namespace MinecraftClient.Mapping
|
|||
/// <summary>
|
||||
/// Blocks contained into the chunk
|
||||
/// </summary>
|
||||
private readonly Chunk[] chunks;
|
||||
private readonly Chunk?[] chunks;
|
||||
|
||||
/// <summary>
|
||||
/// Create a new ChunkColumn
|
||||
|
|
@ -26,7 +26,7 @@ namespace MinecraftClient.Mapping
|
|||
public ChunkColumn(int size = 16)
|
||||
{
|
||||
ColumnSize = size;
|
||||
chunks = new Chunk[size];
|
||||
chunks = new Chunk?[size];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -35,7 +35,7 @@ namespace MinecraftClient.Mapping
|
|||
/// <param name="chunkX">ChunkColumn X</param>
|
||||
/// <param name="chunkY">ChunkColumn Y</param>
|
||||
/// <returns>chunk at the given location</returns>
|
||||
public Chunk this[int chunkY]
|
||||
public Chunk? this[int chunkY]
|
||||
{
|
||||
get
|
||||
{
|
||||
|
|
|
|||
|
|
@ -118,10 +118,9 @@ namespace MinecraftClient.Mapping
|
|||
/// <param name="chunkColumnSize">ChunkColumn size</param>
|
||||
/// <param name="chunk">Chunk data</param>
|
||||
/// <param name="loadCompleted">Whether the ChunkColumn has been fully loaded</param>
|
||||
public void StoreChunk(int chunkX, int chunkY, int chunkZ, int chunkColumnSize, Chunk chunk, bool loadCompleted)
|
||||
public void StoreChunk(int chunkX, int chunkY, int chunkZ, int chunkColumnSize, Chunk? chunk, bool loadCompleted)
|
||||
{
|
||||
ChunkColumn? chunkColumn = null;
|
||||
|
||||
chunksLock.EnterUpgradeableReadLock();
|
||||
try
|
||||
{
|
||||
|
|
@ -151,7 +150,6 @@ namespace MinecraftClient.Mapping
|
|||
{
|
||||
chunksLock.ExitUpgradeableReadLock();
|
||||
}
|
||||
|
||||
chunkColumn[chunkY] = chunk;
|
||||
if (loadCompleted)
|
||||
chunkColumn.FullyLoaded = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue