diff --git a/website/data/cookbook/icons/spice_blast_furnace.png b/website/data/cookbook/icons/spice_blast_furnace.png new file mode 100644 index 00000000..f9d87058 Binary files /dev/null and b/website/data/cookbook/icons/spice_blast_furnace.png differ diff --git a/website/data/cookbook/icons/spice_campfire.png b/website/data/cookbook/icons/spice_campfire.png new file mode 100644 index 00000000..492efca6 Binary files /dev/null and b/website/data/cookbook/icons/spice_campfire.png differ diff --git a/website/data/cookbook/icons/spice_coal.png b/website/data/cookbook/icons/spice_coal.png new file mode 100644 index 00000000..751e68d4 Binary files /dev/null and b/website/data/cookbook/icons/spice_coal.png differ diff --git a/website/data/cookbook/icons/spice_furnace.png b/website/data/cookbook/icons/spice_furnace.png new file mode 100644 index 00000000..b73aea76 Binary files /dev/null and b/website/data/cookbook/icons/spice_furnace.png differ diff --git a/website/data/cookbook/icons/spice_smoker.png b/website/data/cookbook/icons/spice_smoker.png new file mode 100644 index 00000000..f22ea5a8 Binary files /dev/null and b/website/data/cookbook/icons/spice_smoker.png differ diff --git a/website/data/cookbook/icons/spice_soul_campfire.png b/website/data/cookbook/icons/spice_soul_campfire.png new file mode 100644 index 00000000..8567baaa Binary files /dev/null and b/website/data/cookbook/icons/spice_soul_campfire.png differ diff --git a/website/data/cookbook/icons/spice_tender.png b/website/data/cookbook/icons/spice_tender.png new file mode 100644 index 00000000..38437f42 Binary files /dev/null and b/website/data/cookbook/icons/spice_tender.png differ diff --git a/website/data/cookbook/item-grades.json b/website/data/cookbook/item-grades.json index 22917862..bfad7126 100644 --- a/website/data/cookbook/item-grades.json +++ b/website/data/cookbook/item-grades.json @@ -217,6 +217,104 @@ "quality": "rare", "equipmentMark": 8, "source": "material grade:SEA_LANTERN" + }, + "spice_furnace": { + "material": "furnace", + "quality": "common", + "equipmentMark": 2, + "baseEquipmentMark": 1, + "source": "spiceCookersAndRails" + }, + "spice_smoker": { + "material": "smoker", + "quality": "uncommon", + "equipmentMark": 3, + "baseEquipmentMark": 2, + "source": "spiceCookersAndRails" + }, + "spice_blast_furnace": { + "material": "blast_furnace", + "quality": "uncommon", + "equipmentMark": 3, + "baseEquipmentMark": 2, + "source": "spiceCookersAndRails" + }, + "spice_campfire": { + "material": "campfire", + "quality": "uncommon", + "equipmentMark": 5, + "baseEquipmentMark": 4, + "source": "spiceCookersAndRails" + }, + "spice_soul_campfire": { + "material": "soul_campfire", + "quality": "uncommon", + "equipmentMark": 4, + "baseEquipmentMark": 3, + "source": "spiceCookersAndRails" + }, + "spice_coal": { + "material": "coal", + "quality": "uncommon", + "equipmentMark": 4, + "baseEquipmentMark": 3, + "source": "spiceCookersAndRails" + }, + "spice_tender": { + "material": "chest_minecart", + "quality": "uncommon", + "equipmentMark": 5, + "baseEquipmentMark": 4, + "source": "spiceCookersAndRails" + } + }, + "additionalSources": { + "spiceCookersAndRails": { + "sourceRepository": "unimatrix/plugins", + "sourceCommit": "13a8f23247497ac5cd9d59b6869e19097ee307be", + "files": { + "network/content-assets/cookbook/spice-crafting.json": "9e5f7bf35f3886dd4e8a78d313075ce4ab8193d2e05546c4bc2028929c2e6c91", + "JarvisConnector/src/main/java/com/dunerealms/jarvis/SpiceFurnaces.java": "d30ea6b51e5f3b17db8f847d9325042ae2b495356ed4214ef4799891063c9fea", + "JarvisConnector/src/main/resources/item-templates.json": "0eeda8b713de1912cd1dbd2d1c5d93cda2ecdf69a45f5c54974269971a464b5d", + "vendor/minecart-trains/spice-coal.patch": "a71e6a7c0c1f565006e0a23d4e71365785aa3d52fd2ded00d83b827a1763775b" + }, + "icons": { + "spice_furnace": { + "path": "icons/spice_furnace.png", + "sourcePath": "network/resource-pack/central/overlay/assets/dunerealms/textures/item/crafting/spice_furnace.png", + "sha256": "695e2828feecd30e5bfdd7b5910d548069f3686d4814a7ef619e83fbf21d43b0" + }, + "spice_smoker": { + "path": "icons/spice_smoker.png", + "sourcePath": "network/resource-pack/central/overlay/assets/dunerealms/textures/item/crafting/spice_smoker.png", + "sha256": "cda6b0f98a364a7d601037858107fbd37d67cce35f9e41b6c0f16d88eed8e4c0" + }, + "spice_blast_furnace": { + "path": "icons/spice_blast_furnace.png", + "sourcePath": "network/resource-pack/central/overlay/assets/dunerealms/textures/item/crafting/spice_blast_furnace.png", + "sha256": "007b5adba64020e4381b39e1c5251b7b0a8c6d4dabd18fb94a6947b15615634d" + }, + "spice_campfire": { + "path": "icons/spice_campfire.png", + "sourcePath": "network/resource-pack/central/overlay/assets/dunerealms/textures/item/crafting/spice_campfire.png", + "sha256": "3c1cbe1b7714ff8d310c146fcf24deb6400e93fe4757d0d044eb6f034118641f" + }, + "spice_soul_campfire": { + "path": "icons/spice_soul_campfire.png", + "sourcePath": "network/resource-pack/central/overlay/assets/dunerealms/textures/item/crafting/spice_soul_campfire.png", + "sha256": "9fdb25e9035314bd95326aec07dc044acba1de416e211ed837077930487035a5" + }, + "spice_coal": { + "path": "icons/spice_coal.png", + "sourcePath": "network/resource-pack/central/overlay/assets/dunerealms/textures/item/crafting/spice_coal.png", + "sha256": "228ead2784f3b7b0179b2daf0329e69683805d96c7e50182e3d61fe36b323d70" + }, + "spice_tender": { + "path": "icons/spice_tender.png", + "sourcePath": "network/resource-pack/central/overlay/assets/dunerealms/textures/item/crafting/spice_tender.png", + "sha256": "3c573a0831320ca23172f31dc4ee43656af4abab25dc50bf1e6915cf90423310" + } + } } } } diff --git a/website/data/cookbook/spice-crafting.json b/website/data/cookbook/spice-crafting.json new file mode 100644 index 00000000..ff314ff9 --- /dev/null +++ b/website/data/cookbook/spice-crafting.json @@ -0,0 +1,72 @@ +[ + { + "id": "spice_furnace", + "name": "Spice-Infused Furnace", + "material": "FURNACE", + "baseMark": 1, + "mark": 2, + "quality": "common", + "ingredients": "4 Iron Ingots · 4 raw Melange Spice · 1 Furnace", + "details": "Put the vanilla cooker in the centre, spice on the four sides, and iron in the corners. Cooks twice as fast." + }, + { + "id": "spice_smoker", + "name": "Spice-Infused Smoker", + "material": "SMOKER", + "baseMark": 2, + "mark": 3, + "quality": "uncommon", + "ingredients": "4 Iron Ingots · 4 raw Melange Spice · 1 Smoker", + "details": "Put the vanilla cooker in the centre, spice on the four sides, and iron in the corners. Cooks twice as fast." + }, + { + "id": "spice_blast_furnace", + "name": "Spice-Infused Blast Furnace", + "material": "BLAST_FURNACE", + "baseMark": 2, + "mark": 3, + "quality": "uncommon", + "ingredients": "4 Iron Ingots · 4 raw Melange Spice · 1 Blast Furnace", + "details": "Put the vanilla cooker in the centre, spice on the four sides, and iron in the corners. Cooks twice as fast." + }, + { + "id": "spice_campfire", + "name": "Spice-Infused Campfire", + "material": "CAMPFIRE", + "baseMark": 4, + "mark": 5, + "quality": "uncommon", + "ingredients": "4 Iron Ingots · 4 raw Melange Spice · 1 Campfire", + "details": "Put the vanilla cooker in the centre, spice on the four sides, and iron in the corners. Cooks twice as fast." + }, + { + "id": "spice_soul_campfire", + "name": "Spice-Infused Soul Campfire", + "material": "SOUL_CAMPFIRE", + "baseMark": 3, + "mark": 4, + "quality": "uncommon", + "ingredients": "4 Iron Ingots · 4 raw Melange Spice · 1 Soul Campfire", + "details": "Put the vanilla cooker in the centre, spice on the four sides, and iron in the corners. Cooks twice as fast." + }, + { + "id": "spice_coal", + "name": "Spice Coal", + "material": "COAL", + "baseMark": 3, + "mark": 4, + "quality": "uncommon", + "ingredients": "1 raw Melange Spice · 1 Coal or Charcoal", + "details": "Shapeless recipe. Fuels cookers and furnace minecarts." + }, + { + "id": "spice_tender", + "name": "Spice Fuel Cart", + "material": "CHEST_MINECART", + "baseMark": 4, + "mark": 5, + "quality": "uncommon", + "ingredients": "1 Minecart · 1 Spice Coal", + "details": "Shapeless recipe. A fuel cart for Spice Coal." + } +] diff --git a/website/scripts/recipe-catalogue.mjs b/website/scripts/recipe-catalogue.mjs index 41e9fef4..e8ce28e7 100644 --- a/website/scripts/recipe-catalogue.mjs +++ b/website/scripts/recipe-catalogue.mjs @@ -5,6 +5,7 @@ const smoker = new URL('../data/cookbook/survival-food-recipes.json', import.met 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 spiceCrafting = new URL('../data/cookbook/spice-crafting.json', import.meta.url); const itemGrades = new URL('../data/cookbook/item-grades.json', import.meta.url); const arrakisItems = new URL('../data/cookbook/items/', import.meta.url); const vanillaFoodSaturation = { beef: 1.8, enchanted_golden_apple: 9.6 }; @@ -136,6 +137,26 @@ export function recipeCatalogue() { output: storage.items[recipe.id], amount: 1, shaped: true, notes: 'Available on all six servers, including Lobby.'}); } + for (const spec of JSON.parse(readFileSync(spiceCrafting, 'utf8'))) { + const output = {...entry(spec.id, spec.name, spec.material.toLowerCase(), true), summary: spec.details}; + let inputs, grid, shaped; + if (spec.id === 'spice_coal') { + inputs = [spice, entry('coal', 'Coal or Charcoal', 'coal')]; + shaped = false; + } else if (spec.id === 'spice_tender') { + inputs = [entry('minecart', 'Minecart', 'minecart'), entry('spice_coal', 'Spice Coal', 'coal', true)]; + shaped = false; + } else { + const iron = entry('iron_ingot', 'Iron Ingot', 'iron_ingot'); + const cooker = entry(output.material, output.material.replaceAll('_', ' ').replace(/\b\w/g, c => c.toUpperCase()), output.material); + grid = [iron, spice, iron, spice, cooker, spice, iron, spice, iron]; + inputs = grid.filter(Boolean); + shaped = true; + } + grid ??= Array.from({length: 9}, (_, index) => inputs[index] ?? null); + recipes.push({id: spec.id, station: crafting, inputs, grid, output, amount: 1, shaped, + notes: spec.details + (spec.id === 'spice_coal' ? ' Requires genuine raw Melange; ordinary orange dye will not work. One Spice Coal smelts 50 items.' : spec.id === 'spice_tender' ? ' Requires genuine Spice Coal; ordinary coal will not work.' : ' Requires genuine raw Melange and the matching vanilla cooker.')}); + } for (const recipe of recipes) { if (foodIds.has(recipe.output.id)) { const definition = JSON.parse(readFileSync(new URL(recipe.output.id + '.yml', arrakisItems), 'utf8')); diff --git a/website/tests/cookbook-item-grades.test.mjs b/website/tests/cookbook-item-grades.test.mjs index 9c2a7eb8..33f6cadb 100644 --- a/website/tests/cookbook-item-grades.test.mjs +++ b/website/tests/cookbook-item-grades.test.mjs @@ -6,7 +6,7 @@ import {itemLoreModel} from '../control-panel/public/item-lore-model.mjs'; test('all Cookbook outputs have source-bound grades or explicitly preserve input metadata',()=>{ const recipes=recipeCatalogue(),metadata=JSON.parse(readFileSync(new URL('../data/cookbook/item-grades.json',import.meta.url))); - assert.equal(recipes.length,39);assert.equal(new Set(recipes.map(r=>r.output.id)).size,32); + assert.equal(recipes.length,46);assert.equal(new Set(recipes.map(r=>r.output.id)).size,39); assert.equal(metadata.sourceRepository,'unimatrix/plugins');assert.match(metadata.sourceCommit,/^[a-f0-9]{40}$/); for(const hash of Object.values(metadata.files))assert.match(hash,/^[a-f0-9]{64}$/); for(const recipe of recipes){ diff --git a/website/tests/spice-crafting-cookbook.test.mjs b/website/tests/spice-crafting-cookbook.test.mjs new file mode 100644 index 00000000..63139988 --- /dev/null +++ b/website/tests/spice-crafting-cookbook.test.mjs @@ -0,0 +1,44 @@ +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'; +import {itemLoreModel} from '../control-panel/public/item-lore-model.mjs'; + +const catalogue=JSON.parse(readFileSync(new URL('../data/cookbook/spice-crafting.json',import.meta.url))); +const grades=JSON.parse(readFileSync(new URL('../data/cookbook/item-grades.json',import.meta.url))); +const records=recipeCatalogue().filter(r=>catalogue.some(s=>s.id===r.output.id)); + +test('all seven new recipe cards use the exact native catalogue grade, base plus one',()=>{ + assert.equal(records.length,7); + for(const spec of catalogue){ + const recipe=records.find(r=>r.output.id===spec.id),card=itemLoreModel({...recipe.output,nativeMetadata:true}); + assert.equal(card.quality,spec.quality);assert.equal(card.mark,spec.baseMark+1); + assert.equal(recipe.output.material,spec.material.toLowerCase()); + assert.equal(recipe.output.name,spec.name);assert.equal(recipe.output.custom,true); + } + assert.equal(records.find(r=>r.output.id==='spice_soul_campfire').output.equipmentMark,4); + assert.equal(records.find(r=>r.output.id==='spice_campfire').output.equipmentMark,5); +}); + +test('cooker recipes preserve the raw-spice cross and four iron corners',()=>{ + for(const recipe of records.filter(r=>r.shaped)){ + assert.equal(recipe.station,'Crafting table');assert.equal(recipe.amount,1);assert.equal(recipe.grid.length,9); + for(const slot of [0,2,6,8])assert.equal(recipe.grid[slot].id,'iron_ingot'); + for(const slot of [1,3,5,7]){assert.equal(recipe.grid[slot].id,'spice');assert.equal(recipe.grid[slot].custom,true);} + assert.equal(recipe.grid[4].material,recipe.output.material);assert.equal(recipe.grid[4].custom,false); + } + const coal=records.find(r=>r.id==='spice_coal');assert.equal(coal.shaped,false); + assert.deepEqual(coal.inputs.map(i=>i.id),['spice','coal']);assert.match(coal.inputs[1].name,/Charcoal/); + const tender=records.find(r=>r.id==='spice_tender');assert.equal(tender.shaped,false); + assert.deepEqual(tender.inputs.map(i=>[i.id,i.custom]),[['minecart',false],['spice_coal',true]]); +}); + +test('the seven Cookbook icons and catalogue are bound to the reviewed plugin source',()=>{ + const source=grades.additionalSources.spiceCookersAndRails; + assert.equal(source.sourceCommit,'13a8f23247497ac5cd9d59b6869e19097ee307be'); + const bytes=readFileSync(new URL('../data/cookbook/spice-crafting.json',import.meta.url)); + assert.equal(createHash('sha256').update(bytes).digest('hex'),source.files['network/content-assets/cookbook/spice-crafting.json']); + const icons=new Map(recipeIcons(records));assert.equal(icons.size,7); + for(const icon of Object.values(source.icons))assert.equal(createHash('sha256').update(readFileSync(new URL('../data/cookbook/'+icon.path,import.meta.url))).digest('hex'),icon.sha256); +});