added view_distance to API

This commit is contained in:
gnembon committed 2020-06-02 18:44:23 -03:00
1 parent 681d6ec9ee
commit a7cd2c49cc
5 files changed
+14 -1

No files matched your search

@@ -2968,6 +2968,12 @@ public class CarpetExpression
return (cc, tt) -> retval;
});
this.expr.addLazyFunction("view_distance", 0, (c, t, lv) -> {
ServerCommandSource s = ((CarpetContext)c).s;
Value retval = new NumericValue(s.getMinecraftServer().getPlayerManager().getViewDistance());
return (cc, tt) -> retval;
});
this.expr.addLazyFunction("in_dimension", 2, (c, t, lv) -> {
ServerCommandSource outerSource = ((CarpetContext)c).s;
Value dimensionValue = lv.get(0).evalValue(c);