feat(smart-crafting): add smart crafting table using private chest inventory
All checks were successful
Deploy Addons / deploy (push) Successful in 14s

Adds an upgraded crafting block that scans the player's owned private chests
and aggregates their contents with the personal inventory when deciding which
recipes are craftable. Ingredients are consumed from the player first then
from chests; the result goes to the player (or drops at their feet).

Also redraws the post_office and mailbox block textures via a new
scripts/build-textures.py generator.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-21 11:16:19 +01:00
parent f7aa71e9eb
commit d6bafb9d16
17 changed files with 802 additions and 0 deletions

View File

@@ -0,0 +1,215 @@
// Recipe catalogue for the Smart Crafting Table.
// Each recipe lists ingredients as { any: [...itemIds], count }. The "any" variant
// lets a single slot accept any matching wood-type etc.
const PLANKS = [
"minecraft:oak_planks",
"minecraft:spruce_planks",
"minecraft:birch_planks",
"minecraft:jungle_planks",
"minecraft:acacia_planks",
"minecraft:dark_oak_planks",
"minecraft:mangrove_planks",
"minecraft:cherry_planks",
"minecraft:bamboo_planks",
"minecraft:crimson_planks",
"minecraft:warped_planks",
];
const LOGS = [
"minecraft:oak_log",
"minecraft:spruce_log",
"minecraft:birch_log",
"minecraft:jungle_log",
"minecraft:acacia_log",
"minecraft:dark_oak_log",
"minecraft:mangrove_log",
"minecraft:cherry_log",
"minecraft:crimson_stem",
"minecraft:warped_stem",
];
const WOOL = [
"minecraft:white_wool",
"minecraft:orange_wool",
"minecraft:magenta_wool",
"minecraft:light_blue_wool",
"minecraft:yellow_wool",
"minecraft:lime_wool",
"minecraft:pink_wool",
"minecraft:gray_wool",
"minecraft:light_gray_wool",
"minecraft:cyan_wool",
"minecraft:purple_wool",
"minecraft:blue_wool",
"minecraft:brown_wool",
"minecraft:green_wool",
"minecraft:red_wool",
"minecraft:black_wool",
];
const STICK = ["minecraft:stick"];
const COBBLE = ["minecraft:cobblestone"];
const IRON = ["minecraft:iron_ingot"];
const GOLD = ["minecraft:gold_ingot"];
const DIAMOND = ["minecraft:diamond"];
export const RECIPES = [
// ── Basics ─────────────────────────────────────────────────
{ id: "stick", name: "Stick",
result: { item: "minecraft:stick", count: 4 },
ingredients: [{ any: PLANKS, count: 2 }] },
{ id: "planks", name: "Wooden Planks (oak)",
result: { item: "minecraft:oak_planks", count: 4 },
ingredients: [{ any: ["minecraft:oak_log"], count: 1 }] },
{ id: "crafting_table", name: "Crafting Table",
result: { item: "minecraft:crafting_table", count: 1 },
ingredients: [{ any: PLANKS, count: 4 }] },
{ id: "chest", name: "Chest",
result: { item: "minecraft:chest", count: 1 },
ingredients: [{ any: PLANKS, count: 8 }] },
{ id: "furnace", name: "Furnace",
result: { item: "minecraft:furnace", count: 1 },
ingredients: [{ any: COBBLE, count: 8 }] },
{ id: "torch", name: "Torch",
result: { item: "minecraft:torch", count: 4 },
ingredients: [
{ any: ["minecraft:coal", "minecraft:charcoal"], count: 1 },
{ any: STICK, count: 1 },
] },
{ id: "ladder", name: "Ladder",
result: { item: "minecraft:ladder", count: 3 },
ingredients: [{ any: STICK, count: 7 }] },
{ id: "bucket", name: "Bucket",
result: { item: "minecraft:bucket", count: 1 },
ingredients: [{ any: IRON, count: 3 }] },
{ id: "bed", name: "Bed (red)",
result: { item: "minecraft:red_bed", count: 1 },
ingredients: [
{ any: WOOL, count: 3 },
{ any: PLANKS, count: 3 },
] },
// ── Tools: wood ────────────────────────────────────────────
{ id: "wood_pickaxe", name: "Wooden Pickaxe",
result: { item: "minecraft:wooden_pickaxe", count: 1 },
ingredients: [{ any: PLANKS, count: 3 }, { any: STICK, count: 2 }] },
{ id: "wood_axe", name: "Wooden Axe",
result: { item: "minecraft:wooden_axe", count: 1 },
ingredients: [{ any: PLANKS, count: 3 }, { any: STICK, count: 2 }] },
{ id: "wood_shovel", name: "Wooden Shovel",
result: { item: "minecraft:wooden_shovel", count: 1 },
ingredients: [{ any: PLANKS, count: 1 }, { any: STICK, count: 2 }] },
{ id: "wood_sword", name: "Wooden Sword",
result: { item: "minecraft:wooden_sword", count: 1 },
ingredients: [{ any: PLANKS, count: 2 }, { any: STICK, count: 1 }] },
{ id: "wood_hoe", name: "Wooden Hoe",
result: { item: "minecraft:wooden_hoe", count: 1 },
ingredients: [{ any: PLANKS, count: 2 }, { any: STICK, count: 2 }] },
// ── Tools: stone ───────────────────────────────────────────
{ id: "stone_pickaxe", name: "Stone Pickaxe",
result: { item: "minecraft:stone_pickaxe", count: 1 },
ingredients: [{ any: COBBLE, count: 3 }, { any: STICK, count: 2 }] },
{ id: "stone_axe", name: "Stone Axe",
result: { item: "minecraft:stone_axe", count: 1 },
ingredients: [{ any: COBBLE, count: 3 }, { any: STICK, count: 2 }] },
{ id: "stone_shovel", name: "Stone Shovel",
result: { item: "minecraft:stone_shovel", count: 1 },
ingredients: [{ any: COBBLE, count: 1 }, { any: STICK, count: 2 }] },
{ id: "stone_sword", name: "Stone Sword",
result: { item: "minecraft:stone_sword", count: 1 },
ingredients: [{ any: COBBLE, count: 2 }, { any: STICK, count: 1 }] },
{ id: "stone_hoe", name: "Stone Hoe",
result: { item: "minecraft:stone_hoe", count: 1 },
ingredients: [{ any: COBBLE, count: 2 }, { any: STICK, count: 2 }] },
// ── Tools: iron ────────────────────────────────────────────
{ id: "iron_pickaxe", name: "Iron Pickaxe",
result: { item: "minecraft:iron_pickaxe", count: 1 },
ingredients: [{ any: IRON, count: 3 }, { any: STICK, count: 2 }] },
{ id: "iron_axe", name: "Iron Axe",
result: { item: "minecraft:iron_axe", count: 1 },
ingredients: [{ any: IRON, count: 3 }, { any: STICK, count: 2 }] },
{ id: "iron_shovel", name: "Iron Shovel",
result: { item: "minecraft:iron_shovel", count: 1 },
ingredients: [{ any: IRON, count: 1 }, { any: STICK, count: 2 }] },
{ id: "iron_sword", name: "Iron Sword",
result: { item: "minecraft:iron_sword", count: 1 },
ingredients: [{ any: IRON, count: 2 }, { any: STICK, count: 1 }] },
{ id: "iron_hoe", name: "Iron Hoe",
result: { item: "minecraft:iron_hoe", count: 1 },
ingredients: [{ any: IRON, count: 2 }, { any: STICK, count: 2 }] },
// ── Tools: gold ────────────────────────────────────────────
{ id: "gold_pickaxe", name: "Golden Pickaxe",
result: { item: "minecraft:golden_pickaxe", count: 1 },
ingredients: [{ any: GOLD, count: 3 }, { any: STICK, count: 2 }] },
{ id: "gold_sword", name: "Golden Sword",
result: { item: "minecraft:golden_sword", count: 1 },
ingredients: [{ any: GOLD, count: 2 }, { any: STICK, count: 1 }] },
// ── Tools: diamond ─────────────────────────────────────────
{ id: "diamond_pickaxe", name: "Diamond Pickaxe",
result: { item: "minecraft:diamond_pickaxe", count: 1 },
ingredients: [{ any: DIAMOND, count: 3 }, { any: STICK, count: 2 }] },
{ id: "diamond_axe", name: "Diamond Axe",
result: { item: "minecraft:diamond_axe", count: 1 },
ingredients: [{ any: DIAMOND, count: 3 }, { any: STICK, count: 2 }] },
{ id: "diamond_shovel", name: "Diamond Shovel",
result: { item: "minecraft:diamond_shovel", count: 1 },
ingredients: [{ any: DIAMOND, count: 1 }, { any: STICK, count: 2 }] },
{ id: "diamond_sword", name: "Diamond Sword",
result: { item: "minecraft:diamond_sword", count: 1 },
ingredients: [{ any: DIAMOND, count: 2 }, { any: STICK, count: 1 }] },
// ── Armor: iron ────────────────────────────────────────────
{ id: "iron_helmet", name: "Iron Helmet",
result: { item: "minecraft:iron_helmet", count: 1 },
ingredients: [{ any: IRON, count: 5 }] },
{ id: "iron_chestplate", name: "Iron Chestplate",
result: { item: "minecraft:iron_chestplate", count: 1 },
ingredients: [{ any: IRON, count: 8 }] },
{ id: "iron_leggings", name: "Iron Leggings",
result: { item: "minecraft:iron_leggings", count: 1 },
ingredients: [{ any: IRON, count: 7 }] },
{ id: "iron_boots", name: "Iron Boots",
result: { item: "minecraft:iron_boots", count: 1 },
ingredients: [{ any: IRON, count: 4 }] },
// ── Armor: diamond ─────────────────────────────────────────
{ id: "diamond_helmet", name: "Diamond Helmet",
result: { item: "minecraft:diamond_helmet", count: 1 },
ingredients: [{ any: DIAMOND, count: 5 }] },
{ id: "diamond_chestplate", name: "Diamond Chestplate",
result: { item: "minecraft:diamond_chestplate", count: 1 },
ingredients: [{ any: DIAMOND, count: 8 }] },
{ id: "diamond_leggings", name: "Diamond Leggings",
result: { item: "minecraft:diamond_leggings", count: 1 },
ingredients: [{ any: DIAMOND, count: 7 }] },
{ id: "diamond_boots", name: "Diamond Boots",
result: { item: "minecraft:diamond_boots", count: 1 },
ingredients: [{ any: DIAMOND, count: 4 }] },
// ── Utility ────────────────────────────────────────────────
{ id: "shears", name: "Shears",
result: { item: "minecraft:shears", count: 1 },
ingredients: [{ any: IRON, count: 2 }] },
{ id: "flint_and_steel", name: "Flint and Steel",
result: { item: "minecraft:flint_and_steel", count: 1 },
ingredients: [{ any: IRON, count: 1 }, { any: ["minecraft:flint"], count: 1 }] },
{ id: "compass", name: "Compass",
result: { item: "minecraft:compass", count: 1 },
ingredients: [{ any: IRON, count: 4 }, { any: ["minecraft:redstone"], count: 1 }] },
{ id: "clock", name: "Clock",
result: { item: "minecraft:clock", count: 1 },
ingredients: [{ any: GOLD, count: 4 }, { any: ["minecraft:redstone"], count: 1 }] },
];