refactor: use pattern matching for null checks (is null / is not null)

Convert remaining == null to is null and != null to is not null
across 17 files in CommandHandler/ArgumentType, StructuredComponents,
and DeclareCommands for idiomatic C# style.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-03-24 00:47:03 +00:00
parent c7bc25aa17
commit 94bf42710a
17 changed files with 33 additions and 33 deletions

View file

@ -44,7 +44,7 @@ public class BlockPredicateSubcomponent(DataTypes dataTypes, SubComponentRegistr
data.AddRange(DataTypes.GetBool(HasBlocks));
if (HasBlocks)
{
if(BlockSet == null)
if(BlockSet is null)
throw new ArgumentNullException($"Can not serialize a BlockPredicate when the BlockSet is empty but HasBlocks is true!");
data.AddRange(BlockSet.Serialize());
@ -54,7 +54,7 @@ public class BlockPredicateSubcomponent(DataTypes dataTypes, SubComponentRegistr
data.AddRange(DataTypes.GetBool(HasProperities));
if (HasProperities)
{
if(Properties == null || Properties.Count == 0)
if(Properties is null || Properties.Count == 0)
throw new ArgumentNullException($"Can not serialize a BlockPredicate when the Properties is empty but HasProperties is true!");
data.AddRange(DataTypes.GetVarInt(Properties.Count));
@ -66,7 +66,7 @@ public class BlockPredicateSubcomponent(DataTypes dataTypes, SubComponentRegistr
data.AddRange(DataTypes.GetBool(HasNbt));
if (HasNbt)
{
if(Nbt == null)
if(Nbt is null)
throw new ArgumentNullException($"Can not serialize a BlockPredicate when the Nbt is empty but HasNbt is true!");
data.AddRange(DataTypes.GetNbt(Nbt));

View file

@ -39,7 +39,7 @@ public class BlockSetSubcomponent(DataTypes dataTypes, SubComponentRegistry subC
if (Type == 0) return new Queue<byte>(data);
if(BlockIds == null || BlockIds.Count == 0)
if(BlockIds is null || BlockIds.Count == 0)
throw new ArgumentNullException($"Can not serialize an empty list of Block IDs in a Block Set when the type is not 0!");
for(var i = 0; i < Type - 1; i++)

View file

@ -47,12 +47,12 @@ public class PropertySubComponent(DataTypes dataTypes, SubComponentRegistry subC
}
else
{
data.AddRange(DataTypes.GetBool(MinValue != null));
if (MinValue != null)
data.AddRange(DataTypes.GetBool(MinValue is not null));
if (MinValue is not null)
data.AddRange(DataTypes.GetString(MinValue));
data.AddRange(DataTypes.GetBool(MaxValue != null));
if (MaxValue != null)
data.AddRange(DataTypes.GetBool(MaxValue is not null));
if (MaxValue is not null)
data.AddRange(DataTypes.GetString(MaxValue));
}