remove instanceof NullValues fixes #1313

This commit is contained in:
gnembon committed 2022-02-06 00:18:42 +01:00
1 parent 5c4e18ead1
commit 695b569977
11 files changed
+35 -30

No files matched your search

@@ -361,7 +361,7 @@ public class Auxiliary {
try
{
Value nameValue = lv.get(0);
name = nameValue instanceof NullValue ? "" : nameValue.getString();
name = nameValue.isNull() ? "" : nameValue.getString();
pointLocator = Vector3Argument.findIn(lv, 1, true, false);
if (lv.size()>pointLocator.offset)
{
@@ -248,7 +248,7 @@ public class Inventories {
Value nbtValue = lv.get(inventoryLocator.offset()+3);
if (nbtValue instanceof NBTSerializableValue)
nbt = ((NBTSerializableValue)nbtValue).getCompoundTag();
else if (nbtValue instanceof NullValue)
else if (nbtValue.isNull())
nbt = null;
else
nbt = new NBTSerializableValue(nbtValue.getString()).getCompoundTag();
@@ -277,7 +277,7 @@ public class Inventories {
if (lv.size() > inventoryLocator.offset())
{
Value secondArg = lv.get(inventoryLocator.offset()+0);
if (!(secondArg instanceof NullValue))
if (!secondArg.isNull())
itemArg = NBTSerializableValue.parseItem(secondArg.getString());
}
int startIndex = 0;
@@ -231,7 +231,7 @@ public class Scoreboards {
int slot = Scoreboard.getDisplaySlotByName(location);
if (slot < 0) throw new InternalExpressionException("Invalid objective slot: "+location);
Value target = lv.get(1);
if (target instanceof NullValue)
if (target.isNull())
{
scoreboard.setDisplayObjective(slot, null);
return new NumericValue(slot);
@@ -820,7 +820,7 @@ public class WorldAccess {
{
if (!playerBreak) throw new InternalExpressionException("tag is not necessary with 'destroy' with no item");
Value tagValue = lv.get(locator.offset+1);
if (tagValue instanceof NullValue)
if (tagValue.isNull())
tag = null;
else if (tagValue instanceof NBTSerializableValue)
tag = ((NBTSerializableValue) tagValue).getCompoundTag();
@@ -1294,7 +1294,7 @@ public class WorldAccess {
if (lv.size() > locator.offset)
{
Value requested = lv.get(locator.offset+0);
if (!(requested instanceof NullValue))
if (!requested.isNull())
{
String reqString = requested.getString();
structure = Registry.STRUCTURE_FEATURE.getOptional(InputValidator.identifierOf(reqString))
@@ -1389,7 +1389,7 @@ public class WorldAccess {
return;
}
Value newValue = lv.get(locator.offset+1);
if (newValue instanceof NullValue) // remove structure
if (newValue.isNull()) // remove structure
{
StructureFeature<?> structure = configuredStructure.feature;
if (!structures.containsKey(structure))