3.7 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.bmodfiles
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
Inventories
- Containers: slots the server owns and saves
- Container Screens: showing containers to players
Resources
- Textures
- Block Models
- Recipes: crafting, smelting, smithing and your own recipe types
Everything else
- World Generation: ores and features
- Screens: inventory overlays and drawing with
Graphics - Networking: how players get mods and the world
- Saving Data: where a mod keeps what should last
- Commands
- Time: ticks, timers, days and nights
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.