mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
Modernize null-check patterns: use 'is null' and 'is not null'
Replace '== null' with 'is null' and '!= null' with 'is not null' across 19 core files following modern C# pattern matching conventions. Only literal null comparisons are changed. Assignments, value comparisons, and LINQ expressions are left untouched. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
902e944cbb
commit
c5df6a49c6
19 changed files with 111 additions and 111 deletions
|
|
@ -247,7 +247,7 @@ namespace MinecraftClient.Mapping
|
|||
}
|
||||
|
||||
// Goal could not be reached. Set the path to the closest location if close enough
|
||||
if (current != null && openSet.MinHScoreNode != null &&
|
||||
if (current is not null && openSet.MinHScoreNode is not null &&
|
||||
(maxOffset == int.MaxValue || openSet.MinHScoreNode.HScore <= maxOffset))
|
||||
return ReconstructPath(cameFrom, openSet.MinHScoreNode.Location, start, goal);
|
||||
|
||||
|
|
@ -362,7 +362,7 @@ namespace MinecraftClient.Mapping
|
|||
locationList.Add(loc);
|
||||
|
||||
// Save node with the smallest H-Score => Distance to goal
|
||||
if (MinHScoreNode == null || newNode.HScore < MinHScoreNode.HScore)
|
||||
if (MinHScoreNode is null || newNode.HScore < MinHScoreNode.HScore)
|
||||
MinHScoreNode = newNode;
|
||||
|
||||
if (i == 0)
|
||||
|
|
@ -491,7 +491,7 @@ namespace MinecraftClient.Mapping
|
|||
public static bool IsOnGround(World world, Location location)
|
||||
{
|
||||
ChunkColumn? chunkColumn = world.GetChunkColumn(location);
|
||||
if (chunkColumn == null || chunkColumn.FullyLoaded == false)
|
||||
if (chunkColumn is null || chunkColumn.FullyLoaded == false)
|
||||
return true; // avoid moving downward in a not loaded chunk
|
||||
|
||||
Location down = Move(location, Direction.Down);
|
||||
|
|
@ -721,11 +721,11 @@ namespace MinecraftClient.Mapping
|
|||
public static bool CheckChunkLoading(World world, Location start, Location dest)
|
||||
{
|
||||
var chunkColumn = world.GetChunkColumn(dest);
|
||||
if (chunkColumn == null || chunkColumn.FullyLoaded == false)
|
||||
if (chunkColumn is null || chunkColumn.FullyLoaded == false)
|
||||
return false;
|
||||
|
||||
chunkColumn = world.GetChunkColumn(start);
|
||||
if (chunkColumn == null || chunkColumn.FullyLoaded == false)
|
||||
if (chunkColumn is null || chunkColumn.FullyLoaded == false)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ namespace MinecraftClient.Mapping
|
|||
set
|
||||
{
|
||||
Tuple<int, int> chunkCoord = new(chunkX, chunkZ);
|
||||
if (value == null)
|
||||
if (value is null)
|
||||
chunks.TryRemove(chunkCoord, out _);
|
||||
else
|
||||
chunks.AddOrUpdate(chunkCoord, value, (_, _) => value);
|
||||
|
|
@ -385,10 +385,10 @@ namespace MinecraftClient.Mapping
|
|||
public Block GetBlock(Location location)
|
||||
{
|
||||
ChunkColumn? column = GetChunkColumn(location);
|
||||
if (column != null)
|
||||
if (column is not null)
|
||||
{
|
||||
Chunk? chunk = column.GetChunk(location);
|
||||
if (chunk != null)
|
||||
if (chunk is not null)
|
||||
return chunk.GetBlock(location);
|
||||
}
|
||||
return Block.Air;
|
||||
|
|
@ -437,10 +437,10 @@ namespace MinecraftClient.Mapping
|
|||
public void SetBlock(Location location, Block block)
|
||||
{
|
||||
ChunkColumn? column = this[location.ChunkX, location.ChunkZ];
|
||||
if (column != null && column.ColumnSize >= location.ChunkY)
|
||||
if (column is not null && column.ColumnSize >= location.ChunkY)
|
||||
{
|
||||
Chunk? chunk = column.GetChunk(location);
|
||||
if (chunk == null)
|
||||
if (chunk is null)
|
||||
column[location.ChunkY] = chunk = new Chunk();
|
||||
chunk[location.ChunkBlockX, location.ChunkBlockY, location.ChunkBlockZ] = block;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue