fixed incorrect recognition of some NULL objects

This commit is contained in:
gnembon committed 2020-09-28 22:17:29 -03:00
1 parent 9b35c19bea
commit d5ebe5361c
4 files changed
+5 -6

No files matched your search

@@ -1113,7 +1113,7 @@ public class EntityValue extends Value
put("breaking_progress", (e, a) -> {
if (e instanceof ServerPlayerEntity)
{
int progress = (a == null || a == Value.NULL)?-1:NumericValue.asNumber(a).getInt();
int progress = (a == null || a.isNull())?-1:NumericValue.asNumber(a).getInt();
ServerPlayerInteractionManagerInterface manager = (ServerPlayerInteractionManagerInterface) (((ServerPlayerEntity) e).interactionManager);
manager.setBlockBreakingProgress(progress);
}
@@ -380,7 +380,7 @@ public class ListValue extends AbstractListValue implements ContainerValueInterf
private boolean put(Value ind, Value value, boolean replace, boolean extend)
{
if (ind == Value.NULL)
if (ind.isNull())
{
if (extend && value instanceof AbstractListValue)
{
@@ -390,7 +390,6 @@ public class ListValue extends AbstractListValue implements ContainerValueInterf
{
items.add(value);
}
return true;
}
else
{
@@ -420,8 +419,8 @@ public class ListValue extends AbstractListValue implements ContainerValueInterf
return true;
}
items.add(index, value);
return true;
}
return true;
}
@Override
@@ -97,7 +97,7 @@ public class ValueConversions
public static Value fromTimedMemory(Entity e, long expiry, Object v)
{
Value ret = fromEntityMemory(e, v);
if (ret == Value.NULL || expiry == Long.MAX_VALUE) return ret;
if (ret.isNull() || expiry == Long.MAX_VALUE) return ret;
return ListValue.of(ret, new NumericValue(expiry));
}