AGPLv3 license
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// block models, in the shape of minecraft's block model json: boxes ("elements") with a texture per face.
|
||||
// a block picks one with "model" and fills in its texture variables with "textures". baking turns a model
|
||||
// into quads in block space (0 to 1) that the chunk mesher and the item renderers draw
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// the block rules shared scripts register (see BlockRules in mod_api/shared.ts), run the same way on the server and on
|
||||
// clients: what states a placed block gets, and how blocks change with the blocks beside them. each side has its own
|
||||
// BlockRules, with its own world: the server's is the real one, a client's is what it shows and guesses ahead with
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// a block's shape, like minecraft's VoxelShape: the boxes it's made of. it's what the player points at and what the
|
||||
// cracks are drawn on when it breaks (minecraft's getShape), and what entities bump into when it has collision
|
||||
// (getCollisionShape). blocks get theirs from the boxes of their model, or set "shape" like minecraft's Block.box
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import { EverythingRegistry } from "$/common/everything_registry.ts";
|
||||
|
||||
interface CropsRegistry {
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// .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";
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// 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 "Chunk Streaming" in docs/modding_plan.md
|
||||
import { deflateSync, inflateSync } from "fflate";
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// commands the way minecraft's brigadier (and so neoforge's commands) 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 docs/modding/misc/commands.md
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// the pixels across a block face or an item sprite. block models and item models are made in these units, a texture of
|
||||
// another size is stretched to fit
|
||||
export const TEXTURE_SIZE = 16;
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// what engine access mods get as engine.common, on every side. see docs/modding/misc/engine.md
|
||||
import { EverythingRegistry } from "./everything_registry.ts";
|
||||
import { Container, ContainerSlot, ItemStack } from "./inventory.ts";
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import type { TintColor } from "./worldgen/biome_colors.ts";
|
||||
import type { ItemStack } from "./inventory.ts";
|
||||
import type { BlockPart, BlockVariant } from "./block_models.ts";
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// generating a chunk: the terrain from the generator's data (common/worldgen), then ores, then mods' features.
|
||||
// only the server generates, players get finished chunks
|
||||
import { Alea } from "@paulaboks/rng";
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// engine access: hooks on the engine's own methods, like neoforge's mixins, and the global the bworld/engine shim reads.
|
||||
// see docs/modding/misc/engine.md and docs/modding_plan.md
|
||||
import { GAME_VERSION } from "./constants.ts";
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import { EverythingRegistry, ItemRegistry } from "$/common/everything_registry.ts";
|
||||
|
||||
// how item stacks are saved and sent over the network
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// loot tables, like minecraft's: what something gives when it's broken, killed, fished or opened, as data. a table
|
||||
// has pools, each rolled some number of times, each roll picking one of the pool's entries by weight. conditions
|
||||
// decide whether a table, pool or entry counts, functions change the items it gives. mods can add their own
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// what client scripts get, see docs/modding/gui/index.md
|
||||
import type { Id, ItemStack, KeyCode, ModInfo, Position, Season, TagApi } from "./shared.ts";
|
||||
import type { LootTableJson } from "../loot.ts";
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// bworld/engine: engine access, for what the game api doesn't cover yet. a mod needs "engine_access": true and a
|
||||
// game_version within one minor version in its manifest. see docs/modding/misc/engine.md
|
||||
//
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// what server scripts get, see docs/modding/
|
||||
import type { EventSignal, Face, Id, ItemStack, ModInfo, Position, Season, TagApi } from "./shared.ts";
|
||||
import type { ArgumentType, CommandNode } from "../commands.ts";
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// types every side of a mod shares. these are the api mods see, not the engine's own classes:
|
||||
// items are { id, count, data } here, like on the network
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// what worldgen scripts get, see docs/modding/worldgen/index.md. runs on the server and must be deterministic
|
||||
import type { Id, Position } from "./shared.ts";
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// checks between mods: dependencies, load order, and ids one mod uses from another. pure, so the build, check-mods
|
||||
// and the server (on .bmod files) all use it
|
||||
import {
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// 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";
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// registers mods' data, the same way on the server and on clients
|
||||
import { BlockRegistry, EverythingRegistry, ItemRegistry } from "./everything_registry.ts";
|
||||
import {
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// collision against blocks, shared by the client's entities and the server's, so both move things the same way
|
||||
import { TICK_DELTA } from "./constants.ts";
|
||||
import { COLLISION_TOP, EMPTY_SHAPE, FULL_SHAPE, type Shape } from "./block_shapes.ts";
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// messages sent between the client and the server, as json over a websocket. chunks are binary, see level_chunk
|
||||
import type { Faces } from "./constants.ts";
|
||||
import type { ItemData } from "./inventory.ts";
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// tags: named lists of blocks, items, entities or biomes that mods add to, like neoforge's. see docs/modding/resources/tags.md.
|
||||
// resolve_tags works them out from every mod's tag files, the same way on the server, clients and in check-mods
|
||||
import { TAG_REGISTRIES, type TagEntryJson, type TagJson, type TagRegistry } from "./mod_data.ts";
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// animated textures, like minecraft's .png.mcmeta and in the same format: textures/<name>.json next to
|
||||
// textures/<name>.png says how to cut the png into frames and how long each one shows. see docs/modding/resources/textures.md
|
||||
export interface TextureJson {
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// the day and night cycle. world time counts ticks since 06:00 of day 1, it never wraps around
|
||||
import { TICKS_PER_SECOND } from "./constants.ts";
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import { ID_MASK, STATE_SHIFT } from "./constants.ts";
|
||||
import { BlockRegistry, EverythingRegistry, ItemRegistry, liquid_height } from "./everything_registry.ts";
|
||||
import { block_item_texture, cube_face_texture } from "./block_models.ts";
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// what color each biome tints grass, leaves and water, as 0xRRGGBB, from its "colors" (see biomes.ts). blocks pick
|
||||
// them with "tint"
|
||||
import { get_biome } from "./biomes.ts";
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// biomes as data: worldgen/biomes/<name>.json in a mod, see docs/modding/worldgen/biomes.md. which biome a column
|
||||
// gets is the generator's biome rules (worldgen/biome_source), these say what a biome looks like once it's picked
|
||||
import { EverythingRegistry } from "../everything_registry.ts";
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// world generation as data: noises, density functions, noise settings (a generator) and biome sources, see
|
||||
// docs/modding/worldgen/terrain.md. checked here, compiled by density.ts and generator.ts. the names follow
|
||||
// minecraft's (density functions, the noise router, surface rules) where the idea is the same
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// compiles density functions (see data.ts) into plain closures, once per seed, so generating a chunk never reads json.
|
||||
// every operation is a pair, so it rounds exactly like the code it was written from: a world generated from the same
|
||||
// data is the same block for block. named functions that don't change with y are worked out once per column
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// data features: worldgen/features/<path>.json in a mod, a feature's type and config (what) with a list of placement
|
||||
// modifiers (where), see docs/modding/worldgen/index.md. like minecraft's configured and placed features joined into
|
||||
// one file. the types and modifiers here are built in, worldgen scripts register more
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// a generator: noise settings, and the density functions, noises and biome rules it uses. compiled once for each
|
||||
// seed, see OverworldTerrain. the data comes from mods' worldgen folders, see docs/modding/worldgen/terrain.md
|
||||
import { EverythingRegistry } from "../everything_registry.ts";
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// noise for world generation. everything is built from named noises, the same ones mods get through
|
||||
// FeatureChunk.noise_2d and noise_3d, so a generator using them gives the same world wherever it runs
|
||||
import { Alea, create_noise_2d, create_noise_3d, NoiseFunction2D, NoiseFunction3D } from "@paulaboks/rng";
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// fills a chunk with the overworld: the terrain's density sampled on a coarse grid and interpolated (minecraft's
|
||||
// noise cells), caves cut out of it, then each column's biome, its surface blocks and fluids. what all of it is comes
|
||||
// from the generator's noise settings, see OverworldTerrain and docs/modding/worldgen/terrain.md. trees and the rest
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// what solid blocks and empty space become, from the noise settings' surface_rule and fluids (see data.ts), compiled
|
||||
// for each chunk with its block ids. like minecraft's surface rules: a rule gives a block or nothing, and a sequence
|
||||
// gives its first rule's block
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// the shape of the world and which biome each column gets, from a generator's data (see generator.ts): its density
|
||||
// functions compiled for one seed. generate_overworld calls density and cave through here, so engine access mods can
|
||||
// hook them. bworld's overworld is shaped after tectonic (https://github.com/Apollounknowndev/tectonic, MIT), its
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// everything generating a chunk reads, as one plain object a worker can be sent: the seed, the generator, and each
|
||||
// mod's data generation needs with its worldgen script's url. loading it registers the data in this realm and loads
|
||||
// the scripts, which gives the same numeric block ids and the same generator as the game, so chunks come out the same
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// imports mods' worldgen scripts and collects what they and mods' data add to generation: the generator, ores, and
|
||||
// features, code and data, in the order they run. used by the game server
|
||||
import type { FeatureBiome, FeatureChunk, FeatureStep, WorldgenContext } from "$/common/mod_api/worldgen.ts";
|
||||
|
||||
Reference in New Issue
Block a user