despawn timer for living entities
This commit is contained in:
1 parent
f61976f039
commit
33812fc88a
2 files changed
+14
-1
No files matched your search
@@ -1612,6 +1612,8 @@ public class CarpetExpression
|
||||
* <p>Eye height of the entity.</p>
|
||||
* <h3><code>query(e,'age')</code></h3>
|
||||
* <p>Age, in ticks, of the entity, i.e. how long it existed.</p>
|
||||
* <h3><code>query(e,'despawn_timer')</code></h3>
|
||||
* <p>For living entities - the number of ticks they fall outside of immediate player presence.</p>
|
||||
* <h3><code>query(e,'item')</code></h3>
|
||||
* <p>The item triple (name, count, nbt) if its an item entity, <code>null</code> otherwise</p>
|
||||
* <h3><code>query(e,'count')</code></h3>
|
||||
@@ -1707,8 +1709,10 @@ public class CarpetExpression
|
||||
* <h3><code>modify(e, 'accelerate', x, y, z), modify(e, 'accelerate', l(x, y, z) )</code></h3>
|
||||
* <p>Adds a vector to the motion vector. Most realistic way to apply a force to an entity.</p>
|
||||
* <h3><code>modify(e, 'custom_name'), modify(e, 'custom_name', name )</code></h3>
|
||||
* <h3><code>modify(e,'pickup_delay')</code></h3>
|
||||
* <h3><code>modify(e, 'pickup_delay')</code></h3>
|
||||
* <p>Sets a custom pickup delay if the entity argument is an item entity</p>
|
||||
* <h3><code>modify(e, 'despawn_timer')</code></h3>
|
||||
* <p>Sets a custom despawn timer value.</p>
|
||||
* <h3><code>modify(e, 'dismount')</code></h3>
|
||||
* <p>Dismounts riding entity.</p>
|
||||
* <h3><code>modify(e, 'mount', other)</code></h3>
|
||||
|
||||
@@ -225,6 +225,7 @@ public class EntityValue extends Value
|
||||
put("width", (e, a) -> new NumericValue(e.getDimensions(EntityPose.STANDING).width));
|
||||
put("eye_height", (e, a) -> new NumericValue(e.getEyeHeight(EntityPose.STANDING)));
|
||||
put("age", (e, a) -> new NumericValue(e.age));
|
||||
put("despawn_timer", (e, a) -> e instanceof LivingEntity?new NumericValue(((LivingEntity) e).getDespawnCounter()):Value.NULL);
|
||||
put("item", (e, a) -> (e instanceof ItemEntity)?ListValue.fromItemStack(((ItemEntity) e).getStack()):Value.NULL);
|
||||
put("count", (e, a) -> (e instanceof ItemEntity)?new NumericValue(((ItemEntity) e).getStack().getCount()):Value.NULL);
|
||||
put("pickup_delay", (e, a) -> (e instanceof ItemEntity)?new NumericValue(((ItemEntityInterface) e).getPickupDelay()):Value.NULL);
|
||||
@@ -732,6 +733,14 @@ public class EntityValue extends Value
|
||||
}
|
||||
});
|
||||
|
||||
put("despawn_timer", (e, v) ->
|
||||
{
|
||||
if (e instanceof LivingEntity)
|
||||
{
|
||||
((LivingEntity) e).setDespawnCounter((int)NumericValue.asNumber(v).getLong());
|
||||
}
|
||||
});
|
||||
|
||||
put("ai", (e, v) ->
|
||||
{
|
||||
if (e instanceof MobEntity)
|
||||
|
||||
Reference in new issue
Block a user