Last active
November 21, 2023 05:10
-
-
Save libertylocked/a35056c22795b4e7563b10c5b40e806d to your computer and use it in GitHub Desktop.
kubejs script to fix recipes in Ad Astra mod
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Recipe fixes for Ad Astra. | |
(() => { | |
const MOD_NAME = 'ad_astra'; | |
const SUPPORTED_VERSION = '1.15.4'; | |
if (Platform.getMods().containsKey(MOD_NAME) && | |
Platform.getMods().get(MOD_NAME).getVersion() == SUPPORTED_VERSION) { | |
console.log('Applying fixes'); | |
setup(); | |
} else { | |
console.log(`Fixes not applied! Mod not found: ` + | |
`${MOD_NAME} ${SUPPORTED_VERSION}`); | |
} | |
})(); | |
/** | |
* Sets up event listeners. | |
*/ | |
function setup() { | |
ServerEvents.recipes((e) => { | |
// Fix conflicts with bricks and polished stones. | |
// Make bricks craftable from polished stones instead of stones. | |
[ | |
'ad_astra:recipes/mercury_stone_bricks', | |
'ad_astra:recipes/moon_stone_bricks', | |
'ad_astra:recipes/mars_stone_bricks', | |
'ad_astra:recipes/glacio_stone_bricks', | |
'ad_astra:recipes/venus_stone_bricks', | |
'ad_astra:recipes/permafrost_bricks', | |
].map((id) => e.findRecipes({id: id})[0]).forEach((r) => { | |
const stoneId = r.getOriginalRecipeIngredients()[0].getItemIds()[0]; | |
e.replaceInput({id: r.getId()}, | |
stoneId, | |
stoneId.replace('ad_astra:', 'ad_astra:polished_')); | |
}); | |
// Slabs should be made out of their non-slab variants. | |
e.replaceInput({id: 'ad_astra:recipes/moon_stone_brick_slab'}, | |
'ad_astra:moon_stone', | |
'ad_astra:moon_stone_bricks', | |
); | |
// Cracked sandstone brick fix. | |
e.replaceInput({ | |
id: 'ad_astra:recipes/' + | |
'cracked_venus_sandstone_bricks_from_smelting_venus_stone_bricks', | |
}, | |
'ad_astra:venus_stone_bricks', | |
'ad_astra:venus_sandstone_bricks', | |
); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment