92 lines
4.8 KiB
Markdown
92 lines
4.8 KiB
Markdown
# 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.
|
|
|
|
```sh
|
|
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](docs/modding/gettingstarted/index.md): making, checking, running and testing a mod
|
|
- [Mod Files](docs/modding/gettingstarted/modfiles.md): the folder layout, `manifest.json`, scripts and `.cubi` files
|
|
|
|
**Concepts**
|
|
|
|
- [Sides](docs/modding/concepts/sides.md): what runs on the server and what runs on players' clients
|
|
- [Registries](docs/modding/concepts/registries.md): ids, namespaces and how mods load
|
|
- [Events](docs/modding/concepts/events.md): reacting to and cancelling what players do
|
|
- [Security](docs/modding/concepts/security.md): what servers and players trust
|
|
|
|
**Blocks**
|
|
|
|
- [Blocks](docs/modding/blocks/index.md): looks, mining, drops and placement
|
|
- [Block States](docs/modding/blocks/states.md): state bits, variants and facing
|
|
- [Block Components](docs/modding/blocks/components.md): giving blocks behavior from a server script
|
|
- [Tile Data](docs/modding/blocks/tiledata.md): data kept for one block, the part clients see, and blocks that hold or
|
|
show items
|
|
- [Visuals](docs/modding/blocks/visuals.md): blocks drawn with code, like a shaft that turns or the items and fluid in a
|
|
machine
|
|
- [Crops](docs/modding/blocks/crops.md): farming without writing code
|
|
- [Verdigris](docs/modding/blocks/verdigris.md): blocks that make and use signals, like levers, torches and doors
|
|
|
|
**Items**
|
|
|
|
- [Items](docs/modding/items/index.md): items, item stacks and item components
|
|
- [Tools](docs/modding/items/tools.md): tool types, tiers and durability
|
|
- [Food](docs/modding/items/food.md): hunger and saturation
|
|
|
|
**Entities**
|
|
|
|
- [Entities](docs/modding/entities/index.md): animals, monsters, natural spawning, scripted entities and entity models
|
|
- [Players](docs/modding/entities/players.md): the player API, health and hunger
|
|
|
|
**Inventories**
|
|
|
|
- [Containers](docs/modding/inventories/containers.md): slots the server owns and saves
|
|
- [Menus](docs/modding/inventories/menus.md): slots, data and buttons on the server, and their screens
|
|
|
|
**Resources**
|
|
|
|
- [Textures](docs/modding/resources/textures.md)
|
|
- [Block Models](docs/modding/resources/models.md)
|
|
- [Recipes](docs/modding/resources/recipes.md): crafting, smelting, smithing, stonecutting and your own recipe types
|
|
- [Tags](docs/modding/resources/tags.md): lists of blocks, items or entities that every mod can add to
|
|
- [Loot Tables](docs/modding/resources/loot_tables.md): what blocks, mobs, fishing and chests give
|
|
- [Fluids](docs/modding/resources/fluids.md): fluids that can be held, apart from blocks that flow, and the fluid
|
|
handlers that tanks and containers are filled and drained through
|
|
|
|
**Everything else**
|
|
|
|
- [World Generation](docs/modding/worldgen/index.md): ores and features
|
|
- [Biomes](docs/modding/worldgen/biomes.md): surfaces, colors, trees and seasons
|
|
- [Screens](docs/modding/gui/index.md): plain screens, inventory overlays and drawing with `Graphics`
|
|
- [Networking](docs/modding/networking/index.md): how players get mods and the world
|
|
- [Saving Data](docs/modding/datastorage/index.md): where a mod keeps what should last
|
|
- [Config](docs/modding/misc/config.md): settings a server can change, like how fast a machine works
|
|
- [Commands](docs/modding/misc/commands.md)
|
|
- [Time](docs/modding/misc/time.md): ticks, timers, days and nights
|
|
- [Engine Access](docs/modding/misc/engine.md): reaching into the engine and hooking its methods, for what the API
|
|
doesn't cover yet
|
|
|
|
## API Types
|
|
|
|
The API types are the reference for everything scripts can call. Scripts import them as `cubi/server`, `cubi/client`,
|
|
`cubi/shared`, `cubi/worldgen` and `cubi/content`, and they live in [`common/mod_api/`](common/mod_api/).
|
|
|
|
A few parts of those types aren't built yet and throw when used: forms, custom screens, HUD elements and keybinds.
|
|
[`docs/modding_plan.md`](docs/modding_plan.md) covers those, what else is planned, and the design behind the mod API.
|