forked from Low-Drag-MC/Multiblocked
-
Notifications
You must be signed in to change notification settings - Fork 0
KubeJS Recipes
laukille edited this page Oct 22, 2022
·
9 revisions
KubeJS can be used to add recipes to multiblocks. We assume you have a decent knowledge of KubeJS. For more information about KubeJS you can visit their wiki here.
Multiblocked recipes like all KubeJS recipes are added in the server_scripts folder.
A list of everything Recipe related Multiblock adds to KubeJS.
// Input and Output
// Items
.inputItem('Item').ignoreNBT()) | .outputItem('Item').ignoreNBT())
.inputItems('Item1', 'Item2') | .outputItems('Item1', 'Item2')
// Fluids
.inputFluid('Fluid') | .outputFluid('Fluid')
// Forge Energy
.inputFE(int) | .outputFE(int)
// Stress
.inputStress(int) | .outputStress(int)
// Mekanism Gas
.inputGas({type: '', amount: int}) | .outputGas({type: '', amount: int})
// Mekanism Slurry
.inputSlurry({type: '', amount: int}) | .outputSlurry({type: '', amount: int})
// Mekanism Infuse
.inputInfuse({type: '', amount: int}) | .outputInfuse({type: '', amount: int})
// Mekanism Pigment
.inputPigment({type: '', amount: int}) | .outputPigment({type: '', amount: int})
// Mana
.inputMana(int) | .outputMana(int)
// Alter Input and Output (place before the input or output to alter them)
.setChance(int) // int <= 1
.setPerTick(boolean) // Switch perTick on/off
// Recipe conditions
.thunder(1)
.dimension('Dimension')
.biome('Biome')
.yLevel(int, int)
.text('')
// Data
.data({})
.duration(int)onEvent('recipes', event => {
// Smelt 1 cobblestone into 1 stone at 10FE/t
event.recipes.multiblocked.multiblock("electric_smelting")
.inputItem('minecraft:cobblestone')
.outputItem('minecraft:stone')
.setPerTick(true)
.inputFE(10)
.duration(100)
})onEvent('recipes', event => {
// Pulverize 1 iron ore to get 2 iron dust and a 25% chance for a nickel dust at 30FE/t
event.recipes.multiblocked.multiblock("electric_pulverizing")
.inputItem('minecraft:iron_ore')
.outputItem('2x alltheores:iron_dust')
.setChance(0.25)
.outputItem('alltheores:nickel_dust')
.setChance(1)
.setPerTick(true)
.inputFE(30)
.duration(100)
})When you have allot of recipes it can be annoying to have manually add them all. Instead of adding every recipe one at a time you can use a registry to store all the information and then loop trough the registry and add all the recipes.
const recipeRegistry = [
{
ore: 'minecraft:raw_iron',
ingot1: 'minecraft:iron_ingot',
ingot2: {item: 'alltheores:nickel_ingot', chance: '0.10'},
fluidInput: {fluid: 'minecraft:lava', amount: 1},
duration: 100
}, {
ore: 'minecraft:raw_gold',
ingot1: 'minecraft:gold_ingot',
ingot2: {item: 'alltheores:copper_ingot', chance: '0.05'},
fluidInput: {fluid: 'minecraft:lava', amount: 1},
duration: 100
}, {
ore: 'alltheores:raw_platinum',
ingot1: 'alltheores:platinum_ingot',
ingot2: {item: 'alltheores:tin_ingot', chance: '0.1'},
fluidInput: {fluid: 'tconstruct:blazing_blood', amount: 1},
duration: 50
}
]
onEvent('recipes', event => {
recipeRegistry.forEach((r) => {
event.recipes.multiblocked.multiblock("ebf")
.inputItem(r.ore)
.setPerTick(true)
.inputFluid(Fluid.of(r.fluidInput.fluid, r.fluidInput.amount))
.setPerTick(false)
.outputItem(`2x ${r.ingot1}`)
.setChance(r.ingot2.chance)
.outputItem(r.ingot2.item)
.duration(r.duration)
})
})