forked from unimatrix/web
Add DuneChest recipes and exact upgrade grids to the cookbook
This commit is contained in:
parent
4c51624723
commit
ea72de3eba
11 changed files with 91 additions and 4 deletions
18
website/data/cookbook/dunechest-recipes.json
Normal file
18
website/data/cookbook/dunechest-recipes.json
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"items": {
|
||||
"ender_chest": {"id":"dunechest_ender_chest","name":"Ender Chest","material":"barrel","custom":true,"icon":"/recipe-icons/dunechest_ender_chest.png","summary":"A custom chest with three colour pads. Matching frequencies share storage on the same planet; diamond toggles the supplied private mode."},
|
||||
"speed_hopper_1": {"id":"dunechest_speed_hopper_1","name":"Speed Hopper MK I","material":"hopper","custom":true,"icon":"/recipe-icons/dunechest_speed_hopper_1.png","summary":"A faster hopper with an item filter. Open its settings with a Wrench or sneak-click with an empty hand."},
|
||||
"speed_hopper_2": {"id":"dunechest_speed_hopper_2","name":"Speed Hopper MK II","material":"hopper","custom":true,"icon":"/recipe-icons/dunechest_speed_hopper_2.png","summary":"The second Speed Hopper tier. Craft it with a genuine MK I; an ordinary hopper does not satisfy the upgrade recipe."},
|
||||
"speed_hopper_3": {"id":"dunechest_speed_hopper_3","name":"Speed Hopper MK III","material":"hopper","custom":true,"icon":"/recipe-icons/dunechest_speed_hopper_3.png","summary":"The third Speed Hopper tier. Craft it with a genuine MK II and netherite ingots."},
|
||||
"auto_crafter": {"id":"dunechest_auto_crafter","name":"Auto Crafter","material":"crafting_table","custom":true,"summary":"A custom crafting block that takes ingredients from the container above and sends its result to the container below. Right-click to set its recipe."},
|
||||
"wrench": {"id":"dunechest_wrench","name":"Wrench","material":"knowledge_book","custom":true,"icon":"/recipe-icons/dunechest_wrench.png","summary":"Left-click a DuneChest, Speed Hopper or Auto Crafter to open that block’s settings. Works on Java and Bedrock."}
|
||||
},
|
||||
"recipes": [
|
||||
{"id":"ender_chest","pattern":["OEO","OBO","OOO"],"ingredients":{"O":"minecraft:obsidian","E":"minecraft:ender_eye","B":"minecraft:barrel"}},
|
||||
{"id":"speed_hopper_1","pattern":["GRG","RHR","GRG"],"ingredients":{"G":"minecraft:gold_ingot","R":"minecraft:redstone","H":"minecraft:hopper"}},
|
||||
{"id":"speed_hopper_2","pattern":["DRD","RIR","DRD"],"ingredients":{"D":"minecraft:diamond","R":"minecraft:redstone_block","I":"speed_hopper_1"}},
|
||||
{"id":"speed_hopper_3","pattern":["NRN","RIR","NRN"],"ingredients":{"N":"minecraft:netherite_ingot","R":"minecraft:redstone_block","I":"speed_hopper_2"}},
|
||||
{"id":"auto_crafter","pattern":["IRI","RTR","IDI"],"ingredients":{"I":"minecraft:iron_ingot","R":"minecraft:redstone","T":"minecraft:crafting_table","D":"minecraft:dropper"}},
|
||||
{"id":"wrench","pattern":["I I"," I "," S "],"ingredients":{"I":"minecraft:iron_ingot","S":"minecraft:stick"}}
|
||||
]
|
||||
}
|
||||
33
website/data/cookbook/dunechest-source.json
Normal file
33
website/data/cookbook/dunechest-source.json
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
"sourceRepository": "unimatrix/plugins",
|
||||
"sourceCommit": "56346a273d1b014fa256d26d34b4a4e33cc1d6b5",
|
||||
"purpose": "Pinned recipe registration and supplied artwork. The ingredient-consumption follow-up does not change these definitions.",
|
||||
"files": {
|
||||
"DuneChest/src/main/java/com/example/dunechest/StorageItems.java": "41c4a853c08877ce369cb4e203332a213ccf377f982181b832c87e1993a69c79",
|
||||
"DuneChest/src/main/java/com/example/dunechest/StorageRules.java": "d7e273e01e59f297d0670e8ab7410a600e63bd4753be3dadec99f0e965666fd5"
|
||||
},
|
||||
"icons": {
|
||||
"icons/dunechest_ender_chest.png": {
|
||||
"source": "network/resource-pack/central/overlay/assets/dunerealms/textures/block/ender_chest_front.png",
|
||||
"sha256": "88ca2f00bbf7f23fdd47ce5e0f8bc941a59d7c9bb2e5c93d6494ffb60c40b629"
|
||||
},
|
||||
"icons/dunechest_speed_hopper_1.png": {
|
||||
"source": "network/resource-pack/central/overlay/assets/dunerealms/textures/block/speed_hopper_1.png",
|
||||
"sha256": "f41ca0dfe2fe591df724c7a25b67338405e1dab6fbf1e978cf7f14b76cd73378"
|
||||
},
|
||||
"icons/dunechest_speed_hopper_2.png": {
|
||||
"source": "network/resource-pack/central/overlay/assets/dunerealms/textures/block/speed_hopper_2.png",
|
||||
"sha256": "c6b25e755fb66984cd6d1de254c9b299a9e0279e4637bbae5491bb69be150185"
|
||||
},
|
||||
"icons/dunechest_speed_hopper_3.png": {
|
||||
"source": "network/resource-pack/central/overlay/assets/dunerealms/textures/block/speed_hopper_3.png",
|
||||
"sha256": "fae56fa0f0f2724c0184b703b24b2787b17c63837d8d978815beb7f9f265144b"
|
||||
},
|
||||
"icons/dunechest_wrench.png": {
|
||||
"source": "network/resource-pack/central/overlay/assets/dunerealms/textures/item/wrench.png",
|
||||
"sha256": "e9d730f7d79114a0dd4699a3b2048ba234ae2589f5eda3f217dad8a02606be7a"
|
||||
}
|
||||
},
|
||||
"recipeCount": 6,
|
||||
"iconSource": "Exact supplied wrench sprite and custom block face textures; no rarity or equipment metadata inferred."
|
||||
}
|
||||
BIN
website/data/cookbook/icons/dunechest_ender_chest.png
Normal file
BIN
website/data/cookbook/icons/dunechest_ender_chest.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 791 B |
BIN
website/data/cookbook/icons/dunechest_speed_hopper_1.png
Normal file
BIN
website/data/cookbook/icons/dunechest_speed_hopper_1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 824 B |
BIN
website/data/cookbook/icons/dunechest_speed_hopper_2.png
Normal file
BIN
website/data/cookbook/icons/dunechest_speed_hopper_2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 809 B |
BIN
website/data/cookbook/icons/dunechest_speed_hopper_3.png
Normal file
BIN
website/data/cookbook/icons/dunechest_speed_hopper_3.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 835 B |
BIN
website/data/cookbook/icons/dunechest_wrench.png
Normal file
BIN
website/data/cookbook/icons/dunechest_wrench.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 405 B |
|
|
@ -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]) {
|
||||
|
|
|
|||
20
website/tests/dunechest-cookbook.test.mjs
Normal file
20
website/tests/dunechest-cookbook.test.mjs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import {readFileSync} from 'node:fs';
|
||||
import {createHash} from 'node:crypto';
|
||||
import {recipeCatalogue,recipeIcons} from '../scripts/recipe-catalogue.mjs';
|
||||
|
||||
test('DuneChest cookbook preserves shaped gaps, exact custom upgrade ingredients and all six outputs',()=>{
|
||||
const all=recipeCatalogue(),recipes=all.filter(r=>r.id.startsWith('dunechest_'));
|
||||
assert.equal(recipes.length,6);assert.equal(new Set(recipes.map(r=>r.output.id)).size,6);
|
||||
const by=id=>recipes.find(r=>r.id==='dunechest_'+id);
|
||||
const wrench=by('wrench');assert.deepEqual(wrench.grid.map(i=>i?.material??null),['iron_ingot',null,'iron_ingot',null,'iron_ingot',null,null,'stick',null]);assert.equal(wrench.inputs.length,4);
|
||||
for(const [tier,previous] of [[2,1],[3,2]]){
|
||||
const upgrade=by('speed_hopper_'+tier),core=upgrade.grid[4];assert.equal(core.id,'dunechest_speed_hopper_'+previous);assert.equal(core.custom,true);assert.ok(all.some(r=>r.output.id===core.id));
|
||||
}
|
||||
assert.equal(by('ender_chest').inputs.filter(i=>i.material==='obsidian').length,7);
|
||||
for(const r of recipes){assert.equal(r.grid.length,9);assert.equal(r.amount,1);assert.equal(r.shaped,true);assert.match(r.notes,/Not installed on Lobby/);assert.equal(r.output.quality,undefined);assert.equal(r.output.equipmentMark,undefined);}
|
||||
const icons=new Map(recipeIcons(recipes));assert.equal(icons.size,5);for(const bytes of icons.values())assert.equal(bytes.subarray(0,8).toString('hex'),'89504e470d0a1a0a');
|
||||
const provenance=JSON.parse(readFileSync(new URL('../data/cookbook/dunechest-source.json',import.meta.url)));assert.equal(provenance.sourceCommit,'56346a273d1b014fa256d26d34b4a4e33cc1d6b5');assert.equal(Object.keys(provenance.files).length,2);
|
||||
for(const [path,source] of Object.entries(provenance.icons))assert.equal(createHash('sha256').update(readFileSync(new URL('../data/cookbook/'+path,import.meta.url))).digest('hex'),source.sha256);
|
||||
});
|
||||
|
|
@ -10,8 +10,9 @@ import {SHARED_FOOTER} from '../scripts/site-chrome.mjs';
|
|||
test('website-only inputs preserve all 32 published recipes and their exact icon bytes',()=>{
|
||||
const baseline=JSON.parse(readFileSync(new URL('./fixtures/cookbook-before-repository-split.json',import.meta.url)));
|
||||
const hash=bytes=>createHash('sha256').update(bytes).digest('hex'),recipes=recipeCatalogue();
|
||||
assert.equal(recipes.length,baseline.recipes);assert.equal(hash(JSON.stringify(recipes)),baseline.catalogueSha256);
|
||||
assert.deepEqual(Object.fromEntries(recipeIcons(recipes).map(([name,bytes])=>[name,hash(bytes)])),baseline.icons);
|
||||
const original=recipes.filter(recipe=>!recipe.id.startsWith('dunechest_'));
|
||||
assert.equal(original.length,baseline.recipes);assert.equal(hash(JSON.stringify(original)),baseline.catalogueSha256);
|
||||
assert.deepEqual(Object.fromEntries(recipeIcons(original).map(([name,bytes])=>[name,hash(bytes)])),baseline.icons);
|
||||
});
|
||||
|
||||
test('shared menus expose the existing DuneForge workspace and root DuneGit register',()=>{
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ try {
|
|||
const cooking = selected.station === 'Furnace' || selected.station === 'Smoker';
|
||||
get('recipe-station-layout').classList.toggle('recipe-station--crafting', crafting);
|
||||
get('recipe-station-layout').classList.toggle('recipe-station--cooking', cooking);
|
||||
const slots = crafting ? Array.from({ length: 9 }, (_, index) => selected.inputs[index]) : selected.inputs;
|
||||
const slots = crafting ? selected.grid ?? Array.from({ length: 9 }, (_, index) => selected.inputs[index]) : selected.inputs;
|
||||
get('recipe-grid').replaceChildren(...slots.map(item => {
|
||||
const slot = node('li', '');
|
||||
if (item) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue

Staff