diff --git a/src/main/java/carpet/script/CarpetExpression.java b/src/main/java/carpet/script/CarpetExpression.java index 4990c1b4..e12fae08 100644 --- a/src/main/java/carpet/script/CarpetExpression.java +++ b/src/main/java/carpet/script/CarpetExpression.java @@ -2244,9 +2244,12 @@ public class CarpetExpression *

modify(e, 'accelerate', x, y, z), modify(e, 'accelerate', l(x, y, z) )

*

Adds a vector to the motion vector. Most realistic way to apply a force to an entity.

*

modify(e, 'custom_name'), modify(e, 'custom_name', name )

- *

modify(e, 'pickup_delay')

- *

modify(e, 'breeding_age')

- *

modify(e, 'despawn_timer')

+ *

modify(e, 'age', number)

+ *

Modifies entity's internal age counter. Fiddling with this will affect directly + * behaviours of complex entities, so use it with caution.

+ *

modify(e, 'pickup_delay', number)

+ *

modify(e, 'breeding_age', number)

+ *

modify(e, 'despawn_timer', number)

*

Sets a custom despawn timer value.

*

modify(e, 'dismount')

*

Dismounts riding entity.

diff --git a/src/main/java/carpet/script/value/EntityValue.java b/src/main/java/carpet/script/value/EntityValue.java index f3a39475..289032d2 100644 --- a/src/main/java/carpet/script/value/EntityValue.java +++ b/src/main/java/carpet/script/value/EntityValue.java @@ -517,6 +517,7 @@ public class EntityValue extends Value private static final Map> featureModifiers = new HashMap>() {{ put("remove", (entity, value) -> entity.remove()); + put("age", (e, v) -> e.age = Math.abs((int)NumericValue.asNumber(v).getLong()) ); put("health", (e, v) -> { if (e instanceof LivingEntity) ((LivingEntity) e).setHealth((float) NumericValue.asNumber(v).getDouble()); }); put("kill", (e, v) -> e.kill()); put("location", (e, v) ->