Loading schematics

This commit is contained in:
2026-11-15 19:54:08 -03:00
parent 6bb2c87373
commit 0564275f58
15 changed files with 142 additions and 17 deletions
+7 -3
View File
@@ -4,8 +4,8 @@ A schematic is a box of the world saved to a file: its blocks with their states
placed again somewhere else. Schematic files end in `.cbsm` and are [MessagePack](https://msgpack.org), see
`common/schematic.ts` for their format.
Exporting, registering and placing are built. Mods shipping their own as files, and blocks making what their data points
to when they're placed (`import_data`), are planned in `STRUCTURES.md`.
Exporting, registering and placing are built. Blocks making what their data points to when they're placed
(`import_data`) is planned in `STRUCTURES.md`.
## Exporting
@@ -35,7 +35,11 @@ Positions are from the box's lowest corner.
## Placing
A schematic is registered by id in the server phase, then placed by that id:
A mod's `schematics/<name>.cbsm` files are its schematics `<mod id>:<name>`, so an exported file can be dropped in as it
is. `check-mods` checks that every block and entity in them exists. They're registered before any script runs, so a
server phase can place them right away. Players never download them.
A script can also register one it made itself, by id in the server phase, then place it by that id:
```ts
ctx.schematics.register("copper_tools:hut", schematic);