Send chunks to players connected to server

This commit is contained in:
2026-09-28 11:14:40 -03:00
parent 677ad8115a
commit ded9a7e5d0
26 changed files with 920 additions and 357 deletions
-9
View File
@@ -5,7 +5,6 @@ import { BlockRegistry, EverythingRegistry, type ItemRegistry } from "$/common/e
import type { ClientContext, InventoryOverlay } from "$/common/mod_api/client.ts";
import { ModListing, ModLoadError, RecipeBook, register_mod_data } from "$/common/mod_loader.ts";
import { type Bmod, read_bmod } from "$/common/bmod.ts";
import type { OreJson } from "$/common/mod_data.ts";
import { display_name } from "$/common/utils.ts";
import { AIR_ID } from "$/common/protocol.ts";
import type { Client } from "./client.ts";
@@ -14,9 +13,6 @@ import { code_url, fetch_verified } from "./handshake.ts";
// each loaded mod's credits file, for the credits screen
export const mod_credits: { name: string; version: string; text: string }[] = [];
// what the chunk workers need to generate the same world as the server
export const worldgen_mods: { scripts: { mod: string; url: string }[]; ores: OreJson[] } = { scripts: [], ores: [] };
// set once the game is running, mods can't look at it during setup
let client: Client | undefined;
@@ -60,11 +56,6 @@ export async function load_client_mods(listings: ModListing[], bmods: Bmod[]) {
mod_names.clear();
for (const listing of listings) mod_names.set(listing.id, listing.name);
worldgen_mods.ores = recipes.ores;
worldgen_mods.scripts = bmods.flatMap((bmod) =>
bmod.scripts.worldgen ? [{ mod: bmod.manifest.id, url: script_url(bmod.scripts.worldgen) }] : []
);
for (const [i, bmod] of bmods.entries()) {
if (!bmod.scripts.client) continue;
const module = await import(script_url(bmod.scripts.client));