Last active
November 19, 2023 08:28
-
-
Save libertylocked/42c606a7dbc05b982359fbfc66e477d4 to your computer and use it in GitHub Desktop.
KubeJS server script to fix all recipe conflicts in Cluttered 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 Cluttered. | |
(() => { | |
const MOD_NAME = "luphieclutteredmod"; | |
const SUPPORTED_VERSION = "2.1"; | |
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}`); | |
} | |
})(); | |
function setup() { | |
ServerEvents.recipes((e) => { | |
// Fence recipes aren't supposed to be shapeless. | |
e.remove({id: "luphieclutteredmod:luphie_flowering_purple_fence_recipe"}); | |
e.shaped("3x luphieclutteredmod:luphie_flowering_purple_fence", [ | |
"ABA", | |
"ABA", | |
], { | |
A: "luphieclutteredmod:luphie_flowering_purple_planks", | |
B: "minecraft:stick", | |
}); | |
// Remove unnecessary stick recipes. They use plank tags already. | |
e.remove({id: "luphieclutteredmod:luphie_purple_plank_set_stick_recipe"}); | |
e.remove({id: "luphieclutteredmod:luphie_glow_wood_set_stick_recipe"}); | |
// Bookshelf conflict workaround: place books vertically for cluttered ones. | |
// This is because vanilla bookshelf recipes use plank tags already. | |
// Small bookcases already use the vertical books so we remove one row. | |
[ | |
"luphieclutteredmod:luphie_glow_bookshelf_recipe", | |
"luphieclutteredmod:luphie_flowering_pink_bookshelf_recipe", | |
"luphieclutteredmod:luphie_blue_mushroom_bookshelf_recipe", | |
"luphieclutteredmod:luphie_green_bookshelf_recipe", | |
"luphieclutteredmod:luphie_calico_purple_bookshelf_recipe", | |
"luphieclutteredmod:luphie_pink_bookshelf_recipe", | |
"luphieclutteredmod:luphie_flowering_yellow_bookshelf_recipe", | |
"luphieclutteredmod:luphie_yellow_bookshelf_recipe", | |
].map((id) => e.findRecipes({id: id})[0]).forEach((r) => { | |
e.remove({id: r.getId()}); | |
e.shaped(r.getOriginalRecipeResult().getId(), [ | |
"ABA", | |
"ABA", | |
"ABA" | |
], { | |
A: r.getOriginalRecipeIngredients()[0].getItemIds()[0], | |
B: "minecraft:book", | |
}); | |
}); | |
e.remove({id: "luphieclutteredmod:luphie_small_bookcase_recipe"}); | |
e.shaped("luphieclutteredmod:luphie_small_bookcase", [ | |
"ABA", | |
"ABA", | |
], { | |
A: "#minecraft:planks", | |
B: "minecraft:book", | |
}); | |
// Small shelf recipe conflicts with oak slab recipe. | |
// Perhaps the author meant to use slabs as input? | |
e.replaceInput({id: "luphieclutteredmod:small_shelf_recipe"}, | |
"minecraft:oak_planks", | |
"minecraft:oak_slab", | |
); | |
// Change the safe recipe because of common conflicts with other mods. | |
// Not needed if there's no conflict in pack. | |
e.remove({id: "luphieclutteredmod:luphie_safe_recipe"}); | |
e.shaped("luphieclutteredmod:luphie_safe", [ | |
" A ", | |
"BBB", | |
"BBB", | |
], { | |
A: "minecraft:iron_ingot", | |
B: "minecraft:iron_nugget", | |
}); | |
// Planks fixes: one log to four planks. | |
e.remove({id: "luphieclutteredmod:luphie_green_planks_recipe"}); | |
e.shapeless("4x luphieclutteredmod:luphie_green_planks", | |
["luphieclutteredmod:luphie_green_log"]); | |
e.remove({id: "luphieclutteredmod:luphie_glow_planks_recipe"}); | |
e.shapeless("4x luphieclutteredmod:luphie_glow_planks", | |
["luphieclutteredmod:luphie_glow_log"]); | |
// Fix armchairs. | |
e.replaceInput({output: "luphieclutteredmod:luphie_heart_armchair"}, | |
"luphieclutteredmod:luphie_pink_planks", | |
"#minecraft:planks"); | |
e.replaceInput({output: "luphieclutteredmod:luphie_heart_armchair"}, | |
"minecraft:peony", | |
"minecraft:allium"); | |
e.replaceInput({output: "luphieclutteredmod:luphie_black_cat_armchair"}, | |
"luphieclutteredmod:luphie_purple_planks", | |
"#minecraft:planks"); | |
// Duplicated recipes. | |
e.remove({id: "luphieclutteredmod:floweringpurpleplanksrecipe"}); | |
// Stripped wood fix. | |
e.remove({id: "luphieclutteredmod:stripped_f_lowering_purple_wood_recipe"}); | |
e.shaped("3x luphieclutteredmod:stripped_luphie_flowering_purple_wood", [ | |
"AA ", | |
"AA ", | |
], { | |
A: "luphieclutteredmod:stripped_luphie_flowering_purple_log", | |
}); | |
// Pancake stack conflict. | |
e.replaceInput({id: "luphieclutteredmod:luphie_pancake_stack_recipe"}, | |
"minecraft:sweet_berries", | |
"luphieclutteredmod:luphie_berry_cake"); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment