35a89eaebe
Server mods get interface world: get-block(dimension, x, y, z) reads a
loaded chunk's block state as "minecraft:oak_log[axis=y]", get-biome its
biome ("minecraft:plains"), and
set-blocks(dimension, changes) sets up to 4096 blocks per call, checked at
once, made as /setblock makes them (place_state: neighbours, light, block
entities, every client told through the block log) after the call, before
that dimension's next tick.
Reads cost no copy: for a mod call the game lends Mods the levels' chunk
maps (moved out with mem::take and put back after), only while a running
mod has world. Writes for a level that isn't ticking (another dimension,
in-frame) wait for it, up to 65,536.
Test scripts get blocks (setup) and expect.blocks; cargo horizon-mod check
reports a trial run's block writes. Example beacons: /beacon builds a
glowstone pillar beside the player, /ground reads the block underfoot and the biome.
parse_state is now a free function so the mod path shares it.
Docs: docs/mods.md (the capability, script keys), docs/api/mods.md and the
regenerated reference.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
23 lines
787 B
TOML
23 lines
787 B
TOML
# /ground reads the block under the player and the biome; /beacon sets four blocks of glowstone two to the east.
|
|
|
|
[[step]]
|
|
join = "Alex"
|
|
blocks = [{ x = 0, y = 63, z = 0, state = "minecraft:grass_block[snowy=false]" }]
|
|
command = "ground"
|
|
expect.feedback = "You are standing on minecraft:grass_block[snowy=false] in minecraft:plains"
|
|
|
|
[[step]]
|
|
command = "beacon"
|
|
expect.broadcast = ["Alex lit a beacon at 2 64 0"]
|
|
expect.blocks = [
|
|
{ x = 2, y = 64, z = 0, state = "minecraft:glowstone" },
|
|
{ x = 2, y = 67, z = 0, state = "minecraft:glowstone" },
|
|
{ x = 2, y = 68, z = 0, state = "minecraft:air" },
|
|
]
|
|
|
|
# Anywhere the script set nothing is air.
|
|
[[step]]
|
|
player = { x = 10.5, z = 10.5 }
|
|
command = "ground"
|
|
expect.feedback = "You are standing on minecraft:air in minecraft:plains"
|