no-bs world height info
This commit is contained in:
1 parent
6c776b6131
commit
1cefef82f7
2 files changed
+13
-32
No files matched your search
@@ -697,10 +697,11 @@ Available options in the scarpet app space:
|
||||
* `world_gamerules` - returns all gamerules in a map form (`rule`->`value`). Like carpet rules, values are returned as strings, so you can use appropriate value conversions using `bool()` or `number()` to convert them to other values. Gamerules are read-only to discourage app programmers to mess up with the settings intentionally applied by server admins. Isn't that just super annoying when a datapack messes up with your gamerule settings? It is still possible to change them though using `run('gamerule ...`.
|
||||
* `world_spawn_point` - world spawn point in the overworld dimension
|
||||
* `world_time` - Returns dimension-specific tick counter.
|
||||
* `world_max_y` - Returns all dimension's maximum y-values in a map form (`dimension` -> `max_y`). Values are numeric
|
||||
* `world_min_y` - Same as above, returning minimum y-values instead.
|
||||
* `world_border_info` - Returns all dimension's world border info in a map form (`dimension` -> `[[centre_pos], radius]`). Note that the y-value of `centre_pos` is always 0.
|
||||
|
||||
* `world_top` - Returns current dimensions' topmost Y value where one can place blocks.
|
||||
* `world_bottom` - Returns current dimensions' bottommost Y value where one can place blocks.
|
||||
* `world_center` - Returns coordinates of the center of the world with respect of the world border
|
||||
* `world_size` - Returns size of the world where at this distance from `world_center` world border appears.
|
||||
*
|
||||
Relevant gameplay related properties
|
||||
* `game_difficulty` - current difficulty of the game: `'peaceful'`, `'easy'`, `'normal'`, or `'hard'`
|
||||
* `game_hardcore` - boolean whether the game is in hardcore mode
|
||||
|
||||
@@ -65,36 +65,16 @@ public class SystemInfo {
|
||||
return ListValue.of(NumericValue.of(prop.getSpawnX()), NumericValue.of(prop.getSpawnY()), NumericValue.of(prop.getSpawnZ()));
|
||||
});
|
||||
|
||||
put("world_min_height", c-> {
|
||||
Map<Value, Value> dimMap = new HashMap<>();
|
||||
for (ServerWorld world : c.s.getServer().getWorlds()) {
|
||||
dimMap.put(ValueConversions.of(world.getRegistryKey().getValue()), new NumericValue(world.getBottomY()));
|
||||
}
|
||||
return MapValue.wrap(dimMap);
|
||||
put("world_bottom", c-> new NumericValue(c.s.getWorld().getBottomY()));
|
||||
|
||||
put("world_top", c-> new NumericValue(c.s.getWorld().getTopY()));
|
||||
|
||||
put("world_center", c-> {
|
||||
WorldBorder worldBorder = c.s.getWorld().getWorldBorder();
|
||||
return ListValue.fromTriple(worldBorder.getCenterX(), 0, worldBorder.getCenterZ());
|
||||
});
|
||||
|
||||
put("world_max_height", c-> {
|
||||
Map<Value, Value> dimMap = new HashMap<>();
|
||||
for (ServerWorld world : c.s.getServer().getWorlds()) {
|
||||
dimMap.put(ValueConversions.of(world.getRegistryKey().getValue()), new NumericValue(world.getLogicalHeight()));
|
||||
}
|
||||
return MapValue.wrap(dimMap);
|
||||
});
|
||||
|
||||
put("world_border_info", c-> {
|
||||
Map<Value, Value> dimMap = new HashMap<>();
|
||||
for (ServerWorld world : c.s.getServer().getWorlds()) {
|
||||
WorldBorder worldBorder = world.getWorldBorder();
|
||||
dimMap.put(
|
||||
ValueConversions.of(world.getRegistryKey().getValue()),
|
||||
ListValue.of(
|
||||
ListValue.fromTriple(worldBorder.getCenterX(), 0, worldBorder.getCenterZ()),
|
||||
new NumericValue(worldBorder.getMaxRadius())
|
||||
)
|
||||
);
|
||||
}
|
||||
return MapValue.wrap(dimMap);
|
||||
});
|
||||
put("world_size", c-> new NumericValue( c.s.getWorld().getWorldBorder().getMaxRadius()));
|
||||
|
||||
put("world_time", c -> new NumericValue(c.s.getWorld().getTime()));
|
||||
|
||||
|
||||
Reference in new issue
Block a user