diff --git a/src/main/java/carpet/script/value/EntityValue.java b/src/main/java/carpet/script/value/EntityValue.java index 45be924e..68c3f14d 100644 --- a/src/main/java/carpet/script/value/EntityValue.java +++ b/src/main/java/carpet/script/value/EntityValue.java @@ -861,7 +861,10 @@ public class EntityValue extends Value if (!(e instanceof LivingEntity)) return; LivingEntity le = (LivingEntity)e; if (v == null) + { le.clearStatusEffects(); + return; + } else if (v instanceof ListValue) { List lv = ((ListValue) v).getItems(); @@ -895,6 +898,15 @@ public class EntityValue extends Value return; } } + else + { + String effectName = v.getString(); + StatusEffect effect = Registry.STATUS_EFFECT.get(new Identifier(effectName)); + if (effect == null) + throw new InternalExpressionException("Wrong effect name: "+effectName); + le.removeStatusEffect(effect); + return; + } throw new InternalExpressionException("'effect' needs either no arguments (clear) or effect name, duration, and optional amplifier, show particles and show icon"); });