# Buildings (builder)
Houses, arenas, lobbies, decor and improving an existing map with the build tool `<JMVCC>/builder`. Open before building anything bigger than a few blocks.

> The builder (`builder/`) is not in the public jmvcc build yet. Without it, build in game code in small parts and check each with `jmvcc client shot`; the rules below are for when you have the builder.

Houses, arenas, lobbies, decor — do NOT improvise them with set_block in game code. Write a build script and let the
tool check it: `examples/x.build.mjs` exports `build(b)` with `b.set/fill/hollow/walls/line/sphere/cylinder`,
`b.rotate/mirror/symmetric/repeat/copy` (rotation also turns facing/axis/stairs shapes) and full block states
(`"oak_stairs[facing=east,half=top]"`, `"lantern[hanging=true]"` under `"iron_chain[axis=y]"`, open/closed trapdoors).
- `node builder/cli.mjs build x.build.mjs` — every state checked against the registry, plus physics warnings: no
  support (torches, lanterns, doors, plants), grass / dirt_path under a block turns into dirt in the world, gravity
  blocks in the bottom layer fall when placed in the air (verified, server-check-37).
- `screenshot x.build.mjs --angle iso` (and 2 more angles) — look at your build before showing it; `preview` —
  live 3D for you (real game models and textures, rotates with the mouse, reloads on save).
- Standing banners, `rotation` (owner's rule, checked in game; banners kept facing the wrong way): the picture faces
  north at 0, east 4, south 8, west 12; in-between values point in between (2 = north-east, 7 = between south-east
  and south), 22.5° per step clockwise from above. Not 0..3 like facing. On a wall: `*_wall_banner[facing=...]`.
- Heads with a skin as decor (bags of gold, barrels, food, small chests — sparingly, where a block cannot say it):
  `b.set(x, y, z, 'player_head[rotation=4]', { head: '<value>' })`, on a wall `player_wall_head[facing=east]`
  (facing = where the face looks). Rotation like banners (checked in game): face north at 0, east 4, south 8, west 12.
  value = the skin from `jmvcc client items` / `client render` (also accepts the item_raw "H4sI…" or the texture hash).
  `export-jc` adds `world::set_player_head(loc, value, "VALUE")` after the blocks; the viewer draws the skin.
  With the mod find heads yourself in /hdb (topic rpc-bridge «Heads from /hdb»); without it ask the player.
- `states <block>` — allowed properties; GUIDE.md has the detailing cookbook (which way stairs/trapdoors face, roof
  corners, shutters, lamp posts).
- `export-jc x.build.mjs --at X,Y,Z` → a .jc module (set_block with state text, ≤3000 places per call, spread over
  ticks within the CPU budget): `import "x"` and call `build_<name>()`.
- Minecraft not found (other machine): `--minecraft <game folder or .jar>` or env `JMVCC_MINECRAFT`.
- Improve an EXISTING map: `jmvcc client export -- x1 y1 z1 x2 y2 z2 --name map` (the owner in /build or /play near
  the region — in /dev the client sees the code area; blocks with states from the client's chunks, no chest contents /
  sign text) → `stats map.json` → script `const m = b.load('map.json'); m.inWorld((w) => w.set(x, y, z, ...))` (world
  coordinates as in F3) → screenshot / preview → `export-jc script` places ONLY the difference (changed / added /
  removed → air) at the export's world position. Delete a block from the world with `'air'`, not `b.remove`.
  builder/GUIDE.md «Improving an existing map».
