Add DuneChest recipes and exact upgrade grids to the cookbook

This commit is contained in:
unimatrixgit 2026-11-30 18:06:38 +01:00
commit ea72de3eba

View file

@ -4,6 +4,7 @@ const source = new URL('../data/cookbook/crafting/', import.meta.url);
const smoker = new URL('../data/cookbook/survival-food-recipes.json', import.meta.url);
const repairParts = new URL('../data/cookbook/starter-repair-parts.json', import.meta.url);
const duneChest = new URL('../data/cookbook/dunechest-recipes.json', import.meta.url);
const arrakisItems = new URL('../data/cookbook/items/', import.meta.url);
const vanillaFoodSaturation = { beef: 1.8, enchanted_golden_apple: 9.6 };
const itemSummaries = {
@ -96,6 +97,20 @@ export function recipeCatalogue() {
recipes.push({ id: 'brew_water_vial', station: 'Brewing stand', inputs: [blood, spice], output: water, amount: 1, possible: true, notes: brew });
recipes.push({ id: 'brew_water_of_life', station: 'Brewing stand', inputs: [blood, spice], output: life, amount: 1, possible: true, notes: brew + ' Drinking Water of Life has a 1% fatal chance.' });
recipes.push({ id: 'spice_boosted_potion', station: 'Brewing stand', inputs: [entry('imported_potion', 'Imported Potion', 'potion'), spice], output: entry('spice_boosted_potion', 'Spice-Boosted Potion', 'potion', true), amount: 1, notes: 'Brew once on Arrakis. Effect levels are multiplied by 1.25 and rounded to the nearest whole level; duration stays the same.' });
const storage = JSON.parse(readFileSync(duneChest, 'utf8'));
for (const recipe of storage.recipes) {
if (recipe.pattern.length !== 3 || recipe.pattern.some(row => row.length !== 3)) throw Error('Invalid DuneChest crafting grid');
const grid = recipe.pattern.flatMap(row => [...row].map(symbol => {
if (symbol === ' ') return null;
const ingredient = recipe.ingredients[symbol];
const value = ingredient?.startsWith('minecraft:') ? item(ingredient) : storage.items[ingredient];
if (!value) throw Error('Missing DuneChest ingredient ' + symbol);
return value;
}));
recipes.push({id: 'dunechest_' + recipe.id, station: crafting, inputs: grid.filter(Boolean), grid,
output: storage.items[recipe.id], amount: 1, shaped: true,
notes: 'Available on Arrakis, Caladan, Giedi Prime, Kaitain and Sigmadraken IV. Not installed on Lobby.'});
}
for (const recipe of recipes) {
if (foodIds.has(recipe.output.id)) {
const definition = JSON.parse(readFileSync(new URL(recipe.output.id + '.yml', arrakisItems), 'utf8'));
@ -104,7 +119,7 @@ export function recipeCatalogue() {
if (!Number.isFinite(saturation)) throw Error('Missing saturation for ' + recipe.output.id);
recipe.output = { ...recipe.output, material, stats: [{ label: 'Saturation per serving', value: '+' + saturation + ' points' }] };
}
const summary = itemSummaries[recipe.output.id];
const summary = itemSummaries[recipe.output.id] ?? recipe.output.summary;
if (!summary) throw Error('Missing item summary for ' + recipe.output.id);
recipe.output = { ...recipe.output, summary };
for (const ingredient of [...recipe.inputs, recipe.output]) {