Recipe types from shared scripts and stuff

This commit is contained in:
2026-11-01 20:41:23 -03:00
parent c8b5f2a3bd
commit 65113862f7
34 changed files with 234 additions and 134 deletions
+3 -3
View File
@@ -22,8 +22,8 @@ export function setup(ctx: ServerContext) {
const smelter = ctx.menus.register<BlockRef>("copper_tools:smelter", (menu, block, player) => {
const container = ctx.containers.get(block.data.container)!;
menu.title = "Smelter";
menu.add_slot(container, 0, { x: 55, y: 16, filter: "smeltable" });
menu.add_slot(container, 1, { x: 55, y: 52, filter: "fuel" });
menu.add_slot(container, 0, { x: 55, y: 16, filter: (item) => !!ctx.recipes.find("bworld:smelting", item.id) });
menu.add_slot(container, 1, { x: 55, y: 52, filter: (item) => !!ctx.recipes.find("bworld:fuel", item.id) });
menu.add_slot(container, 2, { x: 115, y: 34, output_only: true });
menu.add_player_inventory(7, 84);
menu.add_data("progress", () => block.data.progress);
@@ -57,7 +57,7 @@ returns the slot's **menu slot index**: slots are numbered in the order they're
| Option | Meaning |
| ------------- | ----------------------------------------------------------------------------------------------------------------- |
| `x`, `y` | Where its 18 pixel frame goes, in GUI pixels from the screen's top left. |
| `filter` | What can be put in: `"smeltable"` (has a furnace recipe), `"fuel"`, or a function `(item) => boolean`. |
| `filter` | What can be put in: a function `(item) => boolean`, like one that looks for a [recipe](../resources/recipes.md). |
| `output_only` | Can only be taken from, all at once, like the furnace result. |
| `on_take` | For `output_only` slots: runs when a player takes from it, before they get the item. Return `false` to stop them. |
| `icon` | A texture drawn in the slot while it's empty, like Minecraft's armor slots. |