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
@@ -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