Juice sell price

This commit is contained in:
2026-10-26 19:32:46 -03:00
parent e729b92d20
commit e5221ba681
17 changed files with 182 additions and 47 deletions
+9 -5
View File
@@ -4,7 +4,12 @@
// 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 } from "$/common/inventory.ts";
import {
Container as EngineContainer,
ItemStack as EngineItemStack,
max_stack,
sell_value,
} from "$/common/inventory.ts";
import {
block_states,
fluid_block,
@@ -921,10 +926,9 @@ export class ModRuntime {
if (!item) throw new Error(`unknown item ${id}`);
return item.tool?.type;
},
sell_value: (id) => {
const item = EverythingRegistry.get<ItemRegistry>("items", id);
if (!item) throw new Error(`unknown item ${id}`);
return item.base_sell_value;
sell_value: (id, data) => {
if (!EverythingRegistry.get("items", id)) throw new Error(`unknown item ${id}`);
return sell_value(id, data, this.fluid_rules);
},
components: (id) => {
const item = EverythingRegistry.get<ItemRegistry>("items", id);