handle no arguments in modify

This commit is contained in:
gnembon committed 2019-10-30 01:54:21 -03:00
1 parent c9715c89ae
commit 1706fd41a8
1 file changed
+14 -1
@@ -420,8 +420,15 @@ public class EntityValue extends Value
{ {
if (!(featureModifiers.containsKey(what))) if (!(featureModifiers.containsKey(what)))
throw new InternalExpressionException("Unknown entity action: " + what); throw new InternalExpressionException("Unknown entity action: " + what);
try
{
featureModifiers.get(what).accept(entity, toWhat); featureModifiers.get(what).accept(entity, toWhat);
} }
catch (NullPointerException npe)
{
throw new InternalExpressionException("'modify' for '"+what+"' expects a value");
}
}
private static void updatePosition(Entity e, double x, double y, double z, float yaw, float pitch) private static void updatePosition(Entity e, double x, double y, double z, float yaw, float pitch)
{ {
@@ -732,7 +739,13 @@ public class EntityValue extends Value
} }
}); });
put("no_clip", (e, v) -> e.noClip = v.getBoolean()); put("no_clip", (e, v) ->
{
if (v == null)
e.noClip = true;
else
e.noClip = v.getBoolean();
});
// gamemode // gamemode
// spectate // spectate