mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Optimize cold start speed and block loading speed
This commit is contained in:
parent
01ef9a89ca
commit
58eafdfd5c
8 changed files with 147 additions and 127 deletions
|
|
@ -20,11 +20,6 @@ namespace MinecraftClient.Mapping
|
|||
/// </summary>
|
||||
private readonly Chunk[] chunks;
|
||||
|
||||
/// <summary>
|
||||
/// Lock for thread safety
|
||||
/// </summary>
|
||||
private readonly ReaderWriterLockSlim chunkLock = new ReaderWriterLockSlim();
|
||||
|
||||
/// <summary>
|
||||
/// Create a new ChunkColumn
|
||||
/// </summary>
|
||||
|
|
@ -44,27 +39,11 @@ namespace MinecraftClient.Mapping
|
|||
{
|
||||
get
|
||||
{
|
||||
chunkLock.EnterReadLock();
|
||||
try
|
||||
{
|
||||
return chunks[chunkY];
|
||||
}
|
||||
finally
|
||||
{
|
||||
chunkLock.ExitReadLock();
|
||||
}
|
||||
return chunks[chunkY];
|
||||
}
|
||||
set
|
||||
{
|
||||
chunkLock.EnterWriteLock();
|
||||
try
|
||||
{
|
||||
chunks[chunkY] = value;
|
||||
}
|
||||
finally
|
||||
{
|
||||
chunkLock.ExitWriteLock();
|
||||
}
|
||||
chunks[chunkY] = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue