simulatecraft.minecraft.world_settings¶
simulatecraft.minecraft.world_settings
¶
Persistent world settings: rules, boundaries, and imported Minecraft worlds.
Stored at data/world_settings.json (repo root). Applied to the live server
via RCON gamerules / time commands. World folders live under data/minecraft/.
CornerPin
¶
Bases: BaseModel
One world XZ corner of a square play border.
WorldBoundaries
¶
Bases: BaseModel
Square play area on the map (axis-aligned).
Drawn as a square on the viewer; physical border is vanilla worldborder.
Soft/hard enforce uses the same box.
WorldRules
¶
Bases: BaseModel
Server gamerules / time behaviour for simulations.
WorldImportInfo
¶
Bases: BaseModel
Metadata about the active imported / mounted world.
repo_root
¶
Locate the SimulateCraft repo root (has docker-compose.yml).
Source code in src/simulatecraft/minecraft/world_settings.py
barrier_wall_commands
¶
barrier_wall_commands(*, min_x: int, max_x: int, min_z: int, max_z: int, y_min: int, y_max: int, block: str = 'barrier') -> list[str]
Four vertical walls around an AABB (legacy fill clear only).
Source code in src/simulatecraft/minecraft/world_settings.py
barrier_clear_commands
¶
barrier_clear_commands(bounds: WorldBoundaries) -> list[str]
Best-effort clear of legacy fill-based barrier walls (pre-worldborder).
Per-cell air fills are intentionally NOT used — they are hundreds of RCON commands and extremely slow. We only clear old AABB rectangle walls (≤4 chunked fills). Leftover diagonal fill barriers from an older build may remain until removed manually or the world is reset.
Source code in src/simulatecraft/minecraft/world_settings.py
worldborder_commands_for_aabb
¶
worldborder_commands_for_aabb(*, min_x: float, max_x: float, min_z: float, max_z: float) -> list[str]
Vanilla worldborder covering the AABB (square; diameter = longer side).
Source code in src/simulatecraft/minecraft/world_settings.py
worldborder_disable_commands
¶
rcon_commands_for_boundaries
¶
rcon_commands_for_boundaries(bounds: WorldBoundaries, *, previous: WorldBoundaries | None = None) -> list[str]
Apply play area via worldborder (few cmds) — not per-block fills.
Optionally clears legacy fill-based walls from older SimulateCraft builds.
Source code in src/simulatecraft/minecraft/world_settings.py
apply_boundaries_via_rcon
¶
apply_boundaries_via_rcon(bounds: WorldBoundaries | None = None, *, previous: WorldBoundaries | None = None) -> tuple[list[str], WorldBoundaries]
Apply worldborder (and optional legacy clear); return results + metadata.
Source code in src/simulatecraft/minecraft/world_settings.py
rcon_commands_for_rules
¶
rcon_commands_for_rules(rules: WorldRules) -> list[str]
Build RCON commands that apply WorldRules to a live server.
Source code in src/simulatecraft/minecraft/world_settings.py
apply_rules_via_rcon
¶
apply_rules_via_rcon(rules: WorldRules | None = None) -> list[str]
Push current (or given) rules to Minecraft over RCON.
Source code in src/simulatecraft/minecraft/world_settings.py
ticks_to_add_per_second
¶
How many Minecraft time ticks to add each real second for a custom day length.
Source code in src/simulatecraft/minecraft/world_settings.py
find_level_dat
¶
Return path to level.dat under root (supports nested single folder).
Source code in src/simulatecraft/minecraft/world_settings.py
import_world_zip
¶
Extract a Minecraft world zip into data/minecraft/world and update settings.
The server must be restarted (docker compose down/up) for the new world to load.
Source code in src/simulatecraft/minecraft/world_settings.py
import_world_folder
¶
Copy an existing Java world folder into data/minecraft/world.
Source code in src/simulatecraft/minecraft/world_settings.py
prepare_random_world
¶
Wipe data/minecraft/world so Docker generates a new world with seed.