Recipe viewer for crabpots

This commit is contained in:
2026-10-12 02:39:25 -03:00
parent 726a52b91a
commit 2ebcf55ad3
9 changed files with 201 additions and 13 deletions
+12
View File
@@ -18,6 +18,7 @@ import { clear_hooks, expose_engine, loading_mod } from "$/common/hooks.ts";
import { common_engine } from "$/common/engine_modules.ts";
import { client_engine } from "./engine_modules.ts";
import { biome_season } from "$/common/worldgen/biomes.ts";
import type { LootTableJson } from "$/common/loot.ts";
// each loaded mod's credits file, for the credits screen
export const mod_credits: { name: string; version: string; text: string }[] = [];
@@ -309,6 +310,17 @@ function client_context(listing: ModListing): ClientContext {
EverythingRegistry.get<ItemRegistry>("items", id)?.components ?? {},
)),
},
blocks: {
exists: (id) => EverythingRegistry.get("blocks", id) !== undefined,
components(id) {
const block = EverythingRegistry.get<BlockRegistry>("blocks", id);
if (!block) throw new Error(`[${mod}] unknown block ${id}`);
return structuredClone(block.components ?? {});
},
},
loot: {
table: (id) => structuredClone(EverythingRegistry.get<LootTableJson>("loot_tables", id)),
},
recipes: {
list: (type) =>
structuredClone(type ? recipe_book.all.filter((recipe) => recipe.type === type) : recipe_book.all),