AGPLv3 license
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import { Container, ItemStack } from "$/common/inventory.ts";
|
||||
import { CRAFTING_RESULT_SLOT } from "$/common/protocol.ts";
|
||||
import { choice_matches, type GridRecipe } from "$/common/mod_data.ts";
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// what engine access mods get as engine.server, in server scripts. see docs/modding/misc/engine.md
|
||||
import { GameServer } from "./game_server.ts";
|
||||
import { ServerWorld } from "./world.ts";
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// a living entity's stats, like minecraft's attributes: a base value that modifiers change without touching it.
|
||||
// numbers are minecraft's, so movement_speed is its per tick value, see LivingEntity.travel
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// status effects on living entities, like minecraft's MobEffect and MobEffectInstance. an effect is a type plus
|
||||
// how strong it is and for how long. a weaker one that lasts longer waits hidden under the stronger one, and takes
|
||||
// over when that runs out
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// the server's entities, like minecraft's Entity: things in the world that aren't blocks and move on their own. the
|
||||
// fields are minecraft's (see ENTITIES.md), without the ones for things the game doesn't have like portals and powder
|
||||
// snow. players are ServerPlayer, which isn't one of these (yet)
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// every entity in the world, and what each player's client knows about them. like minecraft's entity lookup plus
|
||||
// its ChunkMap's entity tracking: a player's client hears about the entities within their view distance, gets told
|
||||
// when those move or change, and forgets them when they leave it
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// every kind of entity by its type id, like minecraft's EntityType registry: how saved entities come back
|
||||
import type { Entity, EntityLevel, SavedEntity } from "./entity.ts";
|
||||
import { ITEM_ENTITY_TYPE, ItemEntity } from "./item_entity.ts";
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// what mobs decide to do, like minecraft's Goal and GoalSelector. each goal says when it wants to run and which
|
||||
// controls it needs (its flags), and the most important goals that can run get them. a lower priority number is
|
||||
// more important, and can take a flag from a less important goal that's running
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import { type ItemData, ItemStack } from "$/common/inventory.ts";
|
||||
import type { EntityInfo } from "$/common/protocol.ts";
|
||||
import { TICK_DELTA } from "$/common/constants.ts";
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// entities that live: health, attributes, status effects, equipment, breathing and dying, like minecraft's
|
||||
// LivingEntity. they walk with minecraft's physics, driven by forward, strafe and jumping (see travel), which is what
|
||||
// a mob's AI or anything else moving them sets
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// living entities with a mind of their own, like minecraft's Mob: goals decide what to do (see goals.ts) and
|
||||
// controls turn that into walking, looking and jumping. they can despawn, pick up items and be kept near a home
|
||||
import { ATTRIBUTES, type AttributeType } from "./attributes.ts";
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// the kinds of entity mods define in entities/<name>.json (see EntityJson): animals that wander around, panic when hurt
|
||||
// and look at players now and then, like minecraft's simpler animals, monsters that go after players, and scripted
|
||||
// ones that stay where scripts put them
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// runs the game at a fixed rate. a slow tick makes the next ones run back to back until the game catches up,
|
||||
// so game time keeps up with real time. if it falls too far behind, it skips ahead instead and says so
|
||||
import { TICKS_PER_SECOND } from "$/common/constants.ts";
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import {
|
||||
CHUNK_HEIGHT,
|
||||
CHUNK_SIZE,
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import type { ModData, ModListing } from "$/common/mod_loader.ts";
|
||||
import type { WorldSave } from "./saves.ts";
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// liquids flowing, like minecraft's FlowingFluid: a change next to a liquid gets the cells around it looked at again
|
||||
// after the liquid's ticks, and each works out what it should be from its neighbors (see next_level). that changes
|
||||
// more cells, and so it spreads one block a step, and drains away the same way once its source is gone
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// starts a game server with its mods: registers their data, then imports worldgen and server scripts.
|
||||
// the worker loads built mods, tests can load mods straight from their source folders
|
||||
import { register_mod_data } from "$/common/mod_loader.ts";
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// the server's loot tables: rolling them (see common/loot.ts) with the conditions, functions and modifiers mods
|
||||
// register through ctx.loot. what a mod's code throws is logged under it and the roll carries on without it
|
||||
import { EverythingRegistry, type ItemRegistry } from "$/common/everything_registry.ts";
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// a Map that forgets the least recently used entries past max_size
|
||||
export class LruMap<K, V> {
|
||||
#map = new Map<K, V>();
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// menus, like neoforge's AbstractContainerMenu: what a player can do in a gui. the server's menu decides what every
|
||||
// click does, clients only draw it. see docs/modding/inventories/menus.md
|
||||
import {
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// runs mods' server scripts: builds each one's ServerContext and keeps what they register.
|
||||
// see docs/modding/. parts not built yet throw when used, saying so
|
||||
import { BlockRegistry, EverythingRegistry, ItemRegistry, liquid_height } from "$/common/everything_registry.ts";
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// monsters spawning on their own near players, like minecraft's NaturalSpawner: every tick, one try in each chunk
|
||||
// around players while there's room under the monster cap. what spawns comes from mods' worldgen/spawns.json (see
|
||||
// SpawnJson), the way undergarden's biomes list its rotspawn
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import {
|
||||
PLAYER_EYE_HEIGHT,
|
||||
PLAYER_HEIGHT,
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import { CHUNK_SIZE } from "$/common/constants.ts";
|
||||
import { is_within_view } from "$/common/chunk_streaming.ts";
|
||||
import { chunk_key } from "$/common/utils.ts";
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// what a world is saved as, apart from the files: level.json's text and each chunk's blocks. server/regions.ts puts
|
||||
// the chunks into region files, this is what's inside one chunk's entry before it's compressed:
|
||||
//
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// player skins set with /skin: 64x64 pngs in minecraft 1.8's layout, see client/rendering/player_renderer.ts
|
||||
|
||||
// minecraft skins are a few KB, this leaves room for ones with extra metadata
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// a player's hunger and saturation, with minecraft's rules (its FoodData), and what they do to health. the server
|
||||
// owns them, clients only draw them
|
||||
import { TICKS_PER_SECOND } from "$/common/constants.ts";
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/// <reference lib="deno.worker" />
|
||||
|
||||
// runs the game in a worker without any permissions, the host does files and networking
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import { AIR, CHUNK_AREA, CHUNK_HEIGHT, CHUNK_SIZE, ID_MASK } from "$/common/constants.ts";
|
||||
import {
|
||||
block_light_emission,
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// generates chunks in worldgen workers (worldgen_worker.ts) instead of on the game's thread. the host starts the
|
||||
// workers and gives the game a port to each, since the game has no permissions to start them itself (see
|
||||
// server/worldgen_workers.ts). requests go nearest first, a worker has a couple at a time so priorities stay fresh, and what the
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/// <reference lib="deno.worker" />
|
||||
|
||||
// generates chunks for the game, off its thread. the host starts it without permissions, like the game, and hands it
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// the part of a game server that has permissions: files and networking. the game itself runs in a worker with none.
|
||||
// server/main.ts runs it as a dedicated server, and the desktop app runs it for singleplayer
|
||||
import { serveDir, serveFile } from "@std/http/file-server";
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// the server's mods: every .bmod in server_mods/, checked, sorted so dependencies load first, and with the copy
|
||||
// players download (the same mod without its server script) ready to serve
|
||||
import { join } from "@std/path";
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// a dedicated server: the host from server/host.ts on a port, saving the world when it's stopped
|
||||
import { type Host, start_host } from "./host.ts";
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// region files, laid out like minecraft's since mcregion (a mod, part of the game from beta 1.3): the chunks of a
|
||||
// 32 by 32 chunk square in one file, so saving writes only the chunks that changed. the file is 4 KiB sectors, the
|
||||
// first two are the header:
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// the worldgen workers (game/worldgen_worker.ts), started by the host because the game worker has no permissions to
|
||||
// start workers itself: Deno checks a new worker's code against its parent's permissions. each gets one end of a
|
||||
// channel and the game the other, so the game talks to them directly. a worker that crashes is started again and the
|
||||
|
||||
Reference in New Issue
Block a user