added view_distance to API
This commit is contained in:
1 parent
681d6ec9ee
commit
a7cd2c49cc
5 files changed
+14
-1
No files matched your search
@@ -3351,6 +3351,9 @@ Evaluates the expression `expr` with different dimension execution context. `smt
|
|||||||
world-localized block, so not `block('stone')`, or a string representing a dimension like:
|
world-localized block, so not `block('stone')`, or a string representing a dimension like:
|
||||||
`'nether'`, `'the_nether'`, `'end'` or `'overworld'`, etc.
|
`'nether'`, `'the_nether'`, `'end'` or `'overworld'`, etc.
|
||||||
|
|
||||||
|
### `view_distance()`
|
||||||
|
Returns the view distance of the server.
|
||||||
|
|
||||||
### `schedule(delay, function, args...)`
|
### `schedule(delay, function, args...)`
|
||||||
|
|
||||||
Schedules a user defined function to run with a specified `delay` ticks of delay. Scheduled functions run at the end
|
Schedules a user defined function to run with a specified `delay` ticks of delay. Scheduled functions run at the end
|
||||||
|
|||||||
@@ -259,6 +259,9 @@ Evaluates the expression `expr` with different dimension execution context. `smt
|
|||||||
world-localized block, so not `block('stone')`, or a string representing a dimension like:
|
world-localized block, so not `block('stone')`, or a string representing a dimension like:
|
||||||
`'nether'`, `'the_nether'`, `'end'` or `'overworld'`, etc.
|
`'nether'`, `'the_nether'`, `'end'` or `'overworld'`, etc.
|
||||||
|
|
||||||
|
### `view_distance()`
|
||||||
|
Returns the view distance of the server.
|
||||||
|
|
||||||
### `schedule(delay, function, args...)`
|
### `schedule(delay, function, args...)`
|
||||||
|
|
||||||
Schedules a user defined function to run with a specified `delay` ticks of delay. Scheduled functions run at the end
|
Schedules a user defined function to run with a specified `delay` ticks of delay. Scheduled functions run at the end
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ ticks_randomly
|
|||||||
top
|
top
|
||||||
transparent
|
transparent
|
||||||
update
|
update
|
||||||
|
view_distance
|
||||||
volume
|
volume
|
||||||
without_updates
|
without_updates
|
||||||
world_time
|
world_time
|
||||||
@@ -68,7 +68,7 @@
|
|||||||
|
|
||||||
format logger sound particle particle_line particle_rect
|
format logger sound particle particle_line particle_rect
|
||||||
|
|
||||||
run save tick_time world_time day_time last_tick_times game_tick seed current_dimension in_dimension
|
run save tick_time world_time day_time last_tick_times game_tick seed current_dimension in_dimension view_distance
|
||||||
|
|
||||||
plop harvest destroy schedule nbt draw_shape create_marker remove_all_markers
|
plop harvest destroy schedule nbt draw_shape create_marker remove_all_markers
|
||||||
|
|
||||||
|
|||||||
@@ -2968,6 +2968,12 @@ public class CarpetExpression
|
|||||||
return (cc, tt) -> retval;
|
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) -> {
|
this.expr.addLazyFunction("in_dimension", 2, (c, t, lv) -> {
|
||||||
ServerCommandSource outerSource = ((CarpetContext)c).s;
|
ServerCommandSource outerSource = ((CarpetContext)c).s;
|
||||||
Value dimensionValue = lv.get(0).evalValue(c);
|
Value dimensionValue = lv.get(0).evalValue(c);
|
||||||
|
|||||||
Reference in new issue
Block a user