Update modding docs

This commit is contained in:
2026-09-29 23:29:14 -03:00
parent f0cf4e4eeb
commit 1ac7a5c943
50 changed files with 2672 additions and 1924 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
// .bmod files: a built mod in one zip, what servers load from server_mods/ and send to players. see "Mod files" in
// MODS.md. the same code reads them on the server and in the browser, so it only works on bytes
// .bmod files: a built mod in one zip, what servers load from server_mods/ and send to players. see
// docs/modding/gettingstarted/modfiles.md. the same code reads them on the server and in the browser, so it only works on bytes
import { unzipSync, zipSync } from "fflate";
import type { ModelJson } from "./block_models.ts";
import { MAX_TEXTURE_SIZE } from "./constants.ts";
+1 -1
View File
@@ -1,5 +1,5 @@
// how the server streams the world to clients, like minecraft java since 1.20.2: whole chunks in batches around each
// player, and which chunks are in a player's view. see "Chunks" in MODS.md
// player, and which chunks are in a player's view. see "Chunk Streaming" in docs/modding_plan.md
import { deflateSync, inflateSync } from "fflate";
import { CHUNK_AREA, CHUNK_HEIGHT } from "./constants.ts";
+1 -1
View File
@@ -1,6 +1,6 @@
// commands the way minecraft's brigadier (and so fabric's command api) does them: a tree of literal words and typed
// arguments, each argument type parsing its text and suggesting what could go there. the server runs them, and players
// get its suggestions as they type. see "Commands" in MODS.md
// get its suggestions as they type. see docs/modding/misc/commands.md
import { EverythingRegistry } from "./everything_registry.ts";
export interface Suggestion {
+1 -1
View File
@@ -19,7 +19,7 @@ const BASE_ORES: OreJson[] = [
{ id: "bworld:gold_ore", replaces: "bworld:stone", min_y: 5, max_y: 36, scale: 0.04, threshold: 0.7 },
];
// what mods add to generation, see "World generation" in MODS.md
// what mods add to generation, see docs/modding/worldgen/index.md
export interface WorldgenSetup {
ores: OreJson[];
features: { id: string; generate: (chunk: FeatureChunk) => void }[];
+2 -2
View File
@@ -1,4 +1,4 @@
// what client scripts get, see "Client scripts" and "GUIs" in MODS.md
// what client scripts get, see docs/modding/gui/index.md
import type { Id, ItemStack, KeyCode, ModInfo, Position } from "./shared.ts";
export type { Id, ItemStack, KeyCode, ModInfo, Position } from "./shared.ts";
@@ -25,7 +25,7 @@ export interface ClientContext {
// the mod that registered it
mod(id: Id): string;
};
// every recipe as its json (see Recipes in MODS.md), including mods' own types, in load order. copies
// every recipe as its json (see docs/modding/resources/recipes.md), including mods' own types, in load order. copies
recipes: {
// deno-lint-ignore no-explicit-any
list(type?: Id): any[];
+2 -2
View File
@@ -1,4 +1,4 @@
// what server scripts get, see "Server scripts" in MODS.md
// what server scripts get, see docs/modding/
import type { EventSignal, Face, Id, ItemStack, ModInfo, Position } from "./shared.ts";
import type { ArgumentType, CommandNode } from "../commands.ts";
@@ -61,7 +61,7 @@ export interface ComponentRegistry {
register_item<P>(id: Id, component: ItemComponent<P>): void;
}
// commands, fabric's (brigadier's) way: see common/commands.ts and "Commands" in MODS.md
// commands, fabric's (brigadier's) way: see common/commands.ts and docs/modding/misc/commands.md
// who ran a command
export interface CommandSource {
+1 -1
View File
@@ -1,4 +1,4 @@
// what worldgen scripts get, see "World generation" in MODS.md. runs in chunk workers and must be deterministic
// what worldgen scripts get, see docs/modding/worldgen/index.md. runs on the server and must be deterministic
import type { Id } from "./shared.ts";
export type { Id } from "./shared.ts";
+1 -1
View File
@@ -1,4 +1,4 @@
// the json formats from MODS.md, and converting them to and from the engine's registry entries.
// the json formats from docs/modding/, and converting them to and from the engine's registry entries.
// the mod loader uses the from_json direction, tests use both to check nothing is lost
import { is_tint_color, type TintColor } from "./worldgen/biome_colors.ts";
import {
+1 -1
View File
@@ -102,7 +102,7 @@ export type ClientMessage =
| { type: "suggest"; id: number; text: string };
export type ServerMessage =
// what to download before joining, see "Delivery to clients" in MODS.md
// what to download before joining, see docs/modding/networking/index.md
| {
type: "welcome";
protocol: number;
+1 -1
View File
@@ -21,7 +21,7 @@ export async function load_worldgen(scripts: { mod: string; url: string }[], ore
register_terrain(id) {
throw new ModLoadError(
mod,
`can't register terrain ${id}: the base terrain is still built into the engine (phase 3 in MODS.md)`,
`can't register terrain ${id}: the base terrain is still built into the engine (see docs/modding_plan.md)`,
);
},
};