Rename bmod to just mod

This commit is contained in:
2026-11-04 22:07:45 -03:00
parent fe0d857021
commit 5baaf0239a
33 changed files with 253 additions and 253 deletions
+1 -1
View File
@@ -34,5 +34,5 @@ from:
Mod code from that server runs with _the page's_ origin, including its local storage. So the client lists the server's
mods and asks before loading anything, and remembers the answer per server and mod.
Every `.bmod` a client downloads is checked against the SHA-256 the server listed, and scripts are run from the checked
Every `.cubi` a client downloads is checked against the SHA-256 the server listed, and scripts are run from the checked
bytes. That guarantees the files are the ones the server listed. It doesn't protect against a malicious server.
+4 -4
View File
@@ -50,11 +50,11 @@ Folders in `mods/` starting with `_` or `.` are skipped, which is handy for park
## Building and Running
```sh
deno task build # packs every mod in mods/ into server_mods/<id>.bmod, and builds the client
deno task server # starts a server with every .bmod in server_mods/
deno task build # packs every mod in mods/ into server_mods/<id>.cubi, and builds the client
deno task server # starts a server with every .cubi in server_mods/
```
`build` refuses to pack a mod that has errors. The server checks every `.bmod` again when it starts, and a problem in
`build` refuses to pack a mod that has errors. The server checks every `.cubi` again when it starts, and a problem in
any mod stops it from starting, naming the mod and what's wrong. The game never runs with some mods missing.
Open the server's address in a browser to play. To try a change, rebuild and restart the server, then rejoin. Leaving a
@@ -101,6 +101,6 @@ Deno.test("a hoe turns grass into farmland", async () => {
## Next Steps
- [Mod Files](modfiles.md): the manifest, the folder layout, and `.bmod` files.
- [Mod Files](modfiles.md): the manifest, the folder layout, and `.cubi` files.
- [Sides](../concepts/sides.md): which script runs where, and why it matters.
- [Blocks](../blocks/index.md) and [Items](../items/index.md): most mods start here.
+6 -6
View File
@@ -1,7 +1,7 @@
# Mod Files
A mod is a folder with a `manifest.json`, some data files, textures, and up to four scripts. The build packs it into a
single `.bmod` file, which is what servers load.
single `.cubi` file, which is what servers load.
## Layout
@@ -109,18 +109,18 @@ this repository. That config maps the API types, which scripts import as `cubi/s
import type { ServerContext } from "cubi/server";
```
## `.bmod` Files
## `.cubi` Files
A `.bmod` is a built mod in one zip file. Servers load every `.bmod` in their `server_mods/` folder, so installing a mod
A `.cubi` is a built mod in one zip file. Servers load every `.cubi` in their `server_mods/` folder, so installing a mod
on a server is dropping its file there and restarting.
```sh
deno task pack-mod mods/copper_tools # writes copper_tools.bmod, to share
deno task pack-mod mods/copper_tools # writes copper_tools.cubi, to share
deno task build # packs every mod in mods/ into server_mods/
```
```
copper_tools.bmod
copper_tools.cubi
manifest.json # with scripts and credits pointing into the zip
data.json # every block, model, item, entity, recipe, ore, tag and loot table, and the config
scripts/server.js # each script bundled into one module
@@ -134,7 +134,7 @@ copper_tools.bmod
- Packing checks the mod first, like `check-mods`, and refuses one with errors.
- Packing the same mod twice gives the same bytes, so the file only changes when the mod does.
- `deno task build` leaves other `.bmod` files in `server_mods/` alone, so mods from elsewhere can sit next to the ones
- `deno task build` leaves other `.cubi` files in `server_mods/` alone, so mods from elsewhere can sit next to the ones
it builds.
- Players get a copy **without** `scripts/server.js`, `scripts/worldgen.js` and the config. See
[Networking](../networking/index.md).
+1 -1
View File
@@ -15,7 +15,7 @@ Prefer the Game API. Many mods hooking the same thing is a sign it should become
`game_version` has to be one minor version: `~0.1.0` (0.1.0 and later 0.1 patches) or an exact `0.1.2`. Loading the mod
on another version is a load error, so the server doesn't start with it.
Without `engine_access`, importing `cubi/engine` is an error in `check-mods`, when a `.bmod` loads, and when the script
Without `engine_access`, importing `cubi/engine` is an error in `check-mods`, when a `.cubi` loads, and when the script
runs. When players join from another site, the confirm screen marks mods that change the engine.
## Hooking
+3 -3
View File
@@ -13,7 +13,7 @@ client server
│◄────────────────────────────────────────┤
│ │
│ [another site: confirm screen] │
│ download every .bmod, check each one's │
│ download every .cubi, check each one's │
│ sha256, build the texture atlas, load │
│ data in the listed order, run client │
│ scripts' setup, start chunk workers │
@@ -28,9 +28,9 @@ client server
```
- The client loads mods **in the order the server lists them**, so both sides register the same content the same way.
- Every `.bmod` is checked against its SHA-256 before it's opened, and scripts run from the checked bytes, so what runs
- Every `.cubi` is checked against its SHA-256 before it's opened, and scripts run from the checked bytes, so what runs
is exactly what the server listed.
- Players get each mod's `.bmod` **without its server and worldgen scripts**. The server makes that copy when it starts,
- Players get each mod's `.cubi` **without its server and worldgen scripts**. The server makes that copy when it starts,
named by its hash so it can be cached forever.
- If any download, hash check or client `setup` fails, the client disconnects and says which mod failed. It never joins
with some mods missing.
+1 -1
View File
@@ -75,5 +75,5 @@ The engine's own textures use the `engine` namespace and come from `assets/`, no
## How Players Get Them
Textures go in the mod's `.bmod`. When a player joins, their client puts every mod's textures into one atlas. The server
Textures go in the mod's `.cubi`. When a player joins, their client puts every mod's textures into one atlas. The server
never decodes images.
+1 -1
View File
@@ -9,7 +9,7 @@ generator, and a **biome source** picks biomes. The names and fields follow Mine
the [Minecraft Wiki](https://minecraft.wiki/w/Density_function) explains most of them. Where bworld differs, it says so
below.
These files are server only: they're left out of the copy of a `.bmod` players download.
These files are server only: they're left out of the copy of a `.cubi` players download.
```
my_mod/
+3 -3
View File
@@ -23,7 +23,7 @@ A mod is built from up to three layers. Most mods only need the first one or two
## Status
**Built:** the mod loader and `.bmod` files (packing, loading from `server_mods/`, sending players a copy without the
**Built:** the mod loader and `.cubi` files (packing, loading from `server_mods/`, sending players a copy without the
server and worldgen scripts), delivery to clients (hashed downloads, the confirm screen for other sites, credits), the
data layer (blocks, block models with variants, items, recipes including mods' own types, entities and entity models,
ores), server scripts (components, events, commands, timers, storage, recipes, containers, displayed items), menus like
@@ -34,8 +34,8 @@ and screens as a mod, world time, and worn items (an item's `worn` model, `playe
drawn on other players and on the first person arm). See [Menus](modding/inventories/menus.md),
[Screens](modding/gui/index.md) and [Worn Models](modding/items/index.md#worn-models).
The code is in `common/mod_loader.ts`, `common/mod_data.ts`, `common/mod_check.ts`, `common/bmod.ts`,
`server/game/mod_runtime.ts`, `server/game/menu.ts`, `server/load_bmods.ts`, `client/mods.ts`, `client/menu.ts`,
The code is in `common/mod_loader.ts`, `common/mod_data.ts`, `common/mod_check.ts`, `common/mod.ts`,
`server/game/mod_runtime.ts`, `server/game/menu.ts`, `server/load_mods.ts`, `client/mods.ts`, `client/menu.ts`,
`common/worldgen_loader.ts`, and for worn items `client/rendering/worn_renderer.ts`, `player_model.ts` and
`model_math.ts`.