diff --git a/docs/scarpet/Full.md b/docs/scarpet/Full.md index 3b944c5d..c6e69326 100644 --- a/docs/scarpet/Full.md +++ b/docs/scarpet/Full.md @@ -2729,6 +2729,17 @@ Will make the entity constantly jump if set to true, and will stop the entity fr Will make the entity jump once only +### `modify(e, 'silent', true/false)` + +### `modify(e, 'gravity', true/false)` + +### `modify(e, 'fire', ticks)` + +Will set mob on fire for `ticks` ticks. Set to 0 to extinguish. + +### `modify(e, 'age', age)` + + ## Entity Events There is a number of events that happen to entities that you can attach your own code to in the form of event handlers. diff --git a/docs/scarpet/api/Entities.md b/docs/scarpet/api/Entities.md index 65f69f51..659acc2a 100644 --- a/docs/scarpet/api/Entities.md +++ b/docs/scarpet/api/Entities.md @@ -464,7 +464,7 @@ Modifies gamemode of player to whatever string (case-insensitive) or number you * 2: adventure * 3: spectator -### `modify(e, 'jumping', true/false?)` +### `modify(e, 'jumping', true/false)` Will make the entity constantly jump if set to true, and will stop the entity from jumping if set to false. @@ -472,6 +472,16 @@ Will make the entity constantly jump if set to true, and will stop the entity fr Will make the entity jump once only +### `modify(e, 'silent', true/false)` + +### `modify(e, 'gravity', true/false)` + +### `modify(e, 'fire', ticks)` + +Will set mob on fire for `ticks` ticks. Set to 0 to extinguish. + +### `modify(e, 'age', age)` + ## Entity Events There is a number of events that happen to entities that you can attach your own code to in the form of event handlers. diff --git a/src/main/java/carpet/script/value/EntityValue.java b/src/main/java/carpet/script/value/EntityValue.java index be53b844..f09b6cd9 100644 --- a/src/main/java/carpet/script/value/EntityValue.java +++ b/src/main/java/carpet/script/value/EntityValue.java @@ -912,21 +912,41 @@ public class EntityValue extends Value ((LivingEntity) e).setJumping(v.getBoolean()); }); - put("jump",(e,v)->{//Most *REDACTED* up code in the world + put("jump",(e,v)->{ jump((LivingEntity)e); }); + put("silent",(e,v)->{ + e.setSilent(v.getBoolean()); + }); + + put("gravity",(e,v)->{ + e.setNoGravity(!v.getBoolean()); + }); + + put("invulnerable",(e,v)->{ + e.setInvulnerable(v.getBoolean()); + }); + + put("fire",(e,v)->{ + e.setFireTicks((int)NumericValue.asNumber(v).getLong()); + }); + + put("age",(e,v)->{ + e.age=(int)NumericValue.asNumber(v).getLong(); + }); + // gamemode [check] // spectate [check] - // "fire" [] - // "extinguish" [] - // "silent" [] - // "gravity" [] - // "invulnerable" [] + // "fire" [check] + // "extinguish" [set fire ticks to 0] + // "silent" [check] + // "gravity" [check] + // "invulnerable" [check] // "dimension" [] // "item" [] // "count", [] - // "age", [] + // "age", [check] // "effect_"name [] // "hold" [inventory_set?] // "hold_offhand" [inventory_set?]