diff --git a/kubejs/client_scripts/ponder/tech/industrialforegoing/laser_drill.js b/kubejs/client_scripts/ponder/tech/industrialforegoing/laser_drill.js index 1040862906..dafdf90e43 100644 --- a/kubejs/client_scripts/ponder/tech/industrialforegoing/laser_drill.js +++ b/kubejs/client_scripts/ponder/tech/industrialforegoing/laser_drill.js @@ -670,7 +670,3 @@ onEvent('ponder.registry', (event) => { } ); }); - -function randomOf(ingr) { - return Utils.randomOf(Utils.random, ingr.stacks); -} diff --git a/kubejs/server_scripts/enigmatica/kubejs/base/player/logged_in.js b/kubejs/server_scripts/enigmatica/kubejs/base/player/logged_in.js index fe24e3b9d8..261916785a 100644 --- a/kubejs/server_scripts/enigmatica/kubejs/base/player/logged_in.js +++ b/kubejs/server_scripts/enigmatica/kubejs/base/player/logged_in.js @@ -1,15 +1,12 @@ onEvent('player.logged_in', (event) => { const startingItemsGameStage = 'starting_items'; - randomWaystone = () => { - const waystones = ['waystones:waystone', 'waystones:mossy_waystone', 'waystones:sandy_waystone']; - return waystones[Math.floor(Math.random() * waystones.length)]; - }; + const waystones = ['waystones:waystone', 'waystones:mossy_waystone', 'waystones:sandy_waystone']; setMode(event.player); if (!event.hasGameStage(startingItemsGameStage)) { event.player.give(Item.of('ftbquests:book')); - event.player.give(Item.of(randomWaystone())); + event.player.give(Item.of(randomOf(waystones))); event.addGameStage(startingItemsGameStage); } diff --git a/kubejs/server_scripts/enigmatica/kubejs/base/unification/unify_dyes.js b/kubejs/server_scripts/enigmatica/kubejs/base/unification/unify_dyes.js index d6d40e644c..78986e7727 100644 --- a/kubejs/server_scripts/enigmatica/kubejs/base/unification/unify_dyes.js +++ b/kubejs/server_scripts/enigmatica/kubejs/base/unification/unify_dyes.js @@ -3,286 +3,286 @@ onEvent('recipes', (event) => { const id_prefix = 'enigmatica:base/unification/unify_dyes/'; dyeSources.forEach((recipe) => { - botania_dye_pestle_mortar(event, recipe, id_prefix); - create_dye_milling(event, recipe, id_prefix); - ars_nouveau_dye_crushing(event, recipe, id_prefix); - immersiveengineering_dye_crusher(event, recipe, id_prefix); - //integrateddynamics_dye_squeezing(event, recipe, id_prefix); - mekanism_dye_enriching(event, recipe, id_prefix); - mekanism_pigment_extracting(event, recipe, id_prefix); - pedestals_dye_crushing(event, recipe, id_prefix); - thermal_dye_centrifuge(event, recipe, id_prefix); - atum_quern_milling(event, recipe, id_prefix); - shapeless_dye_crafting(event, recipe, id_prefix); - occultism_dye_crushing(event, recipe, id_prefix); + botania_dye_pestle_mortar(recipe, id_prefix); + create_dye_milling(recipe, id_prefix); + ars_nouveau_dye_crushing(recipe, id_prefix); + immersiveengineering_dye_crusher(recipe, id_prefix); + //integrateddynamics_dye_squeezing(recipe, id_prefix); + mekanism_dye_enriching(recipe, id_prefix); + mekanism_pigment_extracting(recipe, id_prefix); + pedestals_dye_crushing(recipe, id_prefix); + thermal_dye_centrifuge(recipe, id_prefix); + atum_quern_milling(recipe, id_prefix); + shapeless_dye_crafting(recipe, id_prefix); + occultism_dye_crushing(recipe, id_prefix); }); -}); - -//dye normalization functions -function botania_dye_pestle_mortar(event, recipe, id_prefix) { - if (recipe.type == 'petal') { - return; - } - - if (recipe.input == 'minecraft:bone') { - return; - } - - var baseCount = 2, - multiplier = 1; - if (recipe.type == 'large') { - multiplier = 2; - } - if (recipe.primary == 'minecraft:bone_meal') { - multiplier = 2; - } - - var count = baseCount * multiplier, - output = Item.of(recipe.primary, count), - inputs = [recipe.input, 'botania:pestle_and_mortar']; - fallback_id(event.shapeless(output, inputs), `${id_prefix}${arguments.callee.name}/`); -} - -function create_dye_milling(event, recipe, id_prefix) { - var baseCount = 2, - multiplier = 1; - if (recipe.type == 'large') { - multiplier = 2; + //dye normalization functions + function botania_dye_pestle_mortar(recipe, id_prefix) { + if (recipe.type == 'petal') { + return; + } + + if (recipe.input == 'minecraft:bone') { + return; + } + + var baseCount = 2, + multiplier = 1; + if (recipe.type == 'large') { + multiplier = 2; + } + if (recipe.primary == 'minecraft:bone_meal') { + multiplier = 2; + } + + var count = baseCount * multiplier, + output = Item.of(recipe.primary, count), + inputs = [recipe.input, 'botania:pestle_and_mortar']; + + fallback_id(event.shapeless(output, inputs), `${id_prefix}${arguments.callee.name}/`); } - var count = baseCount * multiplier, - outputs = [ - Item.of(recipe.primary, count), - Item.of(recipe.secondary).withCount(count).withChance(0.25), - Item.of(recipe.tertiary).withCount(multiplier).withChance(0.05) - ], - input = recipe.input; - - fallback_id(event.recipes.create.milling(outputs, input), `${id_prefix}${arguments.callee.name}/`); -} - -function ars_nouveau_dye_crushing(event, recipe, id_prefix) { - var baseCount = 2, - multiplier = 1; - if (recipe.type == 'large') { - multiplier = 2; + function create_dye_milling(recipe, id_prefix) { + var baseCount = 2, + multiplier = 1; + if (recipe.type == 'large') { + multiplier = 2; + } + + var count = baseCount * multiplier, + outputs = [ + Item.of(recipe.primary, count), + Item.of(recipe.secondary).withCount(count).withChance(0.25), + Item.of(recipe.tertiary).withCount(multiplier).withChance(0.05) + ], + input = recipe.input; + + fallback_id(event.recipes.create.milling(outputs, input), `${id_prefix}${arguments.callee.name}/`); } - var count = baseCount * multiplier; - - fallback_id( - event.custom({ - type: 'ars_nouveau:crush', - input: Ingredient.of(recipe.input).toJson(), - output: [ - Item.of(recipe.primary).withCount(count).withChance(1.0), - Item.of(recipe.secondary).withCount(count).withChance(0.25) - ] - }), - `${id_prefix}${arguments.callee.name}/` - ); -} - -function immersiveengineering_dye_crusher(event, recipe, id_prefix) { - var baseCount = 2, - multiplier = 1; - if (recipe.type == 'large') { - multiplier = 2; - } - var count = baseCount * multiplier, - output = Item.of(recipe.primary, count), - extras = [ - Item.of(recipe.secondary).withCount(count).withChance(0.25), - Item.of(recipe.tertiary).withCount(multiplier).withChance(0.05) - ], - input = recipe.input; - - fallback_id( - event.recipes.immersiveengineering.crusher(output, input, extras), - `${id_prefix}${arguments.callee.name}/` - ); -} - -// function integrateddynamics_dye_squeezing(event, recipe, id_prefix) { -// var baseCount = 2, -// multiplier = 1; - -// if (recipe.type == 'large') { -// multiplier = 2; -// } - -// var count = baseCount * multiplier; - -// event.custom({ -// type: 'integrateddynamics:squeezer', -// item: { -// item: recipe.input -// }, -// result: { -// items: [ -// { item: { item: recipe.primary, count: count } }, -// { item: { item: recipe.secondary, count: count }, chance: 0.25 }, -// { item: { item: recipe.tertiary }, chance: 0.05 } -// ] -// } -// }); - -// fallback_id(event.custom({ -// type: 'integrateddynamics:mechanical_squeezer', -// item: { -// item: recipe.input -// }, -// result: { -// items: [ -// { item: { item: recipe.primary, count: count } }, -// { item: { item: recipe.secondary, count: count }, chance: 0.25 }, -// { item: { item: recipe.tertiary }, chance: 0.05 } -// ] -// }, -// duration: 5 -// }), `${id_prefix}${arguments.callee.name}/`); -// } - -function mekanism_dye_enriching(event, recipe, id_prefix) { - var baseCount = 3, - multiplier = 1; - if (recipe.type == 'large') { - multiplier = 2; + function ars_nouveau_dye_crushing(recipe, id_prefix) { + var baseCount = 2, + multiplier = 1; + if (recipe.type == 'large') { + multiplier = 2; + } + + var count = baseCount * multiplier; + + fallback_id( + event.custom({ + type: 'ars_nouveau:crush', + input: Ingredient.of(recipe.input).toJson(), + output: [ + Item.of(recipe.primary).withCount(count).withChance(1.0), + Item.of(recipe.secondary).withCount(count).withChance(0.25) + ] + }), + `${id_prefix}${arguments.callee.name}/` + ); } - var count = baseCount * multiplier, - output = Item.of(recipe.primary, count), - input = recipe.input; - - fallback_id(event.recipes.mekanism.enriching(output, input), `${id_prefix}${arguments.callee.name}/`); -} - -function mekanism_pigment_extracting(event, recipe, id_prefix) { - if (!recipe.primary.includes('_dye')) { - return; - } - var baseCount = 3, - multiplier = 1; - if (recipe.type == 'large') { - multiplier = 2; + function immersiveengineering_dye_crusher(recipe, id_prefix) { + var baseCount = 2, + multiplier = 1; + if (recipe.type == 'large') { + multiplier = 2; + } + var count = baseCount * multiplier, + output = Item.of(recipe.primary, count), + extras = [ + Item.of(recipe.secondary).withCount(count).withChance(0.25), + Item.of(recipe.tertiary).withCount(multiplier).withChance(0.05) + ], + input = recipe.input; + + fallback_id( + event.recipes.immersiveengineering.crusher(output, input, extras), + `${id_prefix}${arguments.callee.name}/` + ); } - let dye_color = recipe.primary.split(':')[1].replace('_dye', ''); - let count = baseCount * multiplier; - - fallback_id( - event.custom({ - type: 'mekanism:pigment_extracting', - input: { ingredient: { item: recipe.input } }, - output: { pigment: `mekanism:${dye_color}`, amount: 256 * count } - }), - `${id_prefix}${arguments.callee.name}/` - ); -} - -function pedestals_dye_crushing(event, recipe, id_prefix) { - if (recipe.input == 'minecraft:bone') { - return; + // function integrateddynamics_dye_squeezing(recipe, id_prefix) { + // var baseCount = 2, + // multiplier = 1; + + // if (recipe.type == 'large') { + // multiplier = 2; + // } + + // var count = baseCount * multiplier; + + // event.custom({ + // type: 'integrateddynamics:squeezer', + // item: { + // item: recipe.input + // }, + // result: { + // items: [ + // { item: { item: recipe.primary, count: count } }, + // { item: { item: recipe.secondary, count: count }, chance: 0.25 }, + // { item: { item: recipe.tertiary }, chance: 0.05 } + // ] + // } + // }); + + // fallback_id(event.custom({ + // type: 'integrateddynamics:mechanical_squeezer', + // item: { + // item: recipe.input + // }, + // result: { + // items: [ + // { item: { item: recipe.primary, count: count } }, + // { item: { item: recipe.secondary, count: count }, chance: 0.25 }, + // { item: { item: recipe.tertiary }, chance: 0.05 } + // ] + // }, + // duration: 5 + // }), `${id_prefix}${arguments.callee.name}/`); + // } + + function mekanism_dye_enriching(recipe, id_prefix) { + var baseCount = 3, + multiplier = 1; + if (recipe.type == 'large') { + multiplier = 2; + } + + var count = baseCount * multiplier, + output = Item.of(recipe.primary, count), + input = recipe.input; + + fallback_id(event.recipes.mekanism.enriching(output, input), `${id_prefix}${arguments.callee.name}/`); } - var baseCount = 2, - multiplier = 1; - if (recipe.type == 'large') { - multiplier = 2; + function mekanism_pigment_extracting(recipe, id_prefix) { + if (!recipe.primary.includes('_dye')) { + return; + } + var baseCount = 3, + multiplier = 1; + if (recipe.type == 'large') { + multiplier = 2; + } + + let dye_color = recipe.primary.split(':')[1].replace('_dye', ''); + let count = baseCount * multiplier; + + fallback_id( + event.custom({ + type: 'mekanism:pigment_extracting', + input: { ingredient: { item: recipe.input } }, + output: { pigment: `mekanism:${dye_color}`, amount: 256 * count } + }), + `${id_prefix}${arguments.callee.name}/` + ); } - var count = baseCount * multiplier, - output = recipe.primary, - input = recipe.input; - - fallback_id( - event.custom({ - type: 'pedestals:pedestal_crushing', - ingredient: { item: input }, - result: { item: output, count: count } - }), - `${id_prefix}${arguments.callee.name}/` - ); -} - -function thermal_dye_centrifuge(event, recipe, id_prefix) { - if (recipe.input == 'minecraft:bone') { - return; + function pedestals_dye_crushing(recipe, id_prefix) { + if (recipe.input == 'minecraft:bone') { + return; + } + + var baseCount = 2, + multiplier = 1; + if (recipe.type == 'large') { + multiplier = 2; + } + + var count = baseCount * multiplier, + output = recipe.primary, + input = recipe.input; + + fallback_id( + event.custom({ + type: 'pedestals:pedestal_crushing', + ingredient: { item: input }, + result: { item: output, count: count } + }), + `${id_prefix}${arguments.callee.name}/` + ); } - var baseCount = 2, - multiplier = 1; - if (recipe.type == 'large') { - multiplier = 2; + function thermal_dye_centrifuge(recipe, id_prefix) { + if (recipe.input == 'minecraft:bone') { + return; + } + + var baseCount = 2, + multiplier = 1; + if (recipe.type == 'large') { + multiplier = 2; + } + + var count = baseCount * multiplier, + outputs = [ + Item.of(recipe.primary, count), + Item.of(recipe.secondary).withCount(count).withChance(0.25), + Item.of(recipe.tertiary).withCount(multiplier).withChance(0.05) + ], + input = recipe.input; + + fallback_id(event.recipes.thermal.centrifuge(outputs, input), `${id_prefix}${arguments.callee.name}/`); } - var count = baseCount * multiplier, - outputs = [ - Item.of(recipe.primary, count), - Item.of(recipe.secondary).withCount(count).withChance(0.25), - Item.of(recipe.tertiary).withCount(multiplier).withChance(0.05) - ], - input = recipe.input; - - fallback_id(event.recipes.thermal.centrifuge(outputs, input), `${id_prefix}${arguments.callee.name}/`); -} - -function atum_quern_milling(event, recipe, id_prefix) { - var baseCount = 4, - multiplier = 1; - if (recipe.type == 'large') { - multiplier = 2; + function atum_quern_milling(recipe, id_prefix) { + var baseCount = 4, + multiplier = 1; + if (recipe.type == 'large') { + multiplier = 2; + } + + var count = baseCount * multiplier, + output = recipe.primary, + input = recipe.input, + rotations = 1 * multiplier; + + fallback_id( + event.custom({ + type: 'atum:quern', + ingredient: { item: input }, + result: { item: output, count: count }, + rotations: rotations + }), + `${id_prefix}${arguments.callee.name}/` + ); } - var count = baseCount * multiplier, - output = recipe.primary, - input = recipe.input, - rotations = 1 * multiplier; - - fallback_id( - event.custom({ - type: 'atum:quern', - ingredient: { item: input }, - result: { item: output, count: count }, - rotations: rotations - }), - `${id_prefix}${arguments.callee.name}/` - ); -} - -function shapeless_dye_crafting(event, recipe, id_prefix) { - if (recipe.input.split(':')[0] !== 'atum') { - return; - } - var output = Item.of(recipe.primary), - inputs = [recipe.input]; - - fallback_id(event.shapeless(output, inputs), `${id_prefix}${arguments.callee.name}/`); -} + function shapeless_dye_crafting(recipe, id_prefix) { + if (recipe.input.split(':')[0] !== 'atum') { + return; + } + var output = Item.of(recipe.primary), + inputs = [recipe.input]; -function occultism_dye_crushing(event, recipe, id_prefix) { - if (recipe.input == 'minecraft:bone') { - return; + fallback_id(event.shapeless(output, inputs), `${id_prefix}${arguments.callee.name}/`); } - var baseCount = 2, - multiplier = 1; - if (recipe.type == 'large') { - multiplier = 2; + function occultism_dye_crushing(recipe, id_prefix) { + if (recipe.input == 'minecraft:bone') { + return; + } + + var baseCount = 2, + multiplier = 1; + if (recipe.type == 'large') { + multiplier = 2; + } + + var count = baseCount * multiplier, + output = recipe.primary, + input = recipe.input; + + fallback_id( + event.custom({ + type: 'occultism:crushing', + ingredient: { item: input }, + result: { item: output, count: count }, + crushing_time: 50 + }), + `${id_prefix}${arguments.callee.name}/` + ); } - - var count = baseCount * multiplier, - output = recipe.primary, - input = recipe.input; - - fallback_id( - event.custom({ - type: 'occultism:crushing', - ingredient: { item: input }, - result: { item: output, count: count }, - crushing_time: 50 - }), - `${id_prefix}${arguments.callee.name}/` - ); -} +}); diff --git a/kubejs/server_scripts/enigmatica/kubejs/base/unification/unify_growables.js b/kubejs/server_scripts/enigmatica/kubejs/base/unification/unify_growables.js index ab80d28733..07e31a76d6 100644 --- a/kubejs/server_scripts/enigmatica/kubejs/base/unification/unify_growables.js +++ b/kubejs/server_scripts/enigmatica/kubejs/base/unification/unify_growables.js @@ -1,634 +1,638 @@ //priority: 900 onEvent('recipes', (event) => { soilRegistry.forEach((soil) => { - soils_botany_pots(event, soil); + soils_botany_pots(soil); }); cropRegistry.forEach((cropCategories) => { var type = cropCategories.type; cropCategories.crops.forEach((crop) => { - crops_botany_pots(event, type, crop); - crops_thermal_insolator(event, type, crop); - crops_immersiveengineering_cloche(event, type, crop); + crops_botany_pots(type, crop); + crops_thermal_insolator(type, crop); + crops_immersiveengineering_cloche(type, crop); }); }); treeRegistry.forEach((treeCategories) => { var type = treeCategories.type; treeCategories.trees.forEach((tree) => { - trees_botany_pots(event, type, tree); - trees_thermal_insolator(event, tree); - trees_immersiveengineering_cloche(event, tree); + trees_botany_pots(type, tree); + trees_thermal_insolator(tree); + trees_immersiveengineering_cloche(tree); }); }); -}); -function soils_botany_pots(event, soil) { - var input = soil.block, - display; - - //exceptions - switch (input) { - case 'minecraft:lava_bucket': - display = { block: 'minecraft:lava' }; - break; - case 'minecraft:water_bucket': - display = { block: 'minecraft:water' }; - break; - default: - display = { block: soil.block }; - } + function soils_botany_pots(soil) { + var input = soil.block, + display; + + //exceptions + switch (input) { + case 'minecraft:lava_bucket': + display = { block: 'minecraft:lava' }; + break; + case 'minecraft:water_bucket': + display = { block: 'minecraft:water' }; + break; + default: + display = { block: soil.block }; + } - if (soil.block.includes('farmland')) { - display.properties = { moisture: 7 }; - } + if (soil.block.includes('farmland')) { + display.properties = { moisture: 7 }; + } - event.custom({ - type: 'botanypots:soil', - input: { item: input }, - display: display, - categories: soil.categories, - growthModifier: soil.growthModifier - }); -} + event.custom({ + type: 'botanypots:soil', + input: { item: input }, + display: display, + categories: soil.categories, + growthModifier: soil.growthModifier + }); + } -function crops_botany_pots(event, type, crop) { - // Ticks Per Day: 24000 - // Ticks Per Minute: 1200 - var baseGrowthTicks = 24000, - growthModifier = 1.0; + function crops_botany_pots(type, crop) { + // Ticks Per Day: 24000 + // Ticks Per Minute: 1200 + var baseGrowthTicks = 24000, + growthModifier = 1.0; - // chance, minRolls, maxRolls - var primary = [1.0, 10, 20], - growthTicks = baseGrowthTicks, - plantSecondary; + // chance, minRolls, maxRolls + var primary = [1.0, 10, 20], + growthTicks = baseGrowthTicks, + plantSecondary; - if (crop.plantSecondary) { - plantSecondary = crop.plantSecondary; - } - /* + if (crop.plantSecondary) { + plantSecondary = crop.plantSecondary; + } + /* types: cactus, cane_like, coral, crop_fiber, crop_fruit, crop_gourd, crop_grain, crop_leafy, crop_legume, crop_melon, crop_root, crop_seed, crop_vine, flower, grass_like, kelp_like, lily_like, shroom, shrub, vine */ - switch (type) { - case 'coral': - growthModifier = 2.0; - break; - case 'crop_gourd': - growthModifier = 1.5; - break; - case 'crop_melon': - growthModifier = 1.5; - break; - case 'crop_seed': - primary = [1.0, 10, 30]; - break; - case 'flower': - growthModifier = 0.5; - break; - case 'grass_like': - growthModifier = 0.25; - break; - case 'lily_like': - growthModifier = 0.25; - break; - case 'shroom': - primary = [1.0, 10, 30]; - plantSecondary = crop.plant; - break; - case 'vine': - //disabled - return; - default: - //default - } + switch (type) { + case 'coral': + growthModifier = 2.0; + break; + case 'crop_gourd': + growthModifier = 1.5; + break; + case 'crop_melon': + growthModifier = 1.5; + break; + case 'crop_seed': + primary = [1.0, 10, 30]; + break; + case 'flower': + growthModifier = 0.5; + break; + case 'grass_like': + growthModifier = 0.25; + break; + case 'lily_like': + growthModifier = 0.25; + break; + case 'shroom': + primary = [1.0, 10, 30]; + plantSecondary = crop.plant; + break; + case 'vine': + //disabled + return; + default: + //default + } - var input = crop.seed, - outputs = [ - { - chance: primary[0], - output: { item: crop.plant }, - minRolls: primary[1], - maxRolls: primary[2] - } - ]; - if (type.includes('crop_')) { - //add seeds to crop type output - outputs.push({ - chance: 0.2, - output: { item: crop.seed }, - minRolls: 1, - maxRolls: 5 - }); - } + var input = crop.seed, + outputs = [ + { + chance: primary[0], + output: { item: crop.plant }, + minRolls: primary[1], + maxRolls: primary[2] + } + ]; + if (type.includes('crop_')) { + //add seeds to crop type output + outputs.push({ + chance: 0.2, + output: { item: crop.seed }, + minRolls: 1, + maxRolls: 5 + }); + } + + if (plantSecondary) { + //add any secondary + outputs.push({ + chance: 0.05, + output: { item: plantSecondary }, + minRolls: 1, + maxRolls: 5 + }); + } - if (plantSecondary) { - //add any secondary - outputs.push({ - chance: 0.05, - output: { item: plantSecondary }, - minRolls: 1, - maxRolls: 5 + event.custom({ + type: 'botanypots:crop', + seed: { item: input }, + categories: [crop.substrate], + growthTicks: growthTicks * growthModifier, + display: { block: crop.render }, + results: outputs }); } - event.custom({ - type: 'botanypots:crop', - seed: { item: input }, - categories: [crop.substrate], - growthTicks: growthTicks * growthModifier, - display: { block: crop.render }, - results: outputs - }); -} - -function crops_thermal_insolator(event, type, crop) { - var baseWater = 500, - baseEnergy = 20000, - waterModifier = 1.0, - energyModifier = 1.0; + function crops_thermal_insolator(type, crop) { + var baseWater = 500, + baseEnergy = 20000, + waterModifier = 1.0, + energyModifier = 1.0; - var primaryChance = 2.0, - secondaryChance = 1.1, - plantSecondary; + var primaryChance = 2.0, + secondaryChance = 1.1, + plantSecondary; - if (crop.plantSecondary) { - plantSecondary = crop.plantSecondary; - } + if (crop.plantSecondary) { + plantSecondary = crop.plantSecondary; + } - if (crop.plantSecondaryRate == 'low') { - secondaryChance = 0.01; - } + if (crop.plantSecondaryRate == 'low') { + secondaryChance = 0.01; + } - /* + /* types: cactus, cane_like, coral, crop_fiber, crop_fruit, crop_gourd, crop_grain, crop_leafy, crop_legume, crop_melon, crop_root, crop_seed, crop_vine, flower, grass_like, kelp_like, lily_like, shroom, shrub, vine */ - switch (type) { - case 'cactus': - waterModifier = 0.1; - energyModifier = 4.0; - break; - case 'cane_like': - waterModifier = 3.0; - energyModifier = 2.0; - break; - case 'coral': - waterModifier = 2.0; - energyModifier = 4.0; - break; - case 'crop_gourd': - waterModifier = 2.0; - energyModifier = 1.5; - break; - case 'crop_melon': - waterModifier = 2.0; - energyModifier = 1.5; - primaryChance = 1.0; - break; - case 'crop_seed': - primaryChance = 3.0; - break; - case 'flower': - waterModifier = 1.5; - energyModifier = 0.5; - break; - case 'grass_like': - waterModifier = 1.5; - energyModifier = 0.5; - break; - case 'lily_like': - waterModifier = 3.0; - energyModifier = 0.5; - break; - case 'shroom': - waterModifier = 1.5; - energyModifier = 0.5; - plantSecondary = crop.plant; - break; - default: - //default - } + switch (type) { + case 'cactus': + waterModifier = 0.1; + energyModifier = 4.0; + break; + case 'cane_like': + waterModifier = 3.0; + energyModifier = 2.0; + break; + case 'coral': + waterModifier = 2.0; + energyModifier = 4.0; + break; + case 'crop_gourd': + waterModifier = 2.0; + energyModifier = 1.5; + break; + case 'crop_melon': + waterModifier = 2.0; + energyModifier = 1.5; + primaryChance = 1.0; + break; + case 'crop_seed': + primaryChance = 3.0; + break; + case 'flower': + waterModifier = 1.5; + energyModifier = 0.5; + break; + case 'grass_like': + waterModifier = 1.5; + energyModifier = 0.5; + break; + case 'lily_like': + waterModifier = 3.0; + energyModifier = 0.5; + break; + case 'shroom': + waterModifier = 1.5; + energyModifier = 0.5; + plantSecondary = crop.plant; + break; + default: + //default + } - var input = crop.seed, - outputs = [Item.of(crop.plant).chance(primaryChance)]; + var input = crop.seed, + outputs = [Item.of(crop.plant).chance(primaryChance)]; - if (type.includes('crop_')) { - //add seeds to crop type output - outputs.push(Item.of(crop.seed).chance(secondaryChance)); - } + if (type.includes('crop_')) { + //add seeds to crop type output + outputs.push(Item.of(crop.seed).chance(secondaryChance)); + } - if (plantSecondary) { - //add any secondary - outputs.push(Item.of(plantSecondary).chance(secondaryChance)); - } + if (plantSecondary) { + //add any secondary + outputs.push(Item.of(plantSecondary).chance(secondaryChance)); + } - fallback_id( - event.recipes.thermal - .insolator(outputs, input) - .water(baseWater * waterModifier) - .energy(baseEnergy * energyModifier), - `enigmatica:base/unification/unify_growables/${arguments.callee.name}/` - ); -} - -function crops_immersiveengineering_cloche(event, type, crop) { - // Ticks Per Day: 24000 - // Ticks Per Minute: 1200 - var baseGrowthTicks = 800; - - var primaryCount = 2, - secondaryCount = 1, - plantSecondary, - growthTicks = baseGrowthTicks, - growthModifier = 1.0, - renderBlock = crop.render, - renderType = 'generic'; - - if (crop.plantSecondary) { - plantSecondary = crop.plantSecondary; + fallback_id( + event.recipes.thermal + .insolator(outputs, input) + .water(baseWater * waterModifier) + .energy(baseEnergy * energyModifier), + `enigmatica:base/unification/unify_growables/${arguments.callee.name}/` + ); } - /* + function crops_immersiveengineering_cloche(type, crop) { + // Ticks Per Day: 24000 + // Ticks Per Minute: 1200 + var baseGrowthTicks = 800; + + var primaryCount = 2, + secondaryCount = 1, + plantSecondary, + growthTicks = baseGrowthTicks, + growthModifier = 1.0, + renderBlock = crop.render, + renderType = 'generic'; + + if (crop.plantSecondary) { + plantSecondary = crop.plantSecondary; + } + + /* types: cactus, cane_like, coral, crop_fiber, crop_fruit, crop_gourd, crop_grain, crop_leafy, crop_legume, crop_melon, crop_root, crop_seed, crop_vine, flower, grass_like, kelp_like, lily_like, shroom, shrub, vine */ - switch (type) { - case 'cactus': - growthModifier = 1.5; - renderType = 'stacking'; - break; - case 'cane_like': - renderType = 'stacking'; - break; - case 'coral': - //disabled - return; - case 'crop_fiber': - primaryCount = 1; - secondaryCount = 2; - break; - case 'crop_grain': - growthModifier = 0.8; - break; - case 'crop_legume': - growthModifier = 0.7; - break; - case 'crop_vine': - growthModifier = 0.7; - break; - case 'crop_leafy': - growthModifier = 0.6; - break; - case 'crop_melon': - growthModifier = 1.5; - break; - case 'crop_gourd': - growthModifier = 1.5; - break; - case 'flower': - growthModifier = 0.5; - break; - case 'grass_like': - growthModifier = 0.5; - break; - case 'shroom': - growthModifier = 0.7; - plantSecondary = crop.plant; - break; - case 'kelp_like': - //disabled - return; - case 'lily_like': - //disabled - return; - case 'vine': - //disabled - return; - default: - //default - } - var substrate = crop.substrate; - switch (substrate) { - case 'crimson_nylium': - substrate = 'minecraft:crimson_nylium'; - break; - case 'deepturf': - substrate = 'undergarden:deepsoil'; - break; - case 'end_stone': - substrate = 'minecraft:end_stone'; - break; - case 'glowcelium': - substrate = 'byg:glowcelium_block'; - break; - case 'grass': - substrate = 'minecraft:grass_block'; - break; - case 'mushroom': - substrate = 'minecraft:mycelium'; - break; - case 'nether': - substrate = 'minecraft:netherrack'; - break; - case 'sand': - substrate = 'minecraft:sand'; - break; - case 'soul_sand': - substrate = 'minecraft:soul_sand'; - break; - case 'warped_nylium': - substrate = 'minecraft:warped_nylium'; - break; - case 'shadow_grass': - substrate = 'betterendforge:shadow_grass'; - break; - case 'end_mycelium': - substrate = 'betterendforge:end_mycelium'; - break; - case 'end_moss': - substrate = 'betterendforge:end_moss'; - break; - case 'jungle_moss': - substrate = 'betterendforge:jungle_moss'; - break; - case 'crystal_moss': - substrate = 'betterendforge:crystal_moss'; - break; - case 'chorus_nylium': - substrate = 'betterendforge:chorus_nylium'; - break; - case 'pink_moss': - substrate = 'betterendforge:pink_moss'; - break; - case 'amber_moss': - substrate = 'betterendforge:amber_moss'; - break; - case 'strange_sand': - substrate = 'atum:sand'; - break; - case 'frozen_deepturf': - substrate = 'undergarden:frozen_deepturf_block'; - break; - case 'sediment': - substrate = 'undergarden:sediment'; - break; - case 'water': - //disabled - return; - default: - substrate = 'minecraft:dirt'; - } + switch (type) { + case 'cactus': + growthModifier = 1.5; + renderType = 'stacking'; + break; + case 'cane_like': + renderType = 'stacking'; + break; + case 'coral': + //disabled + return; + case 'crop_fiber': + primaryCount = 1; + secondaryCount = 2; + break; + case 'crop_grain': + growthModifier = 0.8; + break; + case 'crop_legume': + growthModifier = 0.7; + break; + case 'crop_vine': + growthModifier = 0.7; + break; + case 'crop_leafy': + growthModifier = 0.6; + break; + case 'crop_melon': + growthModifier = 1.5; + break; + case 'crop_gourd': + growthModifier = 1.5; + break; + case 'flower': + growthModifier = 0.5; + break; + case 'grass_like': + growthModifier = 0.5; + break; + case 'shroom': + growthModifier = 0.7; + plantSecondary = crop.plant; + break; + case 'kelp_like': + //disabled + return; + case 'lily_like': + //disabled + return; + case 'vine': + //disabled + return; + default: + //default + } + var substrate = crop.substrate; + switch (substrate) { + case 'crimson_nylium': + substrate = 'minecraft:crimson_nylium'; + break; + case 'deepturf': + substrate = 'undergarden:deepsoil'; + break; + case 'end_stone': + substrate = 'minecraft:end_stone'; + break; + case 'glowcelium': + substrate = 'byg:glowcelium_block'; + break; + case 'grass': + substrate = 'minecraft:grass_block'; + break; + case 'mushroom': + substrate = 'minecraft:mycelium'; + break; + case 'nether': + substrate = 'minecraft:netherrack'; + break; + case 'sand': + substrate = 'minecraft:sand'; + break; + case 'soul_sand': + substrate = 'minecraft:soul_sand'; + break; + case 'warped_nylium': + substrate = 'minecraft:warped_nylium'; + break; + case 'shadow_grass': + substrate = 'betterendforge:shadow_grass'; + break; + case 'end_mycelium': + substrate = 'betterendforge:end_mycelium'; + break; + case 'end_moss': + substrate = 'betterendforge:end_moss'; + break; + case 'jungle_moss': + substrate = 'betterendforge:jungle_moss'; + break; + case 'crystal_moss': + substrate = 'betterendforge:crystal_moss'; + break; + case 'chorus_nylium': + substrate = 'betterendforge:chorus_nylium'; + break; + case 'pink_moss': + substrate = 'betterendforge:pink_moss'; + break; + case 'amber_moss': + substrate = 'betterendforge:amber_moss'; + break; + case 'strange_sand': + substrate = 'atum:sand'; + break; + case 'frozen_deepturf': + substrate = 'undergarden:frozen_deepturf_block'; + break; + case 'sediment': + substrate = 'undergarden:sediment'; + break; + case 'water': + //disabled + return; + default: + substrate = 'minecraft:dirt'; + } - var input = crop.seed, - outputs = [Item.of(crop.plant, primaryCount)]; + var input = crop.seed, + outputs = [Item.of(crop.plant, primaryCount)]; - if (type.includes('crop_')) { - //add seeds to crop type output - outputs.push(Item.of(crop.seed, secondaryCount)); - renderType = 'crop'; - } + if (type.includes('crop_')) { + //add seeds to crop type output + outputs.push(Item.of(crop.seed, secondaryCount)); + renderType = 'crop'; + } - if (crop.plant.includes('kenaf') || crop.plant.includes('hemp')) { - //override render type - renderType = 'hemp'; - } + if (crop.plant.includes('kenaf') || crop.plant.includes('hemp')) { + //override render type + renderType = 'hemp'; + } - if (type == 'crop_gourd' || crop.plant == 'minecraft:melon') { - renderType = 'stem'; - } + if (type == 'crop_gourd' || crop.plant == 'minecraft:melon') { + renderType = 'stem'; + } - if (crop.plant == 'simplefarming:zucchini' || crop.plant == 'simplefarming:squash_block') { - renderType = 'crop'; - } + if (crop.plant == 'simplefarming:zucchini' || crop.plant == 'simplefarming:squash_block') { + renderType = 'crop'; + } - if (plantSecondary && crop.plantSecondaryRate != 'low') { - //add any secondary - outputs.push(Item.of(plantSecondary, secondaryCount)); + if (plantSecondary && crop.plantSecondaryRate != 'low') { + //add any secondary + outputs.push(Item.of(plantSecondary, secondaryCount)); + } + fallback_id( + event.recipes.immersiveengineering + .cloche(outputs, input, substrate, { + type: renderType, + block: renderBlock + }) + .time(growthTicks * growthModifier), + `enigmatica:base/unification/unify_growables/${arguments.callee.name}/` + ); } - fallback_id( - event.recipes.immersiveengineering - .cloche(outputs, input, substrate, { - type: renderType, - block: renderBlock - }) - .time(growthTicks * growthModifier), - `enigmatica:base/unification/unify_growables/${arguments.callee.name}/` - ); -} - -function trees_botany_pots(event, type, tree) { - // Ticks Per Day: 24000 - // Ticks Per Minute: 1200 - var baseGrowthTicks = 24000, - growthModifier = 1.0; - - // chance, minRolls, maxRolls - var saplingRate = [1.0, 3, 6], - trunkRate = [1.0, 15, 20], - leafRate = [1.0, 15, 20], - stickRate = [1.0, 5, 10], - extraDecorationRate = [0.2, 5, 10], - fruitRate = [0.5, 5, 10], - growthTicks = baseGrowthTicks; - - var input = tree.sapling, - outputs = [ - { - chance: saplingRate[0], - output: { item: tree.sapling }, - minRolls: saplingRate[1], - maxRolls: saplingRate[2] - } - ]; - /* + + function trees_botany_pots(type, tree) { + // Ticks Per Day: 24000 + // Ticks Per Minute: 1200 + var baseGrowthTicks = 24000, + growthModifier = 1.0; + + // chance, minRolls, maxRolls + var saplingRate = [1.0, 3, 6], + trunkRate = [1.0, 15, 20], + leafRate = [1.0, 15, 20], + stickRate = [1.0, 5, 10], + extraDecorationRate = [0.2, 5, 10], + fruitRate = [0.5, 5, 10], + growthTicks = baseGrowthTicks; + + var input = tree.sapling, + outputs = [ + { + chance: saplingRate[0], + output: { item: tree.sapling }, + minRolls: saplingRate[1], + maxRolls: saplingRate[2] + } + ]; + /* types: tree, tree_shroom */ - if (type == 'tree') { - outputs.push( - { - chance: trunkRate[0], - output: { item: tree.trunk }, - minRolls: trunkRate[1], - maxRolls: trunkRate[2] - }, - { - chance: leafRate[0], - output: { item: tree.leaf }, - minRolls: leafRate[1], - maxRolls: leafRate[2] + if (type == 'tree') { + outputs.push( + { + chance: trunkRate[0], + output: { item: tree.trunk }, + minRolls: trunkRate[1], + maxRolls: trunkRate[2] + }, + { + chance: leafRate[0], + output: { item: tree.leaf }, + minRolls: leafRate[1], + maxRolls: leafRate[2] + } + ); + if (tree.extraDecoration) { + outputs.push({ + chance: extraDecorationRate[0], + output: { item: tree.extraDecoration }, + minRolls: extraDecorationRate[1], + maxRolls: extraDecorationRate[2] + }); + } + var stickType = 'minecraft:stick'; + if (type.includes('undergarden')) { + //add sticks + stickType = 'undergarden:twistytwig'; } - ); - if (tree.extraDecoration) { outputs.push({ - chance: extraDecorationRate[0], - output: { item: tree.extraDecoration }, - minRolls: extraDecorationRate[1], - maxRolls: extraDecorationRate[2] + chance: stickRate[0], + output: { item: stickType }, + minRolls: stickRate[1], + maxRolls: stickRate[2] }); + if (tree.fruit) { + //add any fruits + outputs.push({ + chance: fruitRate[0], + output: { item: tree.fruit }, + minRolls: fruitRate[1], + maxRolls: fruitRate[2] + }); + } } - var stickType = 'minecraft:stick'; - if (type.includes('undergarden')) { - //add sticks - stickType = 'undergarden:twistytwig'; + + if (type == 'tree_shroom') { + growthModifier = 0.5; } - outputs.push({ - chance: stickRate[0], - output: { item: stickType }, - minRolls: stickRate[1], - maxRolls: stickRate[2] + + event.custom({ + type: 'botanypots:crop', + seed: { item: input }, + categories: [tree.substrate], + growthTicks: growthTicks * growthModifier, + display: { block: input }, + results: outputs }); + } + + function trees_thermal_insolator(tree) { + var baseWater = 500, + baseEnergy = 20000, + waterModifier = 3.0, + energyModifier = 4.0; + + var saplingRate = 1.1, + trunkRate = 3.1, + leafRate = 4.5, + extraDecorationRate = 0.5, + fruitRate = 0.5; + + var input = tree.sapling, + outputs = [ + Item.of(tree.sapling).chance(saplingRate), + Item.of(tree.trunk).chance(trunkRate), + Item.of(tree.leaf).chance(leafRate) + ]; + if (tree.fruit) { //add any fruits - outputs.push({ - chance: fruitRate[0], - output: { item: tree.fruit }, - minRolls: fruitRate[1], - maxRolls: fruitRate[2] - }); + outputs.push(Item.of(tree.fruit).chance(fruitRate)); } - } - if (type == 'tree_shroom') { - growthModifier = 0.5; - } + if (tree.extraDecoration) { + //add any extra decorations + outputs.push(Item.of(tree.extraDecoration).chance(extraDecorationRate)); + } - event.custom({ - type: 'botanypots:crop', - seed: { item: input }, - categories: [tree.substrate], - growthTicks: growthTicks * growthModifier, - display: { block: input }, - results: outputs - }); -} - -function trees_thermal_insolator(event, tree) { - var baseWater = 500, - baseEnergy = 20000, - waterModifier = 3.0, - energyModifier = 4.0; - - var saplingRate = 1.1, - trunkRate = 3.1, - leafRate = 4.5, - extraDecorationRate = 0.5, - fruitRate = 0.5; - - var input = tree.sapling, - outputs = [ - Item.of(tree.sapling).chance(saplingRate), - Item.of(tree.trunk).chance(trunkRate), - Item.of(tree.leaf).chance(leafRate) - ]; - - if (tree.fruit) { - //add any fruits - outputs.push(Item.of(tree.fruit).chance(fruitRate)); + fallback_id( + event.recipes.thermal + .insolator(outputs, input) + .water(baseWater * waterModifier) + .energy(baseEnergy * energyModifier), + `enigmatica:base/unification/unify_growables/${arguments.callee.name}/` + ); } - if (tree.extraDecoration) { - //add any extra decorations - outputs.push(Item.of(tree.extraDecoration).chance(extraDecorationRate)); - } + function trees_immersiveengineering_cloche(tree) { + // Ticks Per Day: 24000 + // Ticks Per Minute: 1200 + var baseGrowthTicks = 800, + growthModifier = 6; + + var saplingRate = 1, + trunkRate = 3, + leafRate = 4, + extraDecorationRate = 1, + fruitRate = 1, + renderBlock = tree.sapling, + renderType = 'generic'; + + var input = tree.sapling, + outputs = [ + Item.of(tree.sapling, saplingRate), + Item.of(tree.trunk, trunkRate), + Item.of(tree.leaf, leafRate) + ]; + + var substrate = tree.substrate; + switch (substrate) { + case 'crimson_nylium': + substrate = 'minecraft:crimson_nylium'; + break; + case 'deepturf': + substrate = 'undergarden:deepsoil'; + break; + case 'end_stone': + substrate = 'minecraft:end_stone'; + break; + case 'glowcelium': + substrate = 'byg:glowcelium_block'; + break; + case 'mushroom': + substrate = 'minecraft:mycelium'; + break; + case 'nether': + substrate = 'minecraft:netherrack'; + break; + case 'warped_nylium': + substrate = 'minecraft:warped_nylium'; + break; + case 'jungle_moss': + substrate = 'betterendforge:jungle_moss'; + break; + case 'end_moss': + substrate = 'betterendforge:end_moss'; + break; + case 'amber_moss': + substrate = 'betterendforge:amber_moss'; + break; + case 'pink_moss': + substrate = 'betterendforge:pink_moss'; + break; + case 'chorus_nylium': + substrate = 'betterendforge:chorus_nylium'; + break; + case 'end_moss': + substrate = 'betterendforge:end_moss'; + break; + case 'shadow_grass': + substrate = 'betterendforge:shadow_grass'; + break; + default: + substrate = 'minecraft:dirt'; + } - fallback_id( - event.recipes.thermal - .insolator(outputs, input) - .water(baseWater * waterModifier) - .energy(baseEnergy * energyModifier), - `enigmatica:base/unification/unify_growables/${arguments.callee.name}/` - ); -} - -function trees_immersiveengineering_cloche(event, tree) { - // Ticks Per Day: 24000 - // Ticks Per Minute: 1200 - var baseGrowthTicks = 800, - growthModifier = 6; - - var saplingRate = 1, - trunkRate = 3, - leafRate = 4, - extraDecorationRate = 1, - fruitRate = 1, - renderBlock = tree.sapling, - renderType = 'generic'; - - var input = tree.sapling, - outputs = [Item.of(tree.sapling, saplingRate), Item.of(tree.trunk, trunkRate), Item.of(tree.leaf, leafRate)]; - - var substrate = tree.substrate; - switch (substrate) { - case 'crimson_nylium': - substrate = 'minecraft:crimson_nylium'; - break; - case 'deepturf': - substrate = 'undergarden:deepsoil'; - break; - case 'end_stone': - substrate = 'minecraft:end_stone'; - break; - case 'glowcelium': - substrate = 'byg:glowcelium_block'; - break; - case 'mushroom': - substrate = 'minecraft:mycelium'; - break; - case 'nether': - substrate = 'minecraft:netherrack'; - break; - case 'warped_nylium': - substrate = 'minecraft:warped_nylium'; - break; - case 'jungle_moss': - substrate = 'betterendforge:jungle_moss'; - break; - case 'end_moss': - substrate = 'betterendforge:end_moss'; - break; - case 'amber_moss': - substrate = 'betterendforge:amber_moss'; - break; - case 'pink_moss': - substrate = 'betterendforge:pink_moss'; - break; - case 'chorus_nylium': - substrate = 'betterendforge:chorus_nylium'; - break; - case 'end_moss': - substrate = 'betterendforge:end_moss'; - break; - case 'shadow_grass': - substrate = 'betterendforge:shadow_grass'; - break; - default: - substrate = 'minecraft:dirt'; - } + if (tree.fruit) { + //add any fruits + outputs.push(Item.of(tree.fruit, fruitRate)); + } - if (tree.fruit) { - //add any fruits - outputs.push(Item.of(tree.fruit, fruitRate)); - } + if (tree.extraDecoration) { + //add any extra decorations + outputs.push(Item.of(tree.extraDecoration, extraDecorationRate)); + } - if (tree.extraDecoration) { - //add any extra decorations - outputs.push(Item.of(tree.extraDecoration, extraDecorationRate)); + fallback_id( + event.recipes.immersiveengineering + .cloche(outputs, input, substrate, { + type: renderType, + block: renderBlock + }) + .time(baseGrowthTicks * growthModifier), + `enigmatica:base/unification/unify_growables/${arguments.callee.name}/` + ); } - - fallback_id( - event.recipes.immersiveengineering - .cloche(outputs, input, substrate, { - type: renderType, - block: renderBlock - }) - .time(baseGrowthTicks * growthModifier), - `enigmatica:base/unification/unify_growables/${arguments.callee.name}/` - ); -} +}); diff --git a/kubejs/server_scripts/enigmatica/kubejs/base/unification/unify_materials.js b/kubejs/server_scripts/enigmatica/kubejs/base/unification/unify_materials.js index ed3512ebc0..6ae046f530 100644 --- a/kubejs/server_scripts/enigmatica/kubejs/base/unification/unify_materials.js +++ b/kubejs/server_scripts/enigmatica/kubejs/base/unification/unify_materials.js @@ -29,31 +29,31 @@ onEvent('recipes', (event) => { let coin = getPreferredItemInTag(Ingredient.of(`#forge:coins/${material}`)).id; - astralsorcery_ore_processing_infuser(event, material, ore, ingot, gem, shard); + astralsorcery_ore_processing_infuser(material, ore, ingot, gem, shard); - betterend_alloys(event, material, ore, ingot); + betterend_alloys(material, ore, ingot); - bloodmagic_metal_ore_processing(event, material, ore, fragment, gravel, dust, ingot); - bloodmagic_gem_ore_processing(event, material, ore, gem, shard, dust); - bloodmagic_ingot_gem_crushing(event, material, ingot, dust, gem); + bloodmagic_metal_ore_processing(material, ore, fragment, gravel, dust, ingot); + bloodmagic_gem_ore_processing(material, ore, gem, shard, dust); + bloodmagic_ingot_gem_crushing(material, ingot, dust, gem); - create_metal_ore_processing(event, material, ore, crushed_ore, ingot, nugget); - create_gem_ore_processing(event, material, ore, gem, dust, shard); - create_ingot_gem_milling(event, material, ingot, dust, gem); - create_metal_block_processing(event, material, crushed_ore, ingot, nugget); + create_metal_ore_processing(material, ore, crushed_ore, ingot, nugget); + create_gem_ore_processing(material, ore, gem, dust, shard); + create_ingot_gem_milling(material, ingot, dust, gem); + create_metal_block_processing(material, crushed_ore, ingot, nugget); - emendatus_item_melting(event, material, ore, block, ingot, nugget, gem, dust, gear, rod, plate); - emendatus_hammer_crushing(event, material, ore, dust); - emendatus_shapeless_transform(event, material, ore, chunk); + emendatus_item_melting(material, ore, block, ingot, nugget, gem, dust, gear, rod, plate); + emendatus_hammer_crushing(material, ore, dust); + emendatus_shapeless_transform(material, ore, chunk); - immersiveengineering_ingot_crushing(event, material, dust, ingot); - immersiveengineering_gem_ore_processing(event, material, ore, dust, gem, shard); - immersiveengineering_hammer_crushing(event, material, ore, dust, gem); - immersiveengineering_gem_crushing(event, material, dust, gem); - immersiveengineering_coin_pressing(event, material, ingot, nugget, coin); + immersiveengineering_ingot_crushing(material, dust, ingot); + immersiveengineering_gem_ore_processing(material, ore, dust, gem, shard); + immersiveengineering_hammer_crushing(material, ore, dust, gem); + immersiveengineering_gem_crushing(material, dust, gem); + immersiveengineering_coin_pressing(material, ingot, nugget, coin); - mekanism_ingot_gem_crushing(event, material, ingot, dust, gem); - mekanism_gem_ore_processing(event, material, ore, dust, gem, shard); + mekanism_ingot_gem_crushing(material, ingot, dust, gem); + mekanism_gem_ore_processing(material, ore, dust, gem, shard); mekanism_metal_ore_processing( event, material, @@ -66,36 +66,36 @@ onEvent('recipes', (event) => { ingot ); - minecraft_gem_ore_smelting(event, material, ore, gem); - minecraft_dust_smelting(event, material, dust, ingot); + minecraft_gem_ore_smelting(material, ore, gem); + minecraft_dust_smelting(material, dust, ingot); - occultism_gem_ore_crushing(event, material, ore, dust, gem, shard); - occultism_metal_ore_crushing(event, material, ore, dust, ingot); - occultism_ingot_gem_crushing(event, material, ingot, dust, gem); + occultism_gem_ore_crushing(material, ore, dust, gem, shard); + occultism_metal_ore_crushing(material, ore, dust, ingot); + occultism_ingot_gem_crushing(material, ingot, dust, gem); - ars_nouveau_gem_ore_crushing(event, material, ore, dust, gem, shard); - ars_nouveau_metal_ore_crushing(event, material, ore, dust, ingot); - ars_nouveau_ingot_gem_crushing(event, material, ingot, dust, gem); + ars_nouveau_gem_ore_crushing(material, ore, dust, gem, shard); + ars_nouveau_metal_ore_crushing(material, ore, dust, ingot); + ars_nouveau_ingot_gem_crushing(material, ingot, dust, gem); - pedestals_gem_ore_crushing(event, material, ore, dust, shard, gem); - pedestals_metal_ore_crushing(event, material, ore, ingot, dust); - pedestals_ingot_gem_crushing(event, material, ingot, dust, gem); + pedestals_gem_ore_crushing(material, ore, dust, shard, gem); + pedestals_metal_ore_crushing(material, ore, ingot, dust); + pedestals_ingot_gem_crushing(material, ingot, dust, gem); - thermal_metal_ore_pulverizing(event, material, ore, dust, ingot); - thermal_gem_ore_pulverizing(event, material, ore, dust, gem, shard); - thermal_ingot_gem_pulverizing(event, material, ingot, dust, gem); - thermal_metal_casting(event, material, ingot, nugget, gear, rod, plate); - thermal_metal_melting(event, material, block, ingot, nugget, gear, rod, plate); - thermal_gem_casting(event, material, gem, gear, rod, plate); - thermal_gem_melting(event, material, block, gem, gear, rod, plate); + thermal_metal_ore_pulverizing(material, ore, dust, ingot); + thermal_gem_ore_pulverizing(material, ore, dust, gem, shard); + thermal_ingot_gem_pulverizing(material, ingot, dust, gem); + thermal_metal_casting(material, ingot, nugget, gear, rod, plate); + thermal_metal_melting(material, block, ingot, nugget, gear, rod, plate); + thermal_gem_casting(material, gem, gear, rod, plate); + thermal_gem_melting(material, block, gem, gear, rod, plate); - tconstruct_metal_casting(event, material, block, ingot, nugget, gear, rod, plate); - tconstruct_gem_casting(event, material, block, gem, gear, rod, plate); + tconstruct_metal_casting(material, block, ingot, nugget, gear, rod, plate); + tconstruct_gem_casting(material, block, gem, gear, rod, plate); - material_packing_unpacking(event, material, block, ingot, gem, nugget); + material_packing_unpacking(material, block, ingot, gem, nugget); }); - function astralsorcery_ore_processing_infuser(event, material, ore, ingot, gem, shard) { + function astralsorcery_ore_processing_infuser(material, ore, ingot, gem, shard) { if (ore == air) { return; } @@ -155,7 +155,7 @@ onEvent('recipes', (event) => { ); } - function betterend_alloys(event, material, ore, ingot) { + function betterend_alloys(material, ore, ingot) { if (ore == air || ingot == air) { return; } @@ -172,7 +172,7 @@ onEvent('recipes', (event) => { ); } - function bloodmagic_metal_ore_processing(event, material, ore, fragment, gravel, dust, ingot) { + function bloodmagic_metal_ore_processing(material, ore, fragment, gravel, dust, ingot) { if (ore == air || ingot == air || fragment == air) { return; } @@ -225,7 +225,7 @@ onEvent('recipes', (event) => { .upgradeLevel(1) .id(`bloodmagic:alchemytable/sand_${material}`); } - function bloodmagic_gem_ore_processing(event, material, ore, gem, shard, dust) { + function bloodmagic_gem_ore_processing(material, ore, gem, shard, dust) { if (ore == air) { return; } @@ -262,7 +262,7 @@ onEvent('recipes', (event) => { `${id_prefix}${arguments.callee.name}/` ); } - function bloodmagic_ingot_gem_crushing(event, material, ingot, dust, gem) { + function bloodmagic_ingot_gem_crushing(material, ingot, dust, gem) { if (dust == air) { return; } @@ -286,7 +286,7 @@ onEvent('recipes', (event) => { .id(`bloodmagic:arc/dustsfrom_${type}_${material}`); } - function create_metal_ore_processing(event, material, ore, crushed_ore, ingot, nugget) { + function create_metal_ore_processing(material, ore, crushed_ore, ingot, nugget) { if (ore == air || crushed_ore == air || ingot == air) { return; } @@ -343,7 +343,7 @@ onEvent('recipes', (event) => { .id(`create:crushing/${material}_ore`); } - function create_gem_ore_processing(event, material, ore, gem, dust, shard) { + function create_gem_ore_processing(material, ore, gem, dust, shard) { if (ore == air) { return; } @@ -390,7 +390,7 @@ onEvent('recipes', (event) => { .id(`create:crushing/${material}_ore`); } - function create_ingot_gem_milling(event, material, ingot, dust, gem) { + function create_ingot_gem_milling(material, ingot, dust, gem) { if (dust == air) { return; } @@ -412,7 +412,7 @@ onEvent('recipes', (event) => { ); } - function create_metal_block_processing(event, material, crushed_ore, ingot, nugget) { + function create_metal_block_processing(material, crushed_ore, ingot, nugget) { if (ingot == air || crushed_ore == air) { return; } @@ -437,7 +437,7 @@ onEvent('recipes', (event) => { event.smelting(output, input).xp(0.1).id(`create:smelting/${material}_ingot_from_crushed`); } - function emendatus_item_melting(event, material, ore, block, ingot, nugget, gem, dust, gear, rod, plate) { + function emendatus_item_melting(material, ore, block, ingot, nugget, gem, dust, gear, rod, plate) { let modId; if (material == 'redstone') { return; @@ -532,7 +532,7 @@ onEvent('recipes', (event) => { } } - function emendatus_hammer_crushing(event, material, ore, dust) { + function emendatus_hammer_crushing(material, ore, dust) { if (ore == air || dust == air) { return; } @@ -544,7 +544,7 @@ onEvent('recipes', (event) => { ); } - function emendatus_shapeless_transform(event, material, ore, chunk) { + function emendatus_shapeless_transform(material, ore, chunk) { if (ore == air || chunk == air) { return; } @@ -560,7 +560,7 @@ onEvent('recipes', (event) => { .id(`emendatusenigmatica:chunk_from_cluster/${material}`); } - function immersiveengineering_hammer_crushing(event, material, ore, dust, gem) { + function immersiveengineering_hammer_crushing(material, ore, dust, gem) { if (ore == air || dust == air) { return; } @@ -576,7 +576,7 @@ onEvent('recipes', (event) => { event.shapeless(output, [input, hammer]).id(`enigmatica:base/enigmatica/${material}_dust`); } - function immersiveengineering_gem_crushing(event, material, dust, gem) { + function immersiveengineering_gem_crushing(material, dust, gem) { if (gem == air || dust == air) { return; } @@ -589,7 +589,7 @@ onEvent('recipes', (event) => { `${id_prefix}${arguments.callee.name}/` ); } - function immersiveengineering_coin_pressing(event, material, ingot, nugget, coin) { + function immersiveengineering_coin_pressing(material, ingot, nugget, coin) { if (ingot == air || nugget == air || coin == air) { return; } @@ -613,7 +613,7 @@ onEvent('recipes', (event) => { ); } - function immersiveengineering_ingot_crushing(event, material, dust, ingot) { + function immersiveengineering_ingot_crushing(material, dust, ingot) { if (ingot == air || dust == air) { return; } @@ -629,7 +629,7 @@ onEvent('recipes', (event) => { } } - function immersiveengineering_gem_ore_processing(event, material, ore, dust, gem, shard) { + function immersiveengineering_gem_ore_processing(material, ore, dust, gem, shard) { if (ore == air) { return; } @@ -674,7 +674,7 @@ onEvent('recipes', (event) => { } } - function mekanism_ingot_gem_crushing(event, material, ingot, dust, gem) { + function mekanism_ingot_gem_crushing(material, ingot, dust, gem) { if (dust == air) { return; } @@ -700,7 +700,7 @@ onEvent('recipes', (event) => { event.recipes.mekanism.crushing(output, input).id(`mekanism:processing/${material}/to_dust`); } - function mekanism_gem_ore_processing(event, material, ore, dust, gem, shard) { + function mekanism_gem_ore_processing(material, ore, dust, gem, shard) { if (ore == air) { return; } @@ -829,7 +829,7 @@ onEvent('recipes', (event) => { .id(`mekanism:processing/${material}/dust/from_ore`); } - function minecraft_gem_ore_smelting(event, material, ore, gem) { + function minecraft_gem_ore_smelting(material, ore, gem) { if (ore == air || gem == air) { return; } @@ -849,7 +849,7 @@ onEvent('recipes', (event) => { event.blasting(output, input).xp(0.7).xp(0.7).id(`${id_prefix}blasting/${material}/gem/from_ore`); } - function minecraft_dust_smelting(event, material, dust, ingot) { + function minecraft_dust_smelting(material, dust, ingot) { if (ingot == air || dust == air) { return; } @@ -869,7 +869,7 @@ onEvent('recipes', (event) => { event.blasting(output, input).xp(0.7).id(`${id_prefix}blasting/${material}/ingot/from_dust`); } - function occultism_gem_ore_crushing(event, material, ore, dust, gem, shard) { + function occultism_gem_ore_crushing(material, ore, dust, gem, shard) { if (ore == air) { return; } @@ -908,7 +908,7 @@ onEvent('recipes', (event) => { .id(`${id_prefix}occultism_crushing/${material}/${materialProperties.output}/from_ore`); } - function occultism_metal_ore_crushing(event, material, ore, dust, ingot) { + function occultism_metal_ore_crushing(material, ore, dust, ingot) { if (ore == air || ingot == air || dust == air) { return; } @@ -928,7 +928,7 @@ onEvent('recipes', (event) => { .id(`occultism:crushing/${material}_dust`); } - function occultism_ingot_gem_crushing(event, material, ingot, dust, gem) { + function occultism_ingot_gem_crushing(material, ingot, dust, gem) { if (dust == air) { return; } @@ -963,7 +963,7 @@ onEvent('recipes', (event) => { ); } - function ars_nouveau_gem_ore_crushing(event, material, ore, dust, gem, shard) { + function ars_nouveau_gem_ore_crushing(material, ore, dust, gem, shard) { if (ore == air) { return; } @@ -1010,7 +1010,7 @@ onEvent('recipes', (event) => { .id(`ars_nouveau:crushing/${material}_from_ore`); } - function ars_nouveau_metal_ore_crushing(event, material, ore, dust, ingot) { + function ars_nouveau_metal_ore_crushing(material, ore, dust, ingot) { if (ore == air || ingot == air || dust == air) { return; } @@ -1039,7 +1039,7 @@ onEvent('recipes', (event) => { .id(`ars_nouveau:crushing/${material}_dust_from_ore`); } - function ars_nouveau_ingot_gem_crushing(event, material, ingot, dust, gem) { + function ars_nouveau_ingot_gem_crushing(material, ingot, dust, gem) { if (dust == air) { return; } @@ -1071,7 +1071,7 @@ onEvent('recipes', (event) => { .id(`ars_nouveau:crushing/${material}_dust`); } - function pedestals_gem_ore_crushing(event, material, ore, dust, shard, gem) { + function pedestals_gem_ore_crushing(material, ore, dust, shard, gem) { if (ore == air) { return; } @@ -1107,7 +1107,7 @@ onEvent('recipes', (event) => { }) .id(`pedestals:pedestal_crushing/dust${material}`); } - function pedestals_metal_ore_crushing(event, material, ore, ingot, dust) { + function pedestals_metal_ore_crushing(material, ore, ingot, dust) { if (ore == air || ingot == air || dust == air) { return; } @@ -1134,7 +1134,7 @@ onEvent('recipes', (event) => { .id(`pedestals:pedestal_crushing/dust${material}`); } - function pedestals_ingot_gem_crushing(event, material, ingot, dust, gem) { + function pedestals_ingot_gem_crushing(material, ingot, dust, gem) { if (dust == air) { return; } @@ -1164,7 +1164,7 @@ onEvent('recipes', (event) => { ); } - function thermal_metal_ore_pulverizing(event, material, ore, dust, ingot) { + function thermal_metal_ore_pulverizing(material, ore, dust, ingot) { if (ore == air || dust == air || ingot == air) { return; } @@ -1204,7 +1204,7 @@ onEvent('recipes', (event) => { .id(`thermal:machine/pulverizer/pulverizer_${material}_ore`); } - function thermal_gem_ore_pulverizing(event, material, ore, dust, gem, shard) { + function thermal_gem_ore_pulverizing(material, ore, dust, gem, shard) { if (ore == air) { return; } @@ -1259,7 +1259,7 @@ onEvent('recipes', (event) => { .id(`thermal:machine/pulverizer/pulverizer_${material}_ore`); } - function thermal_ingot_gem_pulverizing(event, material, ingot, dust, gem) { + function thermal_ingot_gem_pulverizing(material, ingot, dust, gem) { if (dust == air) { return; } @@ -1284,7 +1284,7 @@ onEvent('recipes', (event) => { fallback_id(event.recipes.thermal.pulverizer(output, input), `${id_prefix}${arguments.callee.name}/`); } - function thermal_metal_casting(event, material, ingot, nugget, gear, rod, plate) { + function thermal_metal_casting(material, ingot, nugget, gear, rod, plate) { if (ingot == air) { return; } @@ -1327,7 +1327,7 @@ onEvent('recipes', (event) => { }); } - function thermal_metal_melting(event, material, block, ingot, nugget, gear, rod, plate) { + function thermal_metal_melting(material, block, ingot, nugget, gear, rod, plate) { if (ingot == air) { return; } @@ -1370,7 +1370,7 @@ onEvent('recipes', (event) => { }); } - function thermal_gem_casting(event, material, gem, gear, rod, plate) { + function thermal_gem_casting(material, gem, gear, rod, plate) { if (gem == air) { return; } @@ -1418,7 +1418,7 @@ onEvent('recipes', (event) => { }); } - function thermal_gem_melting(event, material, block, gem, gear, rod, plate) { + function thermal_gem_melting(material, block, gem, gear, rod, plate) { if (gem == air) { return; } @@ -1478,7 +1478,7 @@ onEvent('recipes', (event) => { }); } - function tconstruct_metal_casting(event, material, block, ingot, nugget, gear, rod, plate) { + function tconstruct_metal_casting(material, block, ingot, nugget, gear, rod, plate) { if (ingot == air) { return; } @@ -1545,7 +1545,7 @@ onEvent('recipes', (event) => { } } - function tconstruct_gem_casting(event, material, block, gem, gear, rod, plate) { + function tconstruct_gem_casting(material, block, gem, gear, rod, plate) { if (gem == air) { return; } @@ -1608,7 +1608,7 @@ onEvent('recipes', (event) => { .id(`tconstruct:smeltery/casting/${material}/block`); } - function material_packing_unpacking(event, material, block, ingot, gem, nugget) { + function material_packing_unpacking(material, block, ingot, gem, nugget) { blacklistedMaterials = ['ender', 'amber', 'quartz']; for (var i = 0; i < blacklistedMaterials.length; i++) { if (blacklistedMaterials[i] == material) { diff --git a/kubejs/server_scripts/enigmatica/kubejs/base/unification/unify_sawables.js b/kubejs/server_scripts/enigmatica/kubejs/base/unification/unify_sawables.js index 5585d9c904..a06c3e32cd 100644 --- a/kubejs/server_scripts/enigmatica/kubejs/base/unification/unify_sawables.js +++ b/kubejs/server_scripts/enigmatica/kubejs/base/unification/unify_sawables.js @@ -4,236 +4,218 @@ onEvent('recipes', (event) => { var sawDust = 'emendatusenigmatica:wood_dust', treeBark = 'farmersdelight:tree_bark'; - create_cutting(event, variant, sawDust, treeBark); - immersiveengineering_sawing(event, variant, sawDust, treeBark); - mekanism_sawing(event, variant, sawDust); - pedestal_sawing(event, variant); - thermal_sawing(event, variant, sawDust); + create_cutting(variant, sawDust, treeBark); + immersiveengineering_sawing(variant, sawDust, treeBark); + mekanism_sawing(variant, sawDust); + pedestal_sawing(variant); + thermal_sawing(variant, sawDust); }); -}); - -function create_cutting(event, variant, sawDust, treeBark) { - data = { - recipes: [ - { - input: variant.logBlock, - output: variant.logBlockStripped, - secondaryOutput: treeBark, - count: 1, - time: 50 - }, - { - input: variant.woodBlock, - output: variant.woodBlockStripped, - secondaryOutput: treeBark, - count: 1, - time: 50 - }, - { - input: variant.logBlockStripped, - output: variant.plankBlock, - secondaryOutput: sawDust, - count: 6, - time: 100 - }, - { - input: variant.woodBlockStripped, - output: variant.plankBlock, - secondaryOutput: sawDust, - count: 6, - time: 100 - } - ] - }; - - data.recipes.forEach((recipe) => { - fallback_id( - event.recipes.create.cutting({ - type: 'create:cutting', - ingredients: [ - { - item: recipe.input - } - ], - results: [ - { - item: recipe.output, - count: recipe.count - }, - { - item: recipe.secondaryOutput, - count: 1 - } - ], - processingTime: recipe.time - }), - `enigmatica:base/unification/unify_sawables/${arguments.callee.name}/` - ); - }); -} -function immersiveengineering_sawing(event, variant, sawDust, treeBark) { - fallback_id( - event.recipes.immersiveengineering - .sawmill(Item.of(variant.plankBlock, 6), variant.logBlockStripped, [ + function create_cutting(variant, sawDust, treeBark) { + data = { + recipes: [ + { + input: variant.logBlock, + output: variant.logBlockStripped, + secondaryOutput: treeBark, + count: 1, + time: 50 + }, + { + input: variant.woodBlock, + output: variant.woodBlockStripped, + secondaryOutput: treeBark, + count: 1, + time: 50 + }, { - stripping: false, - output: sawDust + input: variant.logBlockStripped, + output: variant.plankBlock, + secondaryOutput: sawDust, + count: 6, + time: 100 + }, + { + input: variant.woodBlockStripped, + output: variant.plankBlock, + secondaryOutput: sawDust, + count: 6, + time: 100 } - ]) - .energy(800), - `enigmatica:base/unification/unify_sawables/${arguments.callee.name}/` - ); + ] + }; - fallback_id( - event.recipes.immersiveengineering - .sawmill( - Item.of(variant.plankBlock, 6), - [variant.logBlock, variant.woodBlock], - [ - { - stripping: true, - output: treeBark - }, + data.recipes.forEach((recipe) => { + const builder = event.recipes.create + .cutting([Item.of(recipe.output, recipe.count), Item.of(recipe.secondaryOutput, 1)], recipe.input) + .processingTime(recipe.time); + fallback_id(builder, `enigmatica:base/unification/unify_sawables/${arguments.callee.name}/`); + }); + } + + function immersiveengineering_sawing(variant, sawDust, treeBark) { + fallback_id( + event.recipes.immersiveengineering + .sawmill(Item.of(variant.plankBlock, 6), variant.logBlockStripped, [ { stripping: false, output: sawDust } - ], - variant.logBlockStripped - ) - .energy(1600), - `enigmatica:base/unification/unify_sawables/${arguments.callee.name}/` - ); -} - -function mekanism_sawing(event, variant, sawDust) { - if (variant.modId == 'minecraft') { - event.remove({ - output: variant.plankBlock, - mod: 'mekanism', - type: 'mekanism:sawing' - }); - } - - if (variant.logBlock == 'byg:withering_oak_log') { - return; - } - - var data = { - recipes: [ - { - input: variant.logBlock, - output: variant.plankBlock - }, - { - input: variant.woodBlock, - output: variant.plankBlock - }, - { - input: variant.logBlockStripped, - output: variant.plankBlock - }, - { - input: variant.woodBlockStripped, - output: variant.plankBlock - } - ] - }; + ]) + .energy(800), + `enigmatica:base/unification/unify_sawables/${arguments.callee.name}/` + ); - data.recipes.forEach((recipe) => { fallback_id( - event.recipes.mekanism.sawing(Item.of(recipe.output, 6), recipe.input, Item.of(sawDust).chance(0.25)), + event.recipes.immersiveengineering + .sawmill( + Item.of(variant.plankBlock, 6), + [variant.logBlock, variant.woodBlock], + [ + { + stripping: true, + output: treeBark + }, + { + stripping: false, + output: sawDust + } + ], + variant.logBlockStripped + ) + .energy(1600), `enigmatica:base/unification/unify_sawables/${arguments.callee.name}/` ); - }); -} -function pedestal_sawing(event, variant) { - // mod blacklist - if (variant.modId == 'minecraft') { - return; } - var data = { - recipes: [ - { - input: variant.logBlock, + function mekanism_sawing(variant, sawDust) { + if (variant.modId == 'minecraft') { + event.remove({ output: variant.plankBlock, - count: 6 - }, - { - input: variant.woodBlock, - output: variant.plankBlock, - count: 6 - }, - { - input: variant.logBlockStripped, - output: variant.plankBlock, - count: 6 - }, - { - input: variant.woodBlockStripped, - output: variant.plankBlock, - count: 6 - } - ] - }; + mod: 'mekanism', + type: 'mekanism:sawing' + }); + } - data.recipes.forEach((recipe) => { - fallback_id( - event.recipes.pedestals.pedestal_sawing({ - type: 'pedestals:pedestal_sawing', - ingredient: { - item: recipe.input + if (variant.logBlock == 'byg:withering_oak_log') { + return; + } + + var data = { + recipes: [ + { + input: variant.logBlock, + output: variant.plankBlock + }, + { + input: variant.woodBlock, + output: variant.plankBlock }, - result: { - item: recipe.output, - count: recipe.count + { + input: variant.logBlockStripped, + output: variant.plankBlock + }, + { + input: variant.woodBlockStripped, + output: variant.plankBlock } - }), - `enigmatica:base/unification/unify_sawables/${arguments.callee.name}/` - ); - }); -} -function thermal_sawing(event, variant, sawDust) { - // mod blacklist - if ( - variant.modId == 'minecraft' || - variant.modId == 'byg' || - variant.modId == 'autumnity' || - variant.modId == 'atmospheric' || - variant.modId == 'upgrade_aquatic' - ) { - return; + ] + }; + + data.recipes.forEach((recipe) => { + fallback_id( + event.recipes.mekanism.sawing(Item.of(recipe.output, 6), recipe.input, Item.of(sawDust).chance(0.25)), + `enigmatica:base/unification/unify_sawables/${arguments.callee.name}/` + ); + }); } + function pedestal_sawing(variant) { + // mod blacklist + if (variant.modId == 'minecraft') { + return; + } - var data = { - recipes: [ - { - input: variant.logBlock, - output: variant.plankBlock - }, - { - input: variant.woodBlock, - output: variant.plankBlock - }, - { - input: variant.logBlockStripped, - output: variant.plankBlock - }, - { - input: variant.woodBlockStripped, - output: variant.plankBlock - } - ] - }; + var data = { + recipes: [ + { + input: variant.logBlock, + output: variant.plankBlock, + count: 6 + }, + { + input: variant.woodBlock, + output: variant.plankBlock, + count: 6 + }, + { + input: variant.logBlockStripped, + output: variant.plankBlock, + count: 6 + }, + { + input: variant.woodBlockStripped, + output: variant.plankBlock, + count: 6 + } + ] + }; - data.recipes.forEach((recipe) => { - fallback_id( - event.recipes.thermal - .sawmill([Item.of(recipe.output, 6), Item.of(sawDust).chance(1.25)], recipe.input) - .energy(1000), - `enigmatica:base/unification/unify_sawables/${arguments.callee.name}/` - ); - }); -} + data.recipes.forEach((recipe) => { + fallback_id( + event.recipes.pedestals.pedestal_sawing({ + type: 'pedestals:pedestal_sawing', + ingredient: { + item: recipe.input + }, + result: { + item: recipe.output, + count: recipe.count + } + }), + `enigmatica:base/unification/unify_sawables/${arguments.callee.name}/` + ); + }); + } + function thermal_sawing(variant, sawDust) { + // mod blacklist + if ( + variant.modId == 'minecraft' || + variant.modId == 'byg' || + variant.modId == 'autumnity' || + variant.modId == 'atmospheric' || + variant.modId == 'upgrade_aquatic' + ) { + return; + } + + var data = { + recipes: [ + { + input: variant.logBlock, + output: variant.plankBlock + }, + { + input: variant.woodBlock, + output: variant.plankBlock + }, + { + input: variant.logBlockStripped, + output: variant.plankBlock + }, + { + input: variant.woodBlockStripped, + output: variant.plankBlock + } + ] + }; + + data.recipes.forEach((recipe) => { + fallback_id( + event.recipes.thermal + .sawmill([Item.of(recipe.output, 6), Item.of(sawDust).chance(1.25)], recipe.input) + .energy(1000), + `enigmatica:base/unification/unify_sawables/${arguments.callee.name}/` + ); + }); + } +}); diff --git a/kubejs/server_scripts/enigmatica/kubejs/base/unification/unify_stoneworks.js b/kubejs/server_scripts/enigmatica/kubejs/base/unification/unify_stoneworks.js index 1f4504c2c8..e1c0f6f3df 100644 --- a/kubejs/server_scripts/enigmatica/kubejs/base/unification/unify_stoneworks.js +++ b/kubejs/server_scripts/enigmatica/kubejs/base/unification/unify_stoneworks.js @@ -3,78 +3,78 @@ onEvent('recipes', (event) => { generatableCobblestone.forEach((material) => { var type = 'cobble'; //console.log(`Recipe for Material: ${material}, Type: ${type}`); - pedestals_stoneworks(event, material, type); - industrialforegoing_stoneworks(event, material, type); - thermal_stoneworks(event, material); + pedestals_stoneworks(material, type); + industrialforegoing_stoneworks(material, type); + thermal_stoneworks(material); }); generatableStone.forEach((material) => { var type = 'stone'; //console.log(`Recipe for Material: ${material}, Type: ${type}`); - pedestals_stoneworks(event, material, type); - industrialforegoing_stoneworks(event, material, type); - thermal_stoneworks(event, material); + pedestals_stoneworks(material, type); + industrialforegoing_stoneworks(material, type); + thermal_stoneworks(material); }); -}); -//stoneworks functions -function pedestals_stoneworks(event, material, type) { - var recipeType = 'pedestals:pedestal_cobblegen'; + //stoneworks functions + function pedestals_stoneworks(material, type) { + var recipeType = 'pedestals:pedestal_cobblegen'; - if (type == 'stone') { - recipeType = 'pedestals:pedestal_cobblegensilk'; + if (type == 'stone') { + recipeType = 'pedestals:pedestal_cobblegensilk'; + } + //console.log(`Pedestals Recipe for Material: ${material}, Type: ${type}`); + fallback_id( + event.custom({ + type: recipeType, + ingredient: { + item: material + }, + result: { + item: material, + count: 1 + } + }), + `enigmatica:base/unification/unify_stoneworks/${arguments.callee.name}/` + ); } - //console.log(`Pedestals Recipe for Material: ${material}, Type: ${type}`); - fallback_id( - event.custom({ - type: recipeType, - ingredient: { - item: material - }, - result: { - item: material, - count: 1 - } - }), - `enigmatica:base/unification/unify_stoneworks/${arguments.callee.name}/` - ); -} -function industrialforegoing_stoneworks(event, material, type) { - var waterConsume = 0; - var lavaConsume = 0; + function industrialforegoing_stoneworks(material, type) { + var waterConsume = 0; + var lavaConsume = 0; - if (type == 'stone') { - waterConsume = 1000; - lavaConsume = 0; - } + if (type == 'stone') { + waterConsume = 1000; + lavaConsume = 0; + } - fallback_id( - event.custom({ - output: { - item: material, - count: 1 - }, - waterNeed: 1000, - lavaNeed: 1000, - waterConsume: waterConsume, - lavaConsume: lavaConsume, - type: 'industrialforegoing:stonework_generate' - }), - `enigmatica:base/unification/unify_stoneworks/${arguments.callee.name}/` - ); -} + fallback_id( + event.custom({ + output: { + item: material, + count: 1 + }, + waterNeed: 1000, + lavaNeed: 1000, + waterConsume: waterConsume, + lavaConsume: lavaConsume, + type: 'industrialforegoing:stonework_generate' + }), + `enigmatica:base/unification/unify_stoneworks/${arguments.callee.name}/` + ); + } -function thermal_stoneworks(event, material) { - fallback_id( - event.custom({ - type: 'thermal:rock_gen', - adjacent: 'minecraft:water', - below: material, - result: { - item: material - } - }), - `enigmatica:base/unification/unify_stoneworks/${arguments.callee.name}/` - ); -} + function thermal_stoneworks(material) { + fallback_id( + event.custom({ + type: 'thermal:rock_gen', + adjacent: 'minecraft:water', + below: material, + result: { + item: material + } + }), + `enigmatica:base/unification/unify_stoneworks/${arguments.callee.name}/` + ); + } +}); diff --git a/kubejs/server_scripts/enigmatica/kubejs/expert/item/gamestages.js b/kubejs/server_scripts/enigmatica/kubejs/expert/item/gamestages.js index e21d2056d9..1138937461 100644 --- a/kubejs/server_scripts/enigmatica/kubejs/expert/item/gamestages.js +++ b/kubejs/server_scripts/enigmatica/kubejs/expert/item/gamestages.js @@ -23,11 +23,3 @@ onEvent('item.right_click', (event) => { } }); }); - -function titleCase(str) { - var splitStr = str.toLowerCase().split(' '); - for (var i = 0; i < splitStr.length; i++) { - splitStr[i] = splitStr[i].charAt(0).toUpperCase() + splitStr[i].substring(1); - } - return splitStr.join(' '); -} diff --git a/kubejs/server_scripts/enigmatica/kubejs/expert/unification/unify_materials.js b/kubejs/server_scripts/enigmatica/kubejs/expert/unification/unify_materials.js index c5e86e50e1..93a66bad8f 100644 --- a/kubejs/server_scripts/enigmatica/kubejs/expert/unification/unify_materials.js +++ b/kubejs/server_scripts/enigmatica/kubejs/expert/unification/unify_materials.js @@ -21,13 +21,13 @@ onEvent('recipes', (event) => { var levigated_material = getPreferredItemInTag(Ingredient.of(`#enigmatica:levigated_materials/${material}`)).id; var crystalline_sliver = getPreferredItemInTag(Ingredient.of(`#enigmatica:crystalline_slivers/${material}`)).id; - ore_ingot_smelting(event, material, ore, ingot); - gear_unification(event, material, ingot, gem, gear); - rod_unification(event, material, ingot, gem, rod, plate); - plate_unification(event, material, ingot, gem, plate); - wire_unification(event, material, ingot, gem, wire, plate); + ore_ingot_smelting(material, ore, ingot); + gear_unification(material, ingot, gem, gear); + rod_unification(material, ingot, gem, rod, plate); + plate_unification(material, ingot, gem, plate); + wire_unification(material, ingot, gem, wire, plate); - immersiveengineering_ore_processing_with_secondary_outputs(event, material, ore, crushed_ore, ingot); + immersiveengineering_ore_processing_with_secondary_outputs(material, ore, crushed_ore, ingot); magical_ore_processing( event, @@ -42,7 +42,7 @@ onEvent('recipes', (event) => { ); }); - function ore_ingot_smelting(event, material, ore, ingot) { + function ore_ingot_smelting(material, ore, ingot) { if (ore == air || ingot == air) { return; } @@ -64,7 +64,7 @@ onEvent('recipes', (event) => { event.recipes.thermal.furnace(output, input).id(`${id_prefix}furnace/${material}/ingot/from_ore`); } - function gear_unification(event, material, ingot, gem, gear) { + function gear_unification(material, ingot, gem, gear) { if (gear == air) { return; } @@ -100,7 +100,7 @@ onEvent('recipes', (event) => { .id(`kubejs:crafting_shaped_${material}_gear`); } - function rod_unification(event, material, ingot, gem, rod) { + function rod_unification(material, ingot, gem, rod) { if (rod == air) { return; } @@ -132,7 +132,7 @@ onEvent('recipes', (event) => { event.shapeless(output, [plateTag, hammer, plateTag]).id(`kubejs:shapeless_crafting_${material}_rod`); } - function plate_unification(event, material, ingot, gem, plate) { + function plate_unification(material, ingot, gem, plate) { if (plate == air) { return; } @@ -166,7 +166,7 @@ onEvent('recipes', (event) => { .id(`thermal:machine/press/press_${material}_ingot_to_plate`); } - function wire_unification(event, material, ingot, gem, wire, plate) { + function wire_unification(material, ingot, gem, wire, plate) { if (wire == air) { return; } @@ -197,7 +197,7 @@ onEvent('recipes', (event) => { event.shapeless(Item.of(output, 2), [plate, plate, wireCutters]).id(`kubejs:shaped_crafting_${material}_wire`); } - function immersiveengineering_ore_processing_with_secondary_outputs(event, material, ore, crushed_ore, ingot) { + function immersiveengineering_ore_processing_with_secondary_outputs(material, ore, crushed_ore, ingot) { if (ore == air || crushed_ore == air || ingot == air) { return; } diff --git a/kubejs/server_scripts/enigmatica/kubejs/functions.js b/kubejs/server_scripts/enigmatica/kubejs/functions.js index 39cc2c4e31..a3b389ea87 100644 --- a/kubejs/server_scripts/enigmatica/kubejs/functions.js +++ b/kubejs/server_scripts/enigmatica/kubejs/functions.js @@ -1,41 +1,93 @@ //priority: 1005 -function shapedRecipe(result, pattern, key, id) { - return { result: result, pattern: pattern, key: key, id: id }; +/** + * @param {any[]|Internal.Collection} entries + */ +function randomOf(entries) { + // @ts-ignore + return Utils.randomOf(Utils.getRandom(), entries); } -function shapelessRecipe(result, ingredients, id) { - return { result: result, ingredients: ingredients, id: id }; +/** + * @param {any[]} list + * @param {null|((a:any,b:any)=>number)} comparator If not specified, will use `(a, b) => a - b` + */ +function maxOf(list, comparator) { + if (list.length == 0) { + return null; + } + if (!comparator) { + comparator = (a, b) => a - b; + } + let targetIndex = 0; + for (let i = 1; i < list.length; i++) { + if (comparator(list[i], list[targetIndex]) > 0) { + targetIndex = i; + } + } + return list[targetIndex]; } -function unificationBlacklistEntry(material, type) { - return { material: material, type: type }; + +/** + * @param {string} str + */ +function titleCase(str) { + return str + .split(' ') + .map((part) => part.charAt(0).toUpperCase() + part.substring(1)) + .join(' '); } + +/** + * @param {string} material + * @param {string} type + * @see unificationBlacklist + */ function entryIsBlacklisted(material, type) { - for (var i = 0; i < unificationBlacklist.length; i++) { - if (unificationBlacklist[i].material == material && unificationBlacklist[i].type == type) { + for (let blacklistEntry of unificationBlacklist) { + if (blacklistEntry.material == material && blacklistEntry.type == type) { return true; } } return false; } +/** + * @param {string} tag + */ function tagIsEmpty(tag) { return getPreferredItemInTag(Ingredient.of(tag)).id == air; } +/** + * get the most prefered item in a tag based on priorities from variable `modPriorities` + * @see modPriorities + * @param {Internal.IngredientJS} tag + * @returns {Internal.ItemStackJS} + */ function getPreferredItemInTag(tag) { - let pref = - utils - .listOf(tag.stacks) - .toArray() - .sort(({ mod: a }, { mod: b }) => compareIndices(a, b, tag))[0] || Item.of(air); - return pref; + const items = getItemsInTag(tag); + if (items.length == 0) { + return Item.of(air); + } + //use "max" instead of "sorting", to decrease time complexity from O(n*log(n)) to O(n) + //being "bigger" here means having smaller index, which means -1, so there's an `-` + return maxOf(items, (a, b) => -compareIndices(a.mod, b.mod, tag)); } +/** + * @param {Internal.IngredientJS} tag + */ function getItemsInTag(tag) { - let items = utils.listOf(tag.stacks).toArray(); - return items; + return tag.stacks.toArray(); } + +/** + * @param {string} a + * @param {string} b + * @param {string} tag + * @see modPriorities +*/ function compareIndices(a, b, tag) { if (a == b) return 0; // iff a == b, they'll be found at the same position in modPriorities @@ -48,25 +100,27 @@ function compareIndices(a, b, tag) { return 0; } +/** + * @param {string} logBlock + * @see buildWoodVariants + */ function getStrippedLogFrom(logBlock) { - let result = air; - buildWoodVariants.find((wood) => { + for (let wood of buildWoodVariants) { if (wood.logBlock == logBlock) { - result = wood.logBlockStripped; - return result; + return wood.logBlockStripped; } - }); - return result; + } + return air; } const unificationBlacklist = [ - unificationBlacklistEntry('quartz', 'gem'), - unificationBlacklistEntry('quartz', 'storage_block') + { material: 'quartz', type: 'gem' }, + { material: 'quartz', type: 'storage_block' } ]; -const playerHas = (item, player) => { +function playerHas(item, player) { return player.inventory.find(item) != -1; -}; +} // lt = .slice(0, index) // lte = .slice(0, index + 1) @@ -77,7 +131,11 @@ function lowerTiers(tiers, tier) { return tiers.slice(0, tiers.indexOf(tier)); } -// transplant the md5 from `:kjs_` onto the supplied prefix +/** + * transplant the md5 from `:kjs_` onto the supplied prefix + * @param {Internal.RecipeJS} recipe + * @param {string} id_prefix + */ function fallback_id(recipe, id_prefix) { if (recipe.getId().includes(':kjs_')) { recipe.serializeJson(); // without this the hashes *will* collide diff --git a/kubejs/server_scripts/enigmatica/kubejs/normal/unification/unify_materials.js b/kubejs/server_scripts/enigmatica/kubejs/normal/unification/unify_materials.js index cb489909f2..c91d3faf29 100644 --- a/kubejs/server_scripts/enigmatica/kubejs/normal/unification/unify_materials.js +++ b/kubejs/server_scripts/enigmatica/kubejs/normal/unification/unify_materials.js @@ -16,16 +16,16 @@ onEvent('recipes', (event) => { let ore = getPreferredItemInTag(Ingredient.of(`#forge:ores/${material}`)).id; let dust = getPreferredItemInTag(Ingredient.of(`#forge:dusts/${material}`)).id; - minecraft_ore_ingot_smelting(event, material, ore, ingot); - gear_unification(event, material, ingot, gem, gear); - rod_unification(event, material, ingot, gem, rod); - plate_unification(event, material, ingot, gem, plate); - wire_unification(event, material, ingot, gem, wire, plate); + minecraft_ore_ingot_smelting(material, ore, ingot); + gear_unification(material, ingot, gem, gear); + rod_unification(material, ingot, gem, rod); + plate_unification(material, ingot, gem, plate); + wire_unification(material, ingot, gem, wire, plate); - immersiveengineering_ore_processing_with_secondary_outputs(event, material, ore, dust, ingot); + immersiveengineering_ore_processing_with_secondary_outputs(material, ore, dust, ingot); }); - function minecraft_ore_ingot_smelting(event, material, ore, ingot) { + function minecraft_ore_ingot_smelting(material, ore, ingot) { if (ore == air || ingot == air) { return; } @@ -44,7 +44,7 @@ onEvent('recipes', (event) => { event.blasting(output, input).xp(0.7).id(`${id_prefix}blasting/${material}/ingot/from_ore`); } - function gear_unification(event, material, ingot, gem, gear) { + function gear_unification(material, ingot, gem, gear) { if (gear == air) { return; } @@ -79,7 +79,7 @@ onEvent('recipes', (event) => { .id(`${id_prefix}crafting_shaped_${material}_gear`); } - function rod_unification(event, material, ingot, gem, rod) { + function rod_unification(material, ingot, gem, rod) { if (rod == air) { return; } @@ -114,7 +114,7 @@ onEvent('recipes', (event) => { .id(`${id_prefix}shaped_crafting_${material}_rod`); } - function plate_unification(event, material, ingot, gem, plate) { + function plate_unification(material, ingot, gem, plate) { if (plate == air) { return; } @@ -148,7 +148,7 @@ onEvent('recipes', (event) => { .id(`thermal:machine/press/press_${material}_ingot_to_plate`); } - function wire_unification(event, material, ingot, gem, wire, plate) { + function wire_unification(material, ingot, gem, wire, plate) { if (wire == air) { return; } @@ -180,7 +180,7 @@ onEvent('recipes', (event) => { event.shapeless(output, [plate, wireCutters]).id(`${id_prefix}shaped_crafting_${material}_wire`); } - function immersiveengineering_ore_processing_with_secondary_outputs(event, material, ore, dust, ingot) { + function immersiveengineering_ore_processing_with_secondary_outputs(material, ore, dust, ingot) { if (ore == air || dust == air || ingot == air) { return; } diff --git a/kubejs/startup_scripts/multiblock_gamestages.js b/kubejs/startup_scripts/multiblock_gamestages.js index d89d0f94aa..d081e783dc 100644 --- a/kubejs/startup_scripts/multiblock_gamestages.js +++ b/kubejs/startup_scripts/multiblock_gamestages.js @@ -37,11 +37,3 @@ onEvent('ie.multiblock.form', (event) => { } } }); - -function titleCase(str) { - var splitStr = str.toLowerCase().split(' '); - for (var i = 0; i < splitStr.length; i++) { - splitStr[i] = splitStr[i].charAt(0).toUpperCase() + splitStr[i].substring(1); - } - return splitStr.join(' '); -}