added hunger, saturation, and exhaustion entity API calls.

This commit is contained in:
gnembon committed 2020-06-07 18:53:17 -03:00
1 parent d9ed35676f
commit 73cb9d6968
4 files changed
+33 -11

No files matched your search

@@ -299,8 +299,7 @@ public class EntityValue extends Value
});
put("exhaustion",(e, a)->{
if(e instanceof PlayerEntity)
return new NumericValue(((HungerManagerInterface)((PlayerEntity) e).getHungerManager()).getExhaustion());
if(e instanceof PlayerEntity) return new NumericValue(((HungerManagerInterface)((PlayerEntity) e).getHungerManager()).getExhaustionCM());
return Value.NULL;
});
@@ -966,6 +965,10 @@ public class EntityValue extends Value
});
put("exhaustion", (e, v)-> {
if(e instanceof PlayerEntity) ((HungerManagerInterface) ((PlayerEntity) e).getHungerManager()).setExhaustionCM(NumericValue.asNumber(v).getFloat());
});
put("add_exhaustion", (e, v)-> {
if(e instanceof PlayerEntity) ((PlayerEntity) e).getHungerManager().addExhaustion((int) NumericValue.asNumber(v).getLong());
});