Change imports
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
// 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";
|
||||
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";
|
||||
|
||||
// recipes come from mods, see RecipeBook in common/mod_loader.ts
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// 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
|
||||
import type { EffectCategory } from "$/common/mod_data.ts";
|
||||
import type { EffectCategory } from "@/common/mod_data.ts";
|
||||
import type { AttributeType, ModifierOperation } from "./attributes.ts";
|
||||
import { finite } from "./entity.ts";
|
||||
import type { LivingEntity } from "./living_entity.ts";
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
//
|
||||
// like minecraft's, a kind of entity inherits from one class (Entity, LivingEntity, Mob, or another kind) and can
|
||||
// implement any number of interfaces
|
||||
import { TICKS_PER_SECOND } from "$/common/constants.ts";
|
||||
import type { BlockRegistry } from "$/common/everything_registry.ts";
|
||||
import type { ItemStack } from "$/common/inventory.ts";
|
||||
import type { Shape } from "$/common/block_shapes.ts";
|
||||
import type { Season } from "$/common/worldgen/biomes.ts";
|
||||
import { type Collisions, type FluidInCell, physics } from "$/common/physics.ts";
|
||||
import type { EntityData, EntityEvent, EntityInfo } from "$/common/protocol.ts";
|
||||
import { TICKS_PER_SECOND } from "@/common/constants.ts";
|
||||
import type { BlockRegistry } from "@/common/everything_registry.ts";
|
||||
import type { ItemStack } from "@/common/inventory.ts";
|
||||
import type { Shape } from "@/common/block_shapes.ts";
|
||||
import type { Season } from "@/common/worldgen/biomes.ts";
|
||||
import { type Collisions, type FluidInCell, physics } from "@/common/physics.ts";
|
||||
import type { EntityData, EntityEvent, EntityInfo } from "@/common/protocol.ts";
|
||||
import type { ServerPlayer } from "../player.ts";
|
||||
|
||||
// below this, entities have fallen out of the world
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
// 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
|
||||
import { CHUNK_SIZE } from "$/common/constants.ts";
|
||||
import { is_within_view } from "$/common/chunk_streaming.ts";
|
||||
import { fluid_block, fluid_in_cell } from "$/common/utils.ts";
|
||||
import { biome_season } from "$/common/worldgen/biomes.ts";
|
||||
import type { ItemStack } from "$/common/inventory.ts";
|
||||
import type { EntityEvent, EntityInfo, ServerMessage } from "$/common/protocol.ts";
|
||||
import { CHUNK_SIZE } from "@/common/constants.ts";
|
||||
import { is_within_view } from "@/common/chunk_streaming.ts";
|
||||
import { fluid_block, fluid_in_cell } from "@/common/utils.ts";
|
||||
import { biome_season } from "@/common/worldgen/biomes.ts";
|
||||
import type { ItemStack } from "@/common/inventory.ts";
|
||||
import type { EntityEvent, EntityInfo, ServerMessage } from "@/common/protocol.ts";
|
||||
import type { ServerPlayer } from "../player.ts";
|
||||
import type { ServerWorld } from "../world.ts";
|
||||
import type { DamageSource, Entity, EntityLevel, SavedEntity } from "./entity.ts";
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import { type ItemData, ItemStack, same_stack } from "$/common/inventory.ts";
|
||||
import type { EntityInfo } from "$/common/protocol.ts";
|
||||
import { TICK_DELTA } from "$/common/constants.ts";
|
||||
import { physics } from "$/common/physics.ts";
|
||||
import { type ItemData, ItemStack, same_stack } from "@/common/inventory.ts";
|
||||
import type { EntityInfo } from "@/common/protocol.ts";
|
||||
import { TICK_DELTA } from "@/common/constants.ts";
|
||||
import { physics } from "@/common/physics.ts";
|
||||
import { type Attacker, type DamageSource, Entity, finite, type SavedEntity } from "./entity.ts";
|
||||
|
||||
export const ITEM_ENTITY_TYPE = "cubi:item";
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
// 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
|
||||
import { TICKS_PER_SECOND } from "$/common/constants.ts";
|
||||
import { type ItemData, ItemStack } from "$/common/inventory.ts";
|
||||
import type { EntityData } from "$/common/protocol.ts";
|
||||
import { TICKS_PER_SECOND } from "@/common/constants.ts";
|
||||
import { type ItemData, ItemStack } from "@/common/inventory.ts";
|
||||
import type { EntityData } from "@/common/protocol.ts";
|
||||
import { AttributeMap, ATTRIBUTES, type AttributeType } from "./attributes.ts";
|
||||
import { EffectInstance, type SavedEffect } from "./effects.ts";
|
||||
import { DAMAGE, type DamageSource, Entity, finite, type SavedEntity } from "./entity.ts";
|
||||
|
||||
@@ -8,9 +8,9 @@ import { type DamageSource, Entity, finite } from "./entity.ts";
|
||||
import { GoalSelector } from "./goals.ts";
|
||||
import { ItemEntity } from "./item_entity.ts";
|
||||
import { EQUIPMENT_SLOTS, type EquipmentSlot, LivingEntity, type SavedLivingEntity } from "./living_entity.ts";
|
||||
import type { EntityData } from "$/common/protocol.ts";
|
||||
import type { ItemStack } from "$/common/inventory.ts";
|
||||
import { wrap_angle } from "$/common/utils.ts";
|
||||
import type { EntityData } from "@/common/protocol.ts";
|
||||
import type { ItemStack } from "@/common/inventory.ts";
|
||||
import { wrap_angle } from "@/common/utils.ts";
|
||||
|
||||
// minecraft's despawning distances: gone at once past the first, maybe after a while past the second
|
||||
const DESPAWN_DISTANCE = 128;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// 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
|
||||
import type { EntityJson } from "$/common/mod_data.ts";
|
||||
import type { EntityJson } from "@/common/mod_data.ts";
|
||||
import { ATTRIBUTES, type AttributeType } from "./attributes.ts";
|
||||
import { Entity } from "./entity.ts";
|
||||
import type { EntityFactory } from "./entity_types.ts";
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
// the fluid handlers the engine makes for server scripts, see ServerFluidApi in mod_api/server.ts: fluid containers',
|
||||
// tanks scripts keep, and pouring from one handler into another
|
||||
import { EverythingRegistry, type ItemRegistry } from "$/common/everything_registry.ts";
|
||||
import { contained_fluid } from "$/common/inventory.ts";
|
||||
import { EverythingRegistry, type ItemRegistry } from "@/common/everything_registry.ts";
|
||||
import { contained_fluid } from "@/common/inventory.ts";
|
||||
import type {
|
||||
FluidAction,
|
||||
FluidHandler,
|
||||
@@ -13,8 +13,8 @@ import type {
|
||||
ItemStack,
|
||||
Player,
|
||||
TankHandlerOptions,
|
||||
} from "$/common/mod_api/server.ts";
|
||||
import { same_fluid } from "$/common/fluids.ts";
|
||||
} from "@/common/mod_api/server.ts";
|
||||
import { same_fluid } from "@/common/fluids.ts";
|
||||
|
||||
// one of a stack of fluid containers, full of its whole capacity or empty, undefined for an item that isn't one
|
||||
export function item_handler(stack: ItemStack): FluidHandlerItem | undefined {
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
// fluids flowing, like minecraft's FlowingFluid: a change next to a fluid gets the cells around it looked at again
|
||||
// after the fluid'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
|
||||
import { AIR, CHUNK_HEIGHT, ID_MASK } from "$/common/constants.ts";
|
||||
import type { BlockRegistry } from "$/common/everything_registry.ts";
|
||||
import { AIR_ID } from "$/common/protocol.ts";
|
||||
import { fluid_block, get_state_value, set_state_value } from "$/common/utils.ts";
|
||||
import { AIR, CHUNK_HEIGHT, ID_MASK } from "@/common/constants.ts";
|
||||
import type { BlockRegistry } from "@/common/everything_registry.ts";
|
||||
import { AIR_ID } from "@/common/protocol.ts";
|
||||
import { fluid_block, get_state_value, set_state_value } from "@/common/utils.ts";
|
||||
|
||||
// what the flow needs of the world
|
||||
export interface FluidWorld {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
// 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";
|
||||
import { TICKS_PER_SECOND } from "@/common/constants.ts";
|
||||
|
||||
// at most this many ticks in a row to catch up, then skip the rest
|
||||
const MAX_CATCH_UP_TICKS = 10;
|
||||
|
||||
+16
-16
@@ -13,10 +13,10 @@ import {
|
||||
PLAYER_WIDTH,
|
||||
TICK_DELTA,
|
||||
TICKS_PER_SECOND,
|
||||
} from "$/common/constants.ts";
|
||||
import { BlockRegistry, EverythingRegistry, ItemRegistry } from "$/common/everything_registry.ts";
|
||||
} from "@/common/constants.ts";
|
||||
import { BlockRegistry, EverythingRegistry, ItemRegistry } from "@/common/everything_registry.ts";
|
||||
import { FluidFlow } from "./fluids.ts";
|
||||
import { contained_fluid, Container, ItemData, ItemStack } from "$/common/inventory.ts";
|
||||
import { contained_fluid, Container, ItemData, ItemStack } from "@/common/inventory.ts";
|
||||
import {
|
||||
AIR_ID,
|
||||
ClientMessage,
|
||||
@@ -24,13 +24,13 @@ import {
|
||||
MAX_NAME_LENGTH,
|
||||
PROTOCOL_VERSION,
|
||||
ServerMessage,
|
||||
} from "$/common/protocol.ts";
|
||||
import type { ModListing, RecipeBook } from "$/common/mod_loader.ts";
|
||||
import type { WorldgenSetup } from "$/common/generation.ts";
|
||||
import type { WorldgenBundle } from "$/common/worldgen_bundle.ts";
|
||||
} from "@/common/protocol.ts";
|
||||
import type { ModListing, RecipeBook } from "@/common/mod_loader.ts";
|
||||
import type { WorldgenSetup } from "@/common/generation.ts";
|
||||
import type { WorldgenBundle } from "@/common/worldgen_bundle.ts";
|
||||
import type { WorldgenPool } from "./worldgen_pool.ts";
|
||||
import { MAX_VIEW_DISTANCE, MIN_VIEW_DISTANCE } from "$/common/chunk_streaming.ts";
|
||||
import { CYCLE_TICKS, format_clock, time_of_day, TIMES_OF_DAY } from "$/common/time.ts";
|
||||
import { MAX_VIEW_DISTANCE, MIN_VIEW_DISTANCE } from "@/common/chunk_streaming.ts";
|
||||
import { CYCLE_TICKS, format_clock, time_of_day, TIMES_OF_DAY } from "@/common/time.ts";
|
||||
import {
|
||||
block_states,
|
||||
box_overlaps_block,
|
||||
@@ -43,13 +43,13 @@ import {
|
||||
placement_target,
|
||||
set_state_value,
|
||||
waterlog_placement,
|
||||
} from "$/common/utils.ts";
|
||||
import { collision_shape_at, type Shape } from "$/common/block_shapes.ts";
|
||||
import { physics } from "$/common/physics.ts";
|
||||
} from "@/common/utils.ts";
|
||||
import { collision_shape_at, type Shape } from "@/common/block_shapes.ts";
|
||||
import { physics } from "@/common/physics.ts";
|
||||
import { EXHAUSTION } from "./vitals.ts";
|
||||
import { entity_ref, ModRuntime, new_stack, run_guarded, type ServerCommandSource } from "./mod_runtime.ts";
|
||||
import type { LootContext, UseTarget } from "$/common/mod_api/server.ts";
|
||||
import type { EntityJson } from "$/common/mod_data.ts";
|
||||
import type { LootContext, UseTarget } from "@/common/mod_api/server.ts";
|
||||
import type { EntityJson } from "@/common/mod_data.ts";
|
||||
import {
|
||||
argument,
|
||||
choice,
|
||||
@@ -63,8 +63,8 @@ import {
|
||||
literal,
|
||||
number,
|
||||
word,
|
||||
} from "$/common/commands.ts";
|
||||
import { biome_ids, get_biome } from "$/common/worldgen/biomes.ts";
|
||||
} from "@/common/commands.ts";
|
||||
import { biome_ids, get_biome } from "@/common/worldgen/biomes.ts";
|
||||
import type { GameLoop } from "./game_loop.ts";
|
||||
import { update_crafting_result } from "./crafting.ts";
|
||||
import type { Menu } from "./menu.ts";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import type { ModData, ModListing } from "$/common/mod_loader.ts";
|
||||
import type { ModData, ModListing } from "@/common/mod_loader.ts";
|
||||
import type { WorldSave } from "./saves.ts";
|
||||
|
||||
// messages between server/main.ts (the host) and the game server worker
|
||||
|
||||
@@ -3,18 +3,18 @@
|
||||
|
||||
// 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";
|
||||
import type { ModData, ModListing } from "$/common/mod_loader.ts";
|
||||
import { load_worldgen } from "$/common/worldgen_loader.ts";
|
||||
import { worldgen_bundle } from "$/common/worldgen_bundle.ts";
|
||||
import { register_mod_data } from "@/common/mod_loader.ts";
|
||||
import type { ModData, ModListing } from "@/common/mod_loader.ts";
|
||||
import { load_worldgen } from "@/common/worldgen_loader.ts";
|
||||
import { worldgen_bundle } from "@/common/worldgen_bundle.ts";
|
||||
import { GameHost, GameServer } from "./game_server.ts";
|
||||
import type { WorldSource } from "./saves.ts";
|
||||
import { ModRuntime } from "./mod_runtime.ts";
|
||||
import { register_entity_type } from "./entity/entity_types.ts";
|
||||
import { mod_entity_factory } from "./entity/mod_entity.ts";
|
||||
import { set_effect_types } from "./entity/effects.ts";
|
||||
import { clear_hooks, expose_engine } from "$/common/hooks.ts";
|
||||
import { common_engine } from "$/common/engine_modules.ts";
|
||||
import { clear_hooks, expose_engine } from "@/common/hooks.ts";
|
||||
import { common_engine } from "@/common/engine_modules.ts";
|
||||
import { server_engine } from "./engine_modules.ts";
|
||||
|
||||
// the generator worlds use: a mod's worldgen/noise_settings, the base game's overworld. the server doesn't start
|
||||
|
||||
+4
-4
@@ -3,7 +3,7 @@
|
||||
|
||||
// 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";
|
||||
import { EverythingRegistry, type ItemRegistry } from "@/common/everything_registry.ts";
|
||||
import {
|
||||
loot_references,
|
||||
type LootCondition,
|
||||
@@ -14,9 +14,9 @@ import {
|
||||
type LootTableJson,
|
||||
roll_loot,
|
||||
validate_loot_table,
|
||||
} from "$/common/loot.ts";
|
||||
import type { ItemStack, LootContext, LootParams } from "$/common/mod_api/server.ts";
|
||||
import { ModLoadError } from "$/common/mod_loader.ts";
|
||||
} from "@/common/loot.ts";
|
||||
import type { ItemStack, LootContext, LootParams } from "@/common/mod_api/server.ts";
|
||||
import { ModLoadError } from "@/common/mod_loader.ts";
|
||||
import { run_guarded } from "./mod_runtime.ts";
|
||||
|
||||
type Modifier = (items: ItemStack[], context: LootContext, table: string) => ItemStack[] | void;
|
||||
|
||||
+3
-3
@@ -13,7 +13,7 @@ import {
|
||||
move_into,
|
||||
room_for,
|
||||
take_output,
|
||||
} from "$/common/inventory.ts";
|
||||
} from "@/common/inventory.ts";
|
||||
import {
|
||||
CRAFTING_RESULT_SLOT,
|
||||
type MenuFluidSlotInfo,
|
||||
@@ -22,8 +22,8 @@ import {
|
||||
PLAYER_MENU,
|
||||
PLAYER_MENU_CRAFTING,
|
||||
PLAYER_MENU_EXTRA,
|
||||
} from "$/common/protocol.ts";
|
||||
import type { GridRecipe } from "$/common/mod_data.ts";
|
||||
} from "@/common/protocol.ts";
|
||||
import type { GridRecipe } from "@/common/mod_data.ts";
|
||||
import { consume_recipe_items, update_crafting_result } from "./crafting.ts";
|
||||
|
||||
export interface MenuSlot {
|
||||
|
||||
+19
-19
@@ -3,13 +3,13 @@
|
||||
|
||||
// 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, fluid_height, ItemRegistry } from "$/common/everything_registry.ts";
|
||||
import { BlockRegistry, EverythingRegistry, fluid_height, ItemRegistry } from "@/common/everything_registry.ts";
|
||||
import {
|
||||
Container as EngineContainer,
|
||||
ItemStack as EngineItemStack,
|
||||
max_stack,
|
||||
sell_value,
|
||||
} from "$/common/inventory.ts";
|
||||
} from "@/common/inventory.ts";
|
||||
import {
|
||||
block_states,
|
||||
fluid_block,
|
||||
@@ -17,18 +17,18 @@ import {
|
||||
is_waterlogged,
|
||||
set_state_value,
|
||||
shared_items_api,
|
||||
} from "$/common/utils.ts";
|
||||
} from "@/common/utils.ts";
|
||||
import { LootTables } from "./loot.ts";
|
||||
import { collision_shape_at, covers_face, is_solid, raycast_blocks, type Shape } from "$/common/block_shapes.ts";
|
||||
import { AIR, CHUNK_SIZE, faces, ID_MASK } from "$/common/constants.ts";
|
||||
import { physics } from "$/common/physics.ts";
|
||||
import { clock } from "$/common/time.ts";
|
||||
import { BlockRules } from "$/common/block_rules.ts";
|
||||
import { fluid_exists, FluidRules, same_fluid } from "$/common/fluids.ts";
|
||||
import { collision_shape_at, covers_face, is_solid, raycast_blocks, type Shape } from "@/common/block_shapes.ts";
|
||||
import { AIR, CHUNK_SIZE, faces, ID_MASK } from "@/common/constants.ts";
|
||||
import { physics } from "@/common/physics.ts";
|
||||
import { clock } from "@/common/time.ts";
|
||||
import { BlockRules } from "@/common/block_rules.ts";
|
||||
import { fluid_exists, FluidRules, same_fluid } from "@/common/fluids.ts";
|
||||
import { interact, item_handler, tank_handler, transfer, use_container } from "./fluid_handlers.ts";
|
||||
import type { SharedContext } from "$/common/mod_api/shared.ts";
|
||||
import { tag_api } from "$/common/tags.ts";
|
||||
import { loading_mod } from "$/common/hooks.ts";
|
||||
import type { SharedContext } from "@/common/mod_api/shared.ts";
|
||||
import { tag_api } from "@/common/tags.ts";
|
||||
import { loading_mod } from "@/common/hooks.ts";
|
||||
import type {
|
||||
BlockComponent,
|
||||
BlockRef,
|
||||
@@ -56,8 +56,8 @@ import type {
|
||||
ServerBeforeEvents,
|
||||
ServerContext,
|
||||
SlotOptions,
|
||||
} from "$/common/mod_api/server.ts";
|
||||
import { check_recipe_types, ModLoadError, recipe_lookup, shared_recipes_api } from "$/common/mod_loader.ts";
|
||||
} from "@/common/mod_api/server.ts";
|
||||
import { check_recipe_types, ModLoadError, recipe_lookup, shared_recipes_api } from "@/common/mod_loader.ts";
|
||||
import {
|
||||
argument,
|
||||
block as block_argument,
|
||||
@@ -74,20 +74,20 @@ import {
|
||||
literal,
|
||||
number,
|
||||
word,
|
||||
} from "$/common/commands.ts";
|
||||
import { AIR_ID } from "$/common/protocol.ts";
|
||||
} from "@/common/commands.ts";
|
||||
import { AIR_ID } from "@/common/protocol.ts";
|
||||
import type { GameServer } from "./game_server.ts";
|
||||
import { MAX_PRIORITY, MIN_PRIORITY } from "./scheduled_ticks.ts";
|
||||
import type { ServerPlayer } from "./player.ts";
|
||||
import { Menu, type MenuFluidSlot, type MenuSlot } from "./menu.ts";
|
||||
import { damage_source, type Entity } from "./entity/entity.ts";
|
||||
import type { LivingEntity } from "./entity/living_entity.ts";
|
||||
import type { EffectJson } from "$/common/mod_data.ts";
|
||||
import type { EffectJson } from "@/common/mod_data.ts";
|
||||
import { create_entity } from "./entity/entity_types.ts";
|
||||
import { BLOCK_DROP_PICKUP_DELAY, ItemEntity } from "./entity/item_entity.ts";
|
||||
import { attribute_type, type AttributeType, MODIFIER_OPERATIONS } from "./entity/attributes.ts";
|
||||
import { effect_type, EffectInstance, type EffectType } from "./entity/effects.ts";
|
||||
import { biome_season } from "$/common/worldgen/biomes.ts";
|
||||
import { biome_season } from "@/common/worldgen/biomes.ts";
|
||||
|
||||
// a list of handlers that can't break each other: one throwing is logged under its mod and the rest still run
|
||||
export class Signal<T> {
|
||||
@@ -119,7 +119,7 @@ export class Signal<T> {
|
||||
// the mod whose code is running right now, for apis shared between mods that need to know who called
|
||||
let running_mod = "";
|
||||
|
||||
// a mod's script, imported from url. engine_access lets it import bworld/engine
|
||||
// a mod's script, imported from url. engine_access lets it import cubi/engine
|
||||
// a component a block lists, with its params from the block's json
|
||||
export interface BlockComponentOf {
|
||||
mod: string;
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
// 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
|
||||
import { CHUNK_SIZE } from "$/common/constants.ts";
|
||||
import type { SpawnJson } from "$/common/mod_data.ts";
|
||||
import { chunk_key } from "$/common/utils.ts";
|
||||
import { CHUNK_SIZE } from "@/common/constants.ts";
|
||||
import type { SpawnJson } from "@/common/mod_data.ts";
|
||||
import { chunk_key } from "@/common/utils.ts";
|
||||
import type { EntityManager } from "./entity/entity_manager.ts";
|
||||
import { create_entity } from "./entity/entity_types.ts";
|
||||
import { Mob } from "./entity/mob.ts";
|
||||
|
||||
@@ -7,12 +7,12 @@ import {
|
||||
PLAYER_SWIM_EYE_HEIGHT,
|
||||
PLAYER_SWIM_HEIGHT,
|
||||
PLAYER_WIDTH,
|
||||
} from "$/common/constants.ts";
|
||||
import { EverythingRegistry, type ItemRegistry } from "$/common/everything_registry.ts";
|
||||
import { Container, Cursor, ItemData, ItemStack } from "$/common/inventory.ts";
|
||||
import type { GridRecipe } from "$/common/mod_data.ts";
|
||||
} from "@/common/constants.ts";
|
||||
import { EverythingRegistry, type ItemRegistry } from "@/common/everything_registry.ts";
|
||||
import { Container, Cursor, ItemData, ItemStack } from "@/common/inventory.ts";
|
||||
import type { GridRecipe } from "@/common/mod_data.ts";
|
||||
import { Menu, PlayerMenu } from "./menu.ts";
|
||||
import { PlayerInfo } from "$/common/protocol.ts";
|
||||
import { PlayerInfo } from "@/common/protocol.ts";
|
||||
import { EXHAUSTION, type SavedVitals, Vitals } from "./vitals.ts";
|
||||
import { PlayerChunks } from "./player_chunks.ts";
|
||||
import { ATTRIBUTES, type AttributeType } from "./entity/attributes.ts";
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// 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";
|
||||
import { CHUNK_SIZE } from "@/common/constants.ts";
|
||||
import { is_within_view } from "@/common/chunk_streaming.ts";
|
||||
import { chunk_key } from "@/common/utils.ts";
|
||||
|
||||
// minecraft's PlayerChunkSender numbers
|
||||
const START_CHUNKS_PER_TICK = 9;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
// generation only shows in chunks never generated before.
|
||||
// format 1 had no biomes, and a bit per block after the blocks for whether world generation made it, from when only
|
||||
// chunks players changed were saved. both are read
|
||||
import { CHUNK_AREA, CHUNK_HEIGHT } from "$/common/constants.ts";
|
||||
import { CHUNK_AREA, CHUNK_HEIGHT } from "@/common/constants.ts";
|
||||
|
||||
export const CHUNK_FORMAT = 2;
|
||||
export const CHUNK_VOLUME = CHUNK_AREA * CHUNK_HEIGHT;
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
// ticks blocks asked for some ticks ahead, see ServerWorld.schedule_tick. kept by chunk and grouped by when they're due,
|
||||
// so a tick costs nothing until it's due, and a chunk with none due is passed over with one comparison
|
||||
import { CHUNK_SIZE } from "$/common/constants.ts";
|
||||
import { chunk_key } from "$/common/utils.ts";
|
||||
import { CHUNK_SIZE } from "@/common/constants.ts";
|
||||
import { chunk_key } from "@/common/utils.ts";
|
||||
import { index_in_chunk } from "./world.ts";
|
||||
|
||||
// the most that run in one tick. the rest run first the next
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
// 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";
|
||||
import { TICKS_PER_SECOND } from "@/common/constants.ts";
|
||||
|
||||
export const MAX_HEALTH = 20;
|
||||
export const MAX_FOOD = 20;
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
// 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 { AIR, CHUNK_AREA, CHUNK_HEIGHT, CHUNK_SIZE, ID_MASK } from "@/common/constants.ts";
|
||||
import {
|
||||
block_light_emission,
|
||||
block_light_opacity,
|
||||
BlockRegistry,
|
||||
EverythingRegistry,
|
||||
} from "$/common/everything_registry.ts";
|
||||
import { generate_raw_chunk, RawChunk, WorldgenSetup } from "$/common/generation.ts";
|
||||
import { AIR_ID } from "$/common/protocol.ts";
|
||||
import { block_value, chunk_key } from "$/common/utils.ts";
|
||||
import { block_numbering } from "$/common/worldgen_bundle.ts";
|
||||
} from "@/common/everything_registry.ts";
|
||||
import { generate_raw_chunk, RawChunk, WorldgenSetup } from "@/common/generation.ts";
|
||||
import { AIR_ID } from "@/common/protocol.ts";
|
||||
import { block_value, chunk_key } from "@/common/utils.ts";
|
||||
import { block_numbering } from "@/common/worldgen_bundle.ts";
|
||||
import { LruMap } from "./lru.ts";
|
||||
import { collision_shape_at, EMPTY_SHAPE, type Shape } from "$/common/block_shapes.ts";
|
||||
import { farming_day } from "$/common/time.ts";
|
||||
import { encode_level_chunk } from "$/common/chunk_streaming.ts";
|
||||
import { collision_shape_at, EMPTY_SHAPE, type Shape } from "@/common/block_shapes.ts";
|
||||
import { farming_day } from "@/common/time.ts";
|
||||
import { encode_level_chunk } from "@/common/chunk_streaming.ts";
|
||||
import { CHUNK_VOLUME, ChunkBlocks, decode_chunk, encode_chunk, SavedChunk, SavedChunks } from "./saves.ts";
|
||||
|
||||
// generation only, rebuilt when needed. 256 KB each. with a worldgen pool, it holds what the pool made until the
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
// 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
|
||||
// game stops wanting is dropped before it starts
|
||||
import type { RawChunk } from "$/common/generation.ts";
|
||||
import type { WorldgenBundle } from "$/common/worldgen_bundle.ts";
|
||||
import { chunk_key } from "$/common/utils.ts";
|
||||
import type { RawChunk } from "@/common/generation.ts";
|
||||
import type { WorldgenBundle } from "@/common/worldgen_bundle.ts";
|
||||
import { chunk_key } from "@/common/utils.ts";
|
||||
|
||||
export type PoolToWorker =
|
||||
| { type: "init"; bundle: WorldgenBundle }
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
// generates chunks for the game, off its thread. the host starts it without permissions, like the game, and hands it
|
||||
// a port the game talks to it through (see server/worldgen_workers.ts and worldgen_pool.ts). the game sends the
|
||||
// worldgen bundle once, then chunks to generate, and gets their blocks back moved, not copied
|
||||
import { load_bundle, type LoadedBundle } from "$/common/worldgen_bundle.ts";
|
||||
import { expose_engine } from "$/common/hooks.ts";
|
||||
import { common_engine } from "$/common/engine_modules.ts";
|
||||
import { load_bundle, type LoadedBundle } from "@/common/worldgen_bundle.ts";
|
||||
import { expose_engine } from "@/common/hooks.ts";
|
||||
import { common_engine } from "@/common/engine_modules.ts";
|
||||
import type { PoolToWorker, WorkerToPool } from "./worldgen_pool.ts";
|
||||
|
||||
self.onmessage = (event: MessageEvent<{ port: MessagePort }>) => {
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
// the server's mods: every .bmod in server_mods/, checked, with the server's changes to their config, 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";
|
||||
import { type Bmod, BMOD_EXTENSION, client_copy, read_bmod, write_bmod } from "$/common/bmod.ts";
|
||||
import { check_references, load_order, type LoadedMod } from "$/common/mod_check.ts";
|
||||
import type { ModListing } from "$/common/mod_loader.ts";
|
||||
import { data_file, FORMAT_VERSION } from "$/common/mod_data.ts";
|
||||
import { is_object, json_object } from "$/common/schema.ts";
|
||||
import { sha256 } from "$/common/utils.ts";
|
||||
import { type Bmod, BMOD_EXTENSION, client_copy, read_bmod, write_bmod } from "@/common/bmod.ts";
|
||||
import { check_references, load_order, type LoadedMod } from "@/common/mod_check.ts";
|
||||
import type { ModListing } from "@/common/mod_loader.ts";
|
||||
import { data_file, FORMAT_VERSION } from "@/common/mod_data.ts";
|
||||
import { is_object, json_object } from "@/common/schema.ts";
|
||||
import { sha256 } from "@/common/utils.ts";
|
||||
|
||||
export interface ServerMod {
|
||||
bmod: Bmod;
|
||||
|
||||
Reference in New Issue
Block a user