From d4f759f4f57cc4511dacad3eebc8c22c5a2153c1 Mon Sep 17 00:00:00 2001 From: Redeix Date: Mon, 29 Sep 2025 07:16:09 -0500 Subject: [PATCH] Recipes for the growth chamber (#1927) --- kubejs/server_scripts/gregtech/utility.js | 63 ++++++++ kubejs/server_scripts/tfg/recipes.biochem.js | 134 +++++++++++++++--- kubejs/startup_scripts/ad_astra/materials.js | 9 ++ kubejs/startup_scripts/main_startup_script.js | 1 + 4 files changed, 189 insertions(+), 18 deletions(-) diff --git a/kubejs/server_scripts/gregtech/utility.js b/kubejs/server_scripts/gregtech/utility.js index f975af3bf..2fc47ee17 100644 --- a/kubejs/server_scripts/gregtech/utility.js +++ b/kubejs/server_scripts/gregtech/utility.js @@ -464,4 +464,67 @@ function woodBuilder(event, name, lumber, logs, log, stripped_log, plank, stair, .EUt(GTValues.VA[GTValues.ULV]) } } +//#endregion + +//#region Sterilization +/** + * Creates recipes for sterilizing an item using chemicals or the autoclave. + * + * @param {*} event + * @param {string} input - The input item to be sterilized. + * @param {string} output - The output item after sterilization. + * @param {number} multiplier - Multiplies the fluid amounts and recipe duration. Default multiplier = 1. + * @param {string} [cleanroom] - For if a cleanroom is required. Can be null. + * + * @throws {TypeError} Throws an error if input, output, or multiplier is invalid. + */ +function sterilizeItem(event, input, output, multiplier, cleanroom) { + // Collect errors. + const errors = []; + + if (input === undefined || (Array.isArray(input) && input.length !== 1) || output === undefined || (Array.isArray(output) && output.length !== 1)) { + errors.push("input or output is undefined or not equal to one item"); + }; + if (multiplier <= 0) { + errors.push(`invalid multiplier (${multiplier})`); + }; + + // If there are any errors, log them all and throw once. + if (errors.length > 0) { + const message = "sterilizeItem errors:\n - " + errors.join("\n - "); + throw new TypeError(message); + }; + + // Set default multiplier. + let recipe_multiplier = 1; + if (multiplier !== undefined) recipe_multiplier = multiplier; + + // Create recipes. + let ethanol_recipe = event.recipes.gtceu.chemical_bath(`tfg:ethanol_cleaning/${input.replace(':', '_')}_to_${output.replace(':', '_')}`) + .itemInputs(input) + .inputFluids(Fluid.of('gtceu:ethanol', 500*recipe_multiplier)) + .itemOutputs(output) + .duration(10*20*recipe_multiplier) + .EUt(GTValues.VA[GTValues.MV]); + + let hydrogen_peroxide_recipe = event.recipes.gtceu.chemical_bath(`tfg:hydrogen_peroxide_cleaning/${input.replace(':', '_')}_to_${output.replace(':', '_')}`) + .itemInputs(input) + .inputFluids(Fluid.of('gtceu:hydrogen_peroxide', 200*recipe_multiplier)) + .itemOutputs(output) + .duration(10*20*recipe_multiplier) + .EUt(GTValues.VA[GTValues.MV]); + + let autoclave_recipe = event.recipes.gtceu.autoclave(`tfg:autoclave_cleaning/${input.replace(':', '_')}_to_${output.replace(':', '_')}`) + .itemInputs(input) + .inputFluids(Fluid.of('gtceu:steam', 15360)) + .itemOutputs(output) + .duration(240*20*recipe_multiplier) + .EUt(GTValues.VA[GTValues.MV]); + + if (cleanroom) { + ethanol_recipe.cleanroom(cleanroom); + hydrogen_peroxide_recipe.cleanroom(cleanroom); + autoclave_recipe.cleanroom(cleanroom); + }; +}; //#endregion \ No newline at end of file diff --git a/kubejs/server_scripts/tfg/recipes.biochem.js b/kubejs/server_scripts/tfg/recipes.biochem.js index 81b72352d..c362ff112 100644 --- a/kubejs/server_scripts/tfg/recipes.biochem.js +++ b/kubejs/server_scripts/tfg/recipes.biochem.js @@ -156,7 +156,7 @@ function registerTFGBiochemRecipes(event) { .inputFluids(Fluid.of('gtceu:soldering_alloy', 144)) .itemOutputs('tfg:casings/machine_casing_ultraviolet') .duration(8*20) - .circuit(4) + .circuit(6) .EUt(GTValues.VA[GTValues.EV]); event.recipes.gtceu.assembler('tfg:bioculture_casing') @@ -164,7 +164,7 @@ function registerTFGBiochemRecipes(event) { .inputFluids(Fluid.of('gtceu:hastelloy_c_276', 288)) .itemOutputs('tfg:casings/machine_casing_bioculture') .duration(8*20) - .circuit(4) + .circuit(6) .EUt(GTValues.VA[GTValues.HV]); event.recipes.gtceu.assembler('tfg:bioculture_glass') @@ -172,7 +172,7 @@ function registerTFGBiochemRecipes(event) { .inputFluids(Fluid.of('gtceu:glass', 144)) .itemOutputs('tfg:casings/machine_casing_bioculture_glass') .duration(8*20) - .circuit(4) + .circuit(6) .EUt(GTValues.VA[GTValues.HV]); event.shaped('tfg:bioreactor', [ @@ -201,12 +201,73 @@ function registerTFGBiochemRecipes(event) { event.shapeless('tfg:casings/bioculture_rotor_secondary', [ 'tfg:casings/bioculture_rotor_primary' - ]).id('tfg:shapeless/bioculture_rotor_primary_to_secondary') + ]).id('tfg:shapeless/bioculture_rotor_primary_to_secondary'); event.shapeless('tfg:casings/bioculture_rotor_primary', [ 'tfg:casings/bioculture_rotor_secondary' - ]).id('tfg:shapeless/bioculture_rotor_secondary_to_primary') + ]).id('tfg:shapeless/bioculture_rotor_secondary_to_primary'); + + event.shapeless('tfg:sample_rack', [ + 'tfg:lab_equipment', + ChemicalHelper.get(TagPrefix.frameGt, GTMaterials.StainlessSteel, 1) + ]).id('tfg:shapeless/sample_rack'); + event.shaped('tfg:growth_monitor', [ + 'CEC', + 'DBD', + 'CAC' + ], { + A: 'gtceu:ev_scanner', + B: 'gtceu:computer_monitor_cover', + C: ChemicalHelper.get(TagPrefix.plateDense, GTMaterials.TungstenSteel, 1), + D: '#gtceu:circuits/luv', + E: '#forge:lenses/amethyst' + }).id('tfg:shaped/growth_monitor'); + + event.recipes.gtceu.assembler('tfg:casings/machine_casing_sterilizing_pipes') + .itemInputs( + ChemicalHelper.get(TagPrefix.frameGt, GTMaterials.get('ostrum'), 1), + ChemicalHelper.get(TagPrefix.pipeQuadrupleFluid, GTMaterials.get('ostrum'), 1), + Ingredient.of('#tfg:components/uv_leds').withCount(16) + ) + .inputFluids(Fluid.of('gtceu:borosilicate_glass', 144)) + .itemOutputs(Item.of('tfg:casings/machine_casing_sterilizing_pipes').withCount(2)) + .duration(8*20) + .circuit(6) + .EUt(GTValues.VA[GTValues.EV]); + + event.recipes.gtceu.assembler('tfg:single_itemstack_bus') + .itemInputs( + Ingredient.of('gtceu:iv_input_bus'), + Ingredient.of('gtceu:item_smart_filter'), + Ingredient.of('#tfg:components/uv_leds').withCount(4) + ) + .itemOutputs(Item.of('tfg:single_itemstack_bus')) + .duration(15*20) + .circuit(6) + .EUt(GTValues.VA[GTValues.IV]) + .cleanroom(CleanroomType.CLEANROOM); + + event.recipes.gtceu.assembly_line('tfg:growth_chamber') + .itemInputs( + Ingredient.of('tfg:growth_monitor'), + Ingredient.of('tfg:lab_equipment').withCount(16), + Ingredient.of('#gtceu:circuits/luv').withCount(4), + Ingredient.of('gtceu:iv_electric_pump').withCount(4), + ChemicalHelper.get(TagPrefix.cableGtSingle, GTMaterials.Tungsten, 8) + ) + .inputFluids( + Fluid.of('tfg:cryogenized_fluix', 576*4), + Fluid.of('gtceu:residual_radioactive_concoction', 1000*30) + ) + .itemOutputs('tfg:growth_chamber') + .duration(1*60*20) + .EUt(GTValues.VA[GTValues.IV]) + .cleanroom(CleanroomType.CLEANROOM); + + //#endregion + + //#region Lab Equipment event.replaceInput({input: 'tfc:bone_needle'}, 'tfc:bone_needle', '#tfc:sewing_needles') event.recipes.gtceu.wiremill('tfg:stainless_steel_needle') @@ -234,20 +295,57 @@ function registerTFGBiochemRecipes(event) { 'tfg:filled_dna_syringe' ]).id('tfg:shapeless/filled_dna_syringe_emptying') - event.recipes.gtceu.chemical_bath('tfg:ethanol_cleaning_syringe') - .itemInputs('tfg:dirty_dna_syringe') - .inputFluids(Fluid.of('gtceu:ethanol', 500)) - .itemOutputs('tfg:empty_dna_syringe') + event.recipes.gtceu.assembler('tfg:lab_equipment') + .itemInputs( + Ingredient.of('tfg:beaker').withCount(2), + Ingredient.of('tfg:flask').withCount(8), + Ingredient.of('tfg:vial').withCount(16), + Ingredient.of('gtceu:petri_dish').withCount(16), + ChemicalHelper.get(TagPrefix.rod, GTMaterials.SamariumMagnetic, 8) + ) + .itemOutputs(Item.of('tfg:lab_equipment').withCount(4)) .duration(10*20) - .EUt(GTValues.VA[GTValues.MV]) - .cleanroom(CleanroomType.CLEANROOM) + .EUt(GTValues.VA[GTValues.EV]) + .cleanroom(CleanroomType.CLEANROOM); - event.recipes.gtceu.chemical_bath('tfg:hydrogen_peroxide_cleaning_syringe') - .itemInputs('tfg:dirty_dna_syringe') - .inputFluids(Fluid.of('gtceu:hydrogen_peroxide', 200)) - .itemOutputs('tfg:empty_dna_syringe') - .duration(10*20) - .EUt(GTValues.VA[GTValues.MV]) - .cleanroom(CleanroomType.CLEANROOM) + event.remove({id: 'gtceu:fluid_solidifier/petri_dish_pbi'}); + event.remove({id: 'gtceu:fluid_solidifier/petri_dish_ptfe'}); + + /** + * @type {Array} + * @property {string} output - Output + * @property {number} fluid_qty - Fluid quantity + * @property {string} mold - Mold + */ + const lab_casting = [ + {output: 'gtceu:petri_dish', fluid_qty: 144, mold: 'gtceu:cylinder_casting_mold'}, + {output: 'tfg:vial', fluid_qty: 144, mold: 'gtceu:small_pipe_casting_mold'}, + {output: 'tfg:flask', fluid_qty: 288, mold: 'gtceu:normal_pipe_casting_mold'}, + {output: 'tfg:beaker', fluid_qty: 432, mold: 'gtceu:large_pipe_casting_mold'} + ]; + + lab_casting.forEach(entry => { + event.recipes.gtceu.fluid_solidifier(`tfg:lab_casting/${entry.output.replace(':', '_')}`) + .inputFluids(Fluid.of('gtceu:borosilicate_glass', entry.fluid_qty)) + .notConsumable(entry.mold) + .itemOutputs(entry.output) + .duration(Math.max(1, Math.floor(((entry.fluid_qty / 144) * 5) * 20))) + .EUt(GTValues.VA[GTValues.LV]); + }); + + /** + * @type {Array} + * @property {string} input - Input + * @property {string} output - Output + * @property {number} multiplier - Multiplier + * @property {CleanroomType} cleanroom - Cleanroom type + */ + const lab_cleaning = [ + {input: 'tfg:dirty_dna_syringe', output: 'tfg:empty_dna_syringe', multiplier: 1, cleanroom: CleanroomType.CLEANROOM}, + {input: 'tfg:dirty_lab_equipment', output: 'tfg:lab_equipment', multiplier: 1, cleanroom: CleanroomType.CLEANROOM} + ]; + lab_cleaning.forEach(entry => { + sterilizeItem(event, entry.input, entry.output, entry.multiplier, entry.cleanroom); + }); //#endregion } \ No newline at end of file diff --git a/kubejs/startup_scripts/ad_astra/materials.js b/kubejs/startup_scripts/ad_astra/materials.js index 4cb2645ca..98d9d69f3 100644 --- a/kubejs/startup_scripts/ad_astra/materials.js +++ b/kubejs/startup_scripts/ad_astra/materials.js @@ -49,6 +49,7 @@ const registerAdAstraMaterials = (event) => { GTMaterialFlags.FORCE_GENERATE_BLOCK, GTMaterialFlags.GENERATE_PLATE, GTMaterialFlags.GENERATE_ROD, + GTMaterialFlags.GENERATE_FRAME, GTMaterialFlags.DISABLE_ALLOY_BLAST ) @@ -80,4 +81,12 @@ const registerAdAstraMaterials = (event) => { ) // #endregion +} + +const registerAdAstraMaterialModification = (event) => { + + const $FLUID_PIPE_PROPERTY = Java.loadClass('com.gregtechceu.gtceu.api.data.chemical.material.properties.FluidPipeProperties') + + // Ostrum fluid pipe - same flow rate as titanium, higher temp range + GTMaterials.get('ostrum').setProperty(PropertyKey.FLUID_PIPE, new $FLUID_PIPE_PROPERTY(3700, 150, true, false, true, false)); } \ No newline at end of file diff --git a/kubejs/startup_scripts/main_startup_script.js b/kubejs/startup_scripts/main_startup_script.js index 8026e428b..e152bb696 100644 --- a/kubejs/startup_scripts/main_startup_script.js +++ b/kubejs/startup_scripts/main_startup_script.js @@ -67,6 +67,7 @@ GTCEuStartupEvents.registry('gtceu:material_icon_set', event => { GTCEuStartupEvents.materialModification(event => { registerGTCEuMaterialModification(event) registerGreateMaterialModification(event) + registerAdAstraMaterialModification(event) }) GTCEuStartupEvents.registry('gtceu:dimension_marker', event => {