Tooltip api

This commit is contained in:
2026-11-05 23:06:37 -03:00
parent 9bc8fd992a
commit 34f001285d
15 changed files with 264 additions and 81 deletions
+3 -11
View File
@@ -4,12 +4,7 @@
// runs mods' server scripts: builds each one's ServerContext and keeps what they register.
// see docs/modding/. parts not built yet throw when used, saying so
import { BlockRegistry, EverythingRegistry, fluid_height, ItemRegistry } from "@/common/everything_registry.ts";
import {
Container as EngineContainer,
ItemStack as EngineItemStack,
max_stack,
sell_value,
} from "@/common/inventory.ts";
import { Container as EngineContainer, ItemStack as EngineItemStack, max_stack } from "@/common/inventory.ts";
import {
block_states,
fluid_block,
@@ -297,7 +292,7 @@ export class ModRuntime {
side: "server",
tags: tag_api(),
blocks,
items: shared_items_api(mod),
items: shared_items_api(mod, this.fluid_rules),
fluids: {
exists: fluid_exists,
same: same_fluid,
@@ -998,10 +993,7 @@ export class ModRuntime {
if (!item) throw new Error(`unknown item ${id}`);
return item.tool?.type;
},
sell_value: (id, data) => {
if (!EverythingRegistry.get("items", id)) throw new Error(`unknown item ${id}`);
return sell_value(id, data, this.fluid_rules);
},
sell_value: shared_items_api(mod, this.fluid_rules).sell_value,
components: (id) => {
const item = EverythingRegistry.get<ItemRegistry>("items", id);
if (!item) throw new Error(`unknown item ${id}`);