Every recipe type registered from shared scripts

This commit is contained in:
2026-11-03 15:34:41 -03:00
committed by paula
parent 65113862f7
commit b329a61d96
25 changed files with 334 additions and 371 deletions
+5 -1
View File
@@ -7,6 +7,7 @@ import { AIR } from "$/common/constants.ts";
import { BlockRegistry, EverythingRegistry, type ItemRegistry } from "$/common/everything_registry.ts";
import type { ClientContext, ClientMenu, InventoryOverlay, KeyMappings, MenuScreen } from "$/common/mod_api/client.ts";
import {
check_recipe_types,
ModListing,
ModLoadError,
recipe_lookup,
@@ -17,7 +18,7 @@ import {
import { type Bmod, read_bmod } from "$/common/bmod.ts";
import { get_state_value, set_state_value, shared_items_api } from "$/common/utils.ts";
import { BlockRules } from "$/common/block_rules.ts";
import { FluidRules } from "$/common/fluids.ts";
import { fluid_exists, FluidRules, same_fluid } from "$/common/fluids.ts";
import { fluid_rules, set_fluid_rules } from "./fluid_rules.ts";
import { covers_face, EMPTY_SHAPE, FULL_SHAPE, is_solid } from "$/common/block_shapes.ts";
import type { SharedContext, SharedWorld } from "$/common/mod_api/shared.ts";
@@ -192,6 +193,7 @@ export async function load_client_mods(listings: ModListing[], bmods: Bmod[]) {
});
}
rules_setup = false;
check_recipe_types(recipe_book);
client_setup = true;
for (const [i, bmod] of bmods.entries()) {
@@ -239,6 +241,8 @@ function shared_context(listing: ModListing): SharedContext {
blocks: blocks_api(mod),
items: shared_items_api(mod),
fluids: {
exists: fluid_exists,
same: same_fluid,
register(id, rules) {
if (!rules_setup) throw new Error(`[${mod}] rules can only be registered during setup`);
fluid_rules.register(mod, id, rules);