Files
bworld/common/mod_api/content.ts
T
2026-11-12 20:41:13 -03:00

21 lines
1008 B
TypeScript

// SPDX-FileCopyrightText: 2026 Paula Wisnievski
// SPDX-License-Identifier: AGPL-3.0-or-later
// content scripts: blocks made in code, for content that's easier to generate than to write out file by file, like
// every block of every kind of rock. the server runs them while it loads mods, before anything else reads their data,
// and what they register becomes part of the mod's data just like its files: checked the same way, sent to players
// with the rest, and generated by worldgen workers. see docs/modding/gettingstarted/modfiles.md
import type { BlockJson } from "../mod_data.ts";
import type { ModInfo } from "./shared.ts";
export type { BlockJson };
export interface ContentContext {
readonly mod: ModInfo;
readonly blocks: {
// adds a block, what a blocks/ file holds under "block", checked the same way. only during setup, and only in
// the mod's own namespace. it's registered right after the mod's blocks/ files, in the order of the calls
register(block: BlockJson): void;
};
}