mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
refactor: convert == null / != null to is null / is not null in 31 files
Replace old-style null comparisons with modern C# pattern matching syntax across Commands, Protocol, Mapping, ChatBots, Physics, Inventory, Logger, CommandHandler, Scripting, Crypto, and other modules. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
446c6e7739
commit
c7bc25aa17
31 changed files with 77 additions and 77 deletions
|
|
@ -137,7 +137,7 @@ namespace MinecraftClient.Mapping.BlockPalettes
|
|||
|
||||
File.WriteAllLines(outputPalettePath, outFile);
|
||||
|
||||
if (outputEnum != null)
|
||||
if (outputEnum is not null)
|
||||
{
|
||||
outFile = new List<string>();
|
||||
outFile.AddRange(new[] {
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ namespace MinecraftClient.Mapping
|
|||
{
|
||||
Name = name ?? throw new ArgumentNullException(nameof(name));
|
||||
|
||||
if (nbt == null)
|
||||
if (nbt is null)
|
||||
throw new ArgumentNullException(nameof(nbt));
|
||||
|
||||
if (nbt.ContainsKey("piglin_safe"))
|
||||
|
|
|
|||
|
|
@ -29,9 +29,9 @@ namespace MinecraftClient.Mapping.EntityPalettes
|
|||
Dictionary<int, EntityType> entityTypes = GetDict();
|
||||
Dictionary<int, EntityType>? entityTypesNonLiving = GetDictNonLiving();
|
||||
|
||||
if (entityTypesNonLiving != null && !living)
|
||||
if (entityTypesNonLiving is not null && !living)
|
||||
{
|
||||
//Pre-1.14 non-living entities have a different set of IDs (entityTypesNonLiving != null)
|
||||
//Pre-1.14 non-living entities have a different set of IDs (entityTypesNonLiving is not null)
|
||||
if (entityTypesNonLiving.ContainsKey(id))
|
||||
return entityTypesNonLiving[id];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ namespace MinecraftClient.Mapping
|
|||
public static Location Parse(string x, string y, string z)
|
||||
{
|
||||
Location.TryParse(x, y, z, out Location? res);
|
||||
if (res == null)
|
||||
if (res is null)
|
||||
throw new FormatException();
|
||||
else
|
||||
return (Location)res;
|
||||
|
|
@ -308,7 +308,7 @@ namespace MinecraftClient.Mapping
|
|||
/// <returns>TRUE if the locations are equals</returns>
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
if (obj == null)
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is Location location)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue