Better recipe api and port smithing to it
This commit is contained in:
+10
-2
@@ -6,7 +6,14 @@
|
||||
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 { ModListing, ModLoadError, RecipeBook, register_mod_data, shared_recipes_api } from "$/common/mod_loader.ts";
|
||||
import {
|
||||
ModListing,
|
||||
ModLoadError,
|
||||
recipe_lookup,
|
||||
RecipeBook,
|
||||
register_mod_data,
|
||||
shared_recipes_api,
|
||||
} from "$/common/mod_loader.ts";
|
||||
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";
|
||||
@@ -237,7 +244,7 @@ function shared_context(listing: ModListing): SharedContext {
|
||||
fluid_rules.register(mod, id, rules);
|
||||
},
|
||||
},
|
||||
recipes: shared_recipes_api(() => recipe_book, () => rules_setup, (message) => {
|
||||
recipes: shared_recipes_api(mod, () => recipe_book, () => rules_setup, (message) => {
|
||||
throw new Error(`[${mod}] ${message}`);
|
||||
}),
|
||||
world: rules_world,
|
||||
@@ -368,6 +375,7 @@ function client_context(listing: ModListing): ClientContext {
|
||||
recipes: {
|
||||
list: (type) =>
|
||||
structuredClone(type ? recipe_book.all.filter((recipe) => recipe.type === type) : recipe_book.all),
|
||||
...recipe_lookup(() => recipe_book),
|
||||
},
|
||||
tags: tag_api(),
|
||||
render: {
|
||||
|
||||
Reference in New Issue
Block a user