Biome as data

This commit is contained in:
2026-10-08 13:34:32 -03:00
parent 9f0b049148
commit 7e7ac8f6f4
49 changed files with 913 additions and 224 deletions
+4 -5
View File
@@ -52,7 +52,8 @@ import {
number,
word,
} from "$/common/commands.ts";
import { BIOMES, estimate_biome } from "$/common/worldgen/overworld.ts";
import { estimate_biome } from "$/common/worldgen/overworld.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";
@@ -1401,12 +1402,10 @@ export class GameServer {
register(
literal<ServerCommandSource>("locatebiome").describe("Finds the nearest biome of a kind").then(
argument<string, ServerCommandSource>("biome", word())
.suggests((partial) =>
Object.keys(BIOMES).filter((id) => id.startsWith(partial)).map((text) => ({ text }))
)
.suggests((partial) => biome_ids().filter((id) => id.startsWith(partial)).map((text) => ({ text })))
.executes((context) => {
const id = context.get<string>("biome");
if (!BIOMES[id]) throw new CommandError(`There's no biome ${id}`);
if (!get_biome(id)) throw new CommandError(`There's no biome ${id}`);
const player = context.source.server_player;
const found = this.#locate_biome(id, Math.floor(player.x), Math.floor(player.z));
if (!found) {
+1
View File
@@ -107,6 +107,7 @@ function as_loaded_mod(file: string, bmod: Bmod): LoadedMod {
effects: entries(bmod.data.effects),
tags: entries(bmod.data.tags),
loot_tables: entries(bmod.data.loot_tables ?? []),
biomes: entries(bmod.data.biomes ?? []),
textures: [...bmod.textures.keys()],
texture_files: new Map(),
texture_json: new Map(bmod.texture_json),