From c196ea5a693d46875bad3a2cfd42f77d98d7bb69 Mon Sep 17 00:00:00 2001 From: MuteTiefling Date: Mon, 22 Jul 2024 13:00:10 -0400 Subject: [PATCH 1/3] Occultism Fix --- .../constants/mod_priorities.js | 4 +++ kubejs/server_scripts/functions.js | 21 +++++++++++++++ .../recipes/occultism/crushing.js | 27 +++++++++++++++---- 3 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 kubejs/server_scripts/constants/mod_priorities.js create mode 100644 kubejs/server_scripts/functions.js diff --git a/kubejs/server_scripts/constants/mod_priorities.js b/kubejs/server_scripts/constants/mod_priorities.js new file mode 100644 index 00000000..ead504cb --- /dev/null +++ b/kubejs/server_scripts/constants/mod_priorities.js @@ -0,0 +1,4 @@ +//priority: 1001 + +// priority of which mod output should come from, if applicable +const mod_priorities = ['minecraft', 'modern_industrialization', 'mekanism', 'occultism']; diff --git a/kubejs/server_scripts/functions.js b/kubejs/server_scripts/functions.js new file mode 100644 index 00000000..b40a9a41 --- /dev/null +++ b/kubejs/server_scripts/functions.js @@ -0,0 +1,21 @@ +//priority: 1005 + +function getPreferredItemInTag(tag) { + return ( + Ingredient.of(tag) + .stacks.toArray() + .sort(({ mod: a }, { mod: b }) => compareIndices(a, b, tag))[0] || Item.of(air) + ); +} + +function compareIndices(a, b, tag) { + if (a == b) return 0; // iff a == b, they'll be found at the same position in modPriorities + + for (let mod of mod_priorities) { + if (mod == a) return -1; // if a comes before b, then idx(a) < idx(b), so -1 + if (mod == b) return 1; // if a comes after b, then idx(a) > idx(b), so 1 + } + + console.error('[' + a + ', ' + b + '] were both unaccounted for in mod unification' + (tag ? ' for ' + tag : '!')); + return 0; +} diff --git a/kubejs/server_scripts/recipes/occultism/crushing.js b/kubejs/server_scripts/recipes/occultism/crushing.js index 9fed2ae0..2cdf2563 100644 --- a/kubejs/server_scripts/recipes/occultism/crushing.js +++ b/kubejs/server_scripts/recipes/occultism/crushing.js @@ -6,8 +6,8 @@ ServerEvents.recipes((event) => { ingredient: { item: 'justdirethings:coal_t2' }, ignore_crushing_multiplier: true, result: { - type: 'occultism:tag', - tag: 'c:dusts/blaze', + type: 'occultism:item', + id: 'minecraft:blaze_powder', count: 6 }, id: `${id_prefix}blaze_powder_from_coal_t2` @@ -15,16 +15,33 @@ ServerEvents.recipes((event) => { { ingredient: { tag: 'c:rods/blaze' }, ignore_crushing_multiplier: true, - result: { - type: 'occultism:tag', - tag: 'c:dusts/blaze', + type: 'occultism:item', + id: 'minecraft:blaze_powder', count: 4 }, id: `occultism:crushing/blaze_powder_from_rod` } ]; + event.forEachRecipe({ type: 'occultism:crushing' }, (r) => { + let recipe = JSON.parse(r.json); + let recipe_id = r.getId(); + + if (recipe.result.type == 'occultism:tag') { + // console.log(`Found a tagged output: ${recipe.result.tag}`); + // console.log(`Preferred output: ${getPreferredItemInTag(`#${recipe.result.tag}`).getId()}`); + + recipe.result.type = 'occultism:item'; + recipe.result.id = getPreferredItemInTag(`#${recipe.result.tag}`).getId(); + recipe.id = recipe_id; + + delete recipe.result.tag; + + recipes.push(recipe); + } + }); + recipes.forEach((recipe) => { recipe.type = 'occultism:crushing'; event.custom(recipe).id(recipe.id); From 91f90b70fa27a43bb3ffa058a0034a4579a7fdba Mon Sep 17 00:00:00 2001 From: MuteTiefling Date: Mon, 22 Jul 2024 13:01:54 -0400 Subject: [PATCH 2/3] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 214c2e76..9345aad3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ #### 🦟 Bugs Fixed - Fixed issue with quest reward Scraper not accepting enchants [\#41](https://github.com/EnigmaticaModpacks/Enigmatica10/pull/41) +- Fix issue with Occultism crushing [\#47](https://github.com/EnigmaticaModpacks/Enigmatica10/pull/47) --- From 42b9eab6513df67298f02a93bae3c1cf5e146708 Mon Sep 17 00:00:00 2001 From: MuteTiefling Date: Mon, 22 Jul 2024 15:43:50 -0400 Subject: [PATCH 3/3] uraninite crushing --- kubejs/server_scripts/constants/mod_priorities.js | 2 +- kubejs/server_scripts/recipes/occultism/crushing.js | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/kubejs/server_scripts/constants/mod_priorities.js b/kubejs/server_scripts/constants/mod_priorities.js index ead504cb..1152b220 100644 --- a/kubejs/server_scripts/constants/mod_priorities.js +++ b/kubejs/server_scripts/constants/mod_priorities.js @@ -1,4 +1,4 @@ //priority: 1001 // priority of which mod output should come from, if applicable -const mod_priorities = ['minecraft', 'modern_industrialization', 'mekanism', 'occultism']; +const mod_priorities = ['minecraft', 'mekanism', 'modern_industrialization', 'occultism']; diff --git a/kubejs/server_scripts/recipes/occultism/crushing.js b/kubejs/server_scripts/recipes/occultism/crushing.js index 2cdf2563..3eb1601c 100644 --- a/kubejs/server_scripts/recipes/occultism/crushing.js +++ b/kubejs/server_scripts/recipes/occultism/crushing.js @@ -21,6 +21,16 @@ ServerEvents.recipes((event) => { count: 4 }, id: `occultism:crushing/blaze_powder_from_rod` + }, + { + ingredient: { tag: 'c:ores/uraninite' }, + ignore_crushing_multiplier: false, + result: { + type: 'occultism:item', + id: 'powah:uraninite_raw', + count: 4 + }, + id: `${id_prefix}uraninite_raw` } ];