Fix scarpet modify(e, 'effect', ...) (#587)

This commit is contained in:
KingOfTheClouds authored and GitHub committed 2020-11-28 21:21:21 -04:00
1 parent e78541e5b9
commit 1abe93f0dc
2 files changed
+8 -5

No files matched your search

+3 -3
View File
@@ -641,10 +641,10 @@ If called with `false` value, it will disable AI in the mob. `true` will enable
Sets if the entity obeys any collisions, including collisions with the terrain and basic physics. Not affecting Sets if the entity obeys any collisions, including collisions with the terrain and basic physics. Not affecting
players, since they are controlled client side. players, since they are controlled client side.
### `modify(e, 'effect', name?, duration?, amplifier?, show_particles?, show_icon?)` ### `modify(e, 'effect', name?, duration?, amplifier?, show_particles?, show_icon?, ambient?)`
Applies status effect to the living entity. Takes several optional parameters, which default to `0`, `true` Applies status effect to the living entity. Takes several optional parameters, which default to `0`, `true`,
and `true`. If no duration is specified, or if it's null or 0, the effect is removed. If name is not specified, `true` and `false`. If no duration is specified, or if it's null or 0, the effect is removed. If name is not specified,
it clears all effects. it clears all effects.
### `modify(e, 'home', null), modify(e, 'home', block, distance?), modify(e, 'home', x, y, z, distance?)` ### `modify(e, 'home', null), modify(e, 'home', block, distance?), modify(e, 'home', x, y, z, distance?)`
@@ -1256,7 +1256,10 @@ public class EntityValue extends Value
boolean showIcon = true; boolean showIcon = true;
if (lv.size() > 4) if (lv.size() > 4)
showIcon = lv.get(4).getBoolean(); showIcon = lv.get(4).getBoolean();
le.addStatusEffect(new StatusEffectInstance(effect, duration, amplifier, showParticles, showIcon)); boolean ambient = false;
if (lv.size() > 5)
showIcon = lv.get(5).getBoolean();
le.addStatusEffect(new StatusEffectInstance(effect, duration, amplifier, ambient, showParticles, showIcon));
return; return;
} }
} }
@@ -1269,7 +1272,7 @@ public class EntityValue extends Value
le.removeStatusEffect(effect); le.removeStatusEffect(effect);
return; return;
} }
throw new InternalExpressionException("'effect' needs either no arguments (clear) or effect name, duration, and optional amplifier, show particles and show icon"); throw new InternalExpressionException("'effect' needs either no arguments (clear) or effect name, duration, and optional amplifier, show particles, show icon and ambient");
}); });
put("gamemode", (e,v)->{ put("gamemode", (e,v)->{