Files
bworld/MODS.md
T
2026-09-30 13:41:29 -03:00

3.8 KiB

Making bworld Mods

Mods add blocks, items, entities, recipes, world generation, game logic and screens to bworld. A mod is installed on the server. Players who join download its client code, data and textures from that server automatically, so they never install anything themselves.

The base game is a mod too: mods/bworld is written against the same API as any other mod, so anything it does, your mod can do, and it's the best place to look for examples.

A mod is mostly data: JSON files for blocks, items, recipes and entities, and PNG textures. Behavior comes from TypeScript scripts: a server script for game logic, a client script for what players see, and a worldgen script for terrain features.

deno task new-mod copper_tools "Copper Tools"   # a new mod in mods/copper_tools, from templates/mod
deno task check-mods                            # checks every mod in mods/
deno task build && deno task server             # packs the mods and starts a server with them

Documentation

Getting started

  • Getting Started: making, checking, running and testing a mod
  • Mod Files: the folder layout, manifest.json, scripts and .bmod files

Concepts

  • Sides: what runs on the server and what runs on players' clients
  • Registries: ids, namespaces and how mods load
  • Events: reacting to and cancelling what players do
  • Security: what servers and players trust

Blocks

  • Blocks: looks, mining, drops and placement
  • Block States: state bits, variants and facing
  • Block Components: giving blocks behavior from a server script
  • Tile Data: data kept for one block, and blocks that hold or show items
  • Crops: farming without writing code

Items

  • Items: items, item stacks and item components
  • Tools: tool types, tiers and durability
  • Food: hunger and saturation

Entities

  • Entities: animals, scripted entities and entity models
  • Players: the player API, health and hunger

Inventories

Resources

Everything else

API Types

The API types are the reference for everything scripts can call. Scripts import them as bworld/server, bworld/client and bworld/worldgen, and they live in common/mod_api/.

A few parts of those types aren't built yet and throw when used: forms, custom screens, HUD elements, keybinds and mod channels. docs/modding_plan.md covers those, what else is planned, and the design behind the mod API.