// WARNING WARNING WARNING !!! // Be very careful if editing this file. // Crafttweaker has a very nasty bug where if you don't handle doubles just right it // explodes. You should always make sure that your literals and the rhs of initialization // to double variables is marked with `as double`, that double literals are spelled out // with `1.0D`, and that double variables are marked as double in initialization. // If you do not, the syntax checker will crash and it will not give you a meaningful error. // For example, consider the following code: // val tiered_results as double[string][string] = {...} as double[string][string]; // for item_name, base_result_map in tiered_results { // for component_name, base_yield in base_result_map { // var modified_yield as double = base_yield; // } // } // This code will syntax check but will crash at runtime without reporting a proper error. // The problem is that even though `base_yield` is a double according to the type we // gave `tiered_results`, when crafttweaker encounters an iteration variable (ie `base_yield`) // it silently promotes it to the type "nullable double" which is represented as a boxed double // in the underlying java bytecode. Contenttweaker will improperly store this boxed double // to a primitive double local variable directly without unboxing it, causing an error which // only reports a bytecode index and not a line number. The solution is a redundant `as double` // on `base_yield` on the line where `modified_yield` is initialized. // // Putting an integer literal like `1` instead of a double literal like `1.0D` in // a map literal will cause the syntax checker to crash with the only error being // "null" and "arrayindexoutofbounds" in the crafttweaker log. If you change this // file and encounter any of the above errors, look for the problems mentioned above. import crafttweaker.world.IFacing; import crafttweaker.block.IBlock; import crafttweaker.item.IIngredient; import crafttweaker.item.IItemStack; import mods.gregtech.multiblock.Builder; import mods.gregtech.multiblock.FactoryBlockPattern; import mods.gregtech.multiblock.IBlockMatcher; import mods.gregtech.multiblock.MultiblockAbility; import mods.gregtech.multiblock.RelativeDirection; import mods.gregtech.multiblock.FactoryMultiblockShapeInfo; import mods.gregtech.multiblock.IBlockInfo; import mods.gregtech.multiblock.IBlockWorldState; import mods.gregtech.multiblock.Multiblock; import mods.gregtech.MetaTileEntities; import mods.gregtech.recipe.FactoryRecipeMap; import mods.gregtech.render.ITextureArea; import mods.gregtech.render.MoveType; import mods.gregtech.render.ICubeRenderer; import mods.gregtech.render.Textures; print("----------------Disassembler Start-------------------"); var id = 3000 as int; var loc = "disassembler" as string; val disassembler_recipe_map = FactoryRecipeMap.start(loc) .minInputs(1) .maxInputs(1) //.minFluidInputs(0) //.maxFluidInputs(1) .minOutputs(1) .maxOutputs(16) //.minFluidOutputs(0) //.maxFluidOutputs(1) .build(); val disassembler = Builder.start(loc, id) // set the multiblock pattern. variable layers and hatch/capability places go here .withPattern( FactoryBlockPattern.start(RelativeDirection.RIGHT, RelativeDirection.BACK, RelativeDirection.UP) .aisle( "CCC", "CCC", "CSC") .aisle( "CCC", "C C", "CCC") .aisle( "CCC", "CCC", "CCC") .where('S', IBlockMatcher.controller(loc)) .where(' ', IBlockMatcher.ANY) .whereOr('C', as IBlockMatcher, IBlockMatcher.abilityPartPredicate(MultiblockAbility.INPUT_ENERGY, //MultiblockAbility.IMPORT_FLUIDS, MultiblockAbility.IMPORT_ITEMS, //MultiblockAbility.EXPORT_FLUIDS, MultiblockAbility.EXPORT_ITEMS)) .setAmountAtMost('p', 1) .where('p', IBlockMatcher.abilityPartPredicate(MultiblockAbility.INPUT_ENERGY)) //.setAmountAtMost('f', 1) //.where('f', IBlockMatcher.abilityPartPredicate(MultiblockAbility.IMPORT_FLUIDS)) .setAmountAtMost('i', 1) .where('i', IBlockMatcher.abilityPartPredicate(MultiblockAbility.IMPORT_ITEMS)) //.setAmountAtMost('F', 1) //.where('F', IBlockMatcher.abilityPartPredicate(MultiblockAbility.EXPORT_FLUIDS)) .setAmountAtMost('I', 1) .where('I', IBlockMatcher.abilityPartPredicate(MultiblockAbility.EXPORT_ITEMS)) .build()) // add a multiblock pattern to display in jei and in world preview. this is required by mbt to give previews .addDesign( FactoryMultiblockShapeInfo.start() .aisle( "iCC", "CCC", "CCC") .aisle( "SCp", "C C", "CCC") .aisle( "ICC", "CCC", "CCC") .where('S', IBlockInfo.controller(loc)) .where(' ', IBlockInfo.EMPTY) .where('C', ) .where('p', MetaTileEntities.ENERGY_INPUT_HATCH[3], IFacing.north()) //.where('f', MetaTileEntities.FLUID_IMPORT_HATCH[1], IFacing.west()) .where('i', MetaTileEntities.ITEM_IMPORT_BUS[1], IFacing.west()) //.where('F', MetaTileEntities.FLUID_EXPORT_HATCH[1], IFacing.east()) .where('I', MetaTileEntities.ITEM_EXPORT_BUS[3], IFacing.east()) .build()) // initialize the recipe manager for the disassembler, populated later // the recipe map itself is a part of gtce's own crafttweaker support not mbt // these limits are not all required // other methods include setProgressBar to have a custom progress bar for the machine .withRecipeMap(disassembler_recipe_map) .buildAndRegister() as Multiblock; // TODO: move to .lang files game.setLocalization( "multiblocktweaker.machine.disassembler.name", "Disassembler" ); game.setLocalization( "multiblocktweaker.multiblock.disassembler.description", "The Disassembler can recover some of the microcomponents and materials that went into crafting many items." ); game.setLocalization( "recipemap.disassembler.name", "Item Disassembly" ); val mvArm = ; recipes.addShaped("disassembler_controller", , [ [, mvArm, ], [mvArm, , mvArm], [, , ] ]); //begin disassembly categories //should be able to disassemble //-gtce single block machines (done) //-gtce multiblock machines and hatches (incl disassembler) (TODO) //-mm controller and hatches (TODO) //-industrial foregoing black hole tech, thermal foundation machines, etc (TODO high priority) //-secondary microcomponents (done) //machines and hatches disassemble into microcomponents (motors, circuits, pistons, etc) //secondary microcomponents disassemble into dusts and primary microcomponents (motors and circuits are primary) //to avoid exploits, yield lowest tier circuits and other materials in the lowest amounts (eg 2 assemblies for lsb but not the lbb) //probabilities and scaling are taken from variables to ease tweaking //the tiers are: 0 LV, 1 MV, 2 HV, 3 EV, 4 IV, 5 LuV, 6 ZPM, 7 UV, 8 MAX //the sensor also uses metal_emitter //the polarizer also uses wire_separator and rod_separator //metal_holder is the same as metal_hull at hv and luv and is hsss at max (hsss would probably be metal_components for max) //metal_fan is used in the chem reactor, mixer, washer, turbines, and item collector //for iv- it is metal_pump but for luv+ it is metal_hull val tiered_items as IItemStack[][string]= { "circuit": [,,,,,,,,], "motor": [,,,,,,,,null], "pump": [,,,,,,,,null], "conveyor": [,,,,,,,,null], "piston": [,,,,,,,,null], "robot_arm": [,,,,,,,,null], "field_generator": [,,,,,,,,null], "emitter": [,,,,,,,,null], "sensor": [,,,,,,,,null], "battery": [,,,,,,,,], "field_generator_core": [,,,,,,,,null], "emitter_core": [,,,,,,,,null], "grinding_head": [,,,,,,,,null], "metal_hull": [,,,,,,,,], "metal_components": [,,,,,,,,null], "metal_pump": [,,,,,,,,null], "metal_pipe": [,,,,,,,,null], "metal_emitter": [,,,,,,,,null], "metal_fan": [,,,,,,,,null], "metal_holder": [null,null,,null,null,,null,null,], "rubber_pump": [,,,,,,,,null], "rubber_conveyor": [,,,,,,,,null], "wire_hull": [,,,,,,,,], "wire_machine": [,,,,,,,,], "wire_components": [,,,,,,,,], "wire_coil": [,,,,,,,,null], "wire_osmium": [,,,,,,,,null], "wire_electrolyzer": [,,,,,,,,null], "wire_separator": [,,,,,,,,null], "rod_separator": [,,,,,,,,null], "rod_naqreactor": [null,null,null,,,,,null,null], "glass": [,,,,,,,,], "transformer_coil": [null,null,,,,,,null,null], "furnace": [,,,,,,,,null], "macerator": [,,,,,,,,null], "alloy_smelter": [,,,,,,,,null], "arc_furnace": [,,,,,,,,null], "assembler": [,,,,,,,,null], "autoclave": [,,,,,,,,null], "bender": [,,,,,,,,null], "brewry": [,,,,,,,,null], "canner": [,,,,,,,,null], "centrifuge": [,,,,,,,,null], "bath": [,,,,,,,,null], "chem_reactor": [,,,,,,,,null], "compressor": [,,,,,,,,null], "cutting_machine": [,,,,,,,,null], "distillery": [,,,,,,,,null], "electrolyzer": [,,,,,,,,null], "separator": [,,,,,,,,null], "extractor": [,,,,,,,,null], "fermenter": [,,,,,,,,null], "f_canner": [,,,,,,,,null], "f_extractor": [,,,,,,,,null], "f_heater": [,,,,,,,,null], "f_solidifier": [,,,,,,,,null], "forge_hammer": [,,,,,,,,null], "forming_press": [,,,,,,,,null], "lathe": [,,,,,,,,null], "microwave": [,,,,,,,,null], "mixer": [,,,,,,,,null], "washer": [,,,,,,,,null], "packager": [,,,,,,,,null], "unpackager": [,,,,,,,,null], "polarizer": [,,,,,,,,null], "sifter": [,,,,,,,,null], "wiremill": [,,,,,,,,null], "diesel_generator": [,,,null,null,null,null,null,null], "steam_turbine": [,,,null,null,null,null,null,null], "gas_turbine": [,,,null,null,null,null,null,null], "item_collector": [,,,,null,null,null,null,null], "hull": [,,,,,,,,], "transformer": [,,,,,,,null,null], "b_buffer_1x": [,,,,,,,,], "b_buffer_4x": [,,,,,,,,], "b_buffer_9x": [,,,,,,,,], "b_buffer_16x": [,,,,,,,,], "b_charger_4x": [,,,,,,,,], "i_input": [,,,,,,,,], "i_output": [,,,,,,,,], "f_input": [,,,,,,,,], "f_output": [,,,,,,,,], "e_input": [,,,,,,,,], "e_output": [,,,,,,,,], "fisher": [,,,,null,null,null,null,null], "f_pump": [,,,,,,,,null], "air_collector": [,,,,,,null,null,null], "ceu_1x": [,,,,,,,,null], "cef_1x": [,,,,,,,,null], "ceu_4x": [,,,,,,,,null], "cef_4x": [,,,,,,,,null], "ceu_9x": [,,,,,,,,null], "cef_9x": [,,,,,,,,null], "ceu_16x": [,,,,,,,,null], "cef_16x": [,,,,,,,,null], "casing": [,,,,,,,,], "multiblock_casing": [,,,,,null,null,null,null], "extruder+": [,,,null,null,null,null,null,null], "extruder": [null,null,null,null,,,,,null], "plasma_furnace": [,,,,,,,,null], "mass_fabricator": [,,,,,,,,null], "replicator": [,,,,,,,,null], "naquadah_reactor": [null,null,null,,,,,null,null], "rotor_holder": [null,null,,null,null,,null,null,null], "engraver": [null,,,,,,,,null], "t_centrifuge": [null,,,,,,,,null], "quantum_chest": [null,,,,,null,null,null,null], "quantum_tank": [null,,,,,null,null,null,null], "rftools_crafter": [null,,,,null,null,null,null,null], "mm_e_input": [,,,,,,,null,null], "coke_oven": [,null,null,null,null,null,null,null,null], "vacuum_freezer": [null,null,,null,null,null,null,null,null], "implosion_compressor": [null,null,,null,null,null,null,null,null], "pyrolyse": [null,,null,null,null,null,null,null,null], "cracker": [null,null,,null,null,null,null,null,null], "distillation_tower": [null,null,,null,null,null,null,null,null], "ebf": [,null,null,null,null,null,null,null,null], "multismelter": [,null,null,null,null,null,null,null,null], "lbb": [,null,null,null,null,null,null,null,null], "lsb": [null,null,,null,null,null,null,null,null], "large_steam_turbine": [null,null,null,,null,null,null,null,null], "large_gas_turbine": [null,null,null,,null,null,null,null,null], "plasma_turbine": [null,null,null,null,null,null,null,,null], "assembly_line": [null,null,null,null,,null,null,null,null], "processing_array": [null,null,null,null,,null,null,null,null], "reactor_i": [null,null,null,null,,null,null,null,null], "reactor_ii": [null,null,null,null,null,,null,null,null], "reactor_iii": [null,null,null,null,null,null,,null,null], "disassembler": [null,,null,null,null,null,null,null,null], "black_hole_unit": [null,null,null,,null,null,null,null,null], "black_hole_tank": [null,null,null,,null,null,null,null,null], "magic_absorber": [null,,null,null,null,null,null,null,null], "large_diesel_engine": [null,null,null,,null,null,null,null,null] } as IItemStack[][string]; val untiered_items as IItemStack[string] = { "graphite": .firstItem, "blazerod": , "diamond": .firstItem, "cutting_saw": .firstItem, "chest": .firstItem, "lead": .firstItem, "filter": , "plain_glass": .firstItem, "iron": , "red_wire": , "coke_bricks": , "frost_casing": , "atomic_alloy": , "solidsteel_casing": , "obsidian": .firstItem, "cupronickel_wire": , "heat_casing": , "annealed_wire": , "bronze_casing": , "steel": .firstItem, "vinteum": .firstItem, "tungstensteel": .firstItem, "assembly_casing": , "data_orb": , "hpic": , "superconductor_wire": , "fusion_coil": , "plutonium": .firstItem, "nether_star": .firstItem, "europium": .firstItem, "americium": .firstItem, "void_anvil": .withLore(["I used the disassembler to disassemble the disassembler"]), "ptfe": .firstItem, "lv_circuit": , "compressed_crafting_table": , "tungstensteel_wire": } as IItemStack[string]; val tiered_results as double[string][string] = { "pump": {"rubber_pump":0.5D,"wire_components":1.0D,"metal_pipe":3.0D,"motor":1.0D,"metal_pump":4.375D} as double[string], "conveyor": {"rubber_conveyor":6.0D,"wire_components":1.0D,"motor":2.0D} as double[string], "piston": {"metal_components":5.0D,"wire_components":2.0D,"motor":1.0D} as double[string], "robot_arm": {"metal_components":1.0D,"wire_components":3.0D,"piston":1.0D,"motor":2.0D,"circuit":1.0D} as double[string], "field_generator": {"circuit":4.0D,"field_generator_core":1.0D,"wire_osmium":4.0D} as double[string], "emitter": {"circuit":2.0D,"emitter_core":1.0D,"wire_components":2.0D,"metal_emitter":2.0D} as double[string], "sensor": {"circuit":1.0D,"metal_components":4.0D,"emitter_core":1.0D,"metal_emitter":0.5D} as double[string], "furnace": {"hull":1.0D,"wire_machine":2.0D,"wire_coil":8.0D,"circuit":2.0D} as double[string], "macerator": {"hull":1.0D,"wire_machine":3.0D,"motor":1.0D,"piston":1.0D,"grinding_head":1.0D,"circuit":2.0D} as double[string], "alloy_smelter": {"hull":1.0D,"wire_machine":2.0D,"wire_coil":16.0D,"circuit":2.0D} as double[string], "arc_furnace": {"hull":1.0D,"wire_machine":8.0D,"metal_components":3.0D,"graphite":1.0D,"circuit":1.0D} as double[string], "assembler": {"hull":1.0D,"wire_machine":2.0D,"conveyor":2.0D,"robot_arm":2.0D,"circuit":2.0D} as double[string], "autoclave": {"hull":1.0D,"metal_components":4.0D,"circuit":2.0D,"pump":1.0D,"glass":1.0D} as double[string], "bender": {"hull":1.0D,"wire_machine":2.0D,"motor":2.0D,"piston":2.0D,"circuit":2.0D} as double[string], "brewry": {"hull":1.0D,"wire_machine":2.0D,"pump":1.0D,"blazerod":1.0D,"circuit":2.0D,"glass":2.0D} as double[string], "canner": {"hull":1.0D,"wire_machine":2.0D,"pump":1.0D,"circuit":2.0D,"glass":3.0D} as double[string], "centrifuge": {"hull":1.0D,"wire_machine":2.0D,"motor":2.0D,"circuit":4.0D} as double[string], "bath": {"hull":1.0D,"wire_machine":1.0D,"conveyor":2.0D,"pump":1.0D,"glass":2.0D,"circuit":2.0D} as double[string], "chem_reactor": {"hull":1.0D,"wire_machine":2.0D,"motor":1.0D,"circuit":2.0D,"glass":2.0D,"metal_fan":4.25D} as double[string], "compressor": {"hull":1.0D,"wire_machine":2.0D,"piston":2.0D,"circuit":2.0D} as double[string], "cutting_machine": {"hull":1.0D,"wire_machine":2.0D,"motor":1.0D,"conveyor":1.0D,"circuit":1.0D,"glass":1.0D,"cutting_saw":1.0D} as double[string], "distillery": {"hull":1.0D,"wire_machine":2.0D,"piston":1.0D,"blazerod":1.0D,"circuit":2.0D,"glass":2.0D} as double[string], "electrolyzer": {"hull":1.0D,"wire_machine":1.0D,"circuit":2.0D,"glass":1.0D,"wire_electrolyzer":4.0D} as double[string], "separator": {"hull":1.0D,"wire_machine":3.0D,"conveyor":1.0D,"circuit":1.0D,"rod_separator":1.0D,"wire_separator":2.0D} as double[string], "extractor": {"hull":1.0D,"wire_machine":2.0D,"piston":1.0D,"pump":1.0D,"circuit":2.0D,"glass":2.0D} as double[string], "fermenter": {"hull":1.0D,"wire_machine":4.0D,"glass":2.0D,"pump":1.0D,"circuit":1.0D} as double[string], "f_canner": {"hull":1.0D,"wire_machine":2.0D,"glass":4.0D,"pump":1.0D,"circuit":1.0D} as double[string], "f_extractor": {"hull":1.0D,"wire_machine":2.0D,"glass":2.0D,"pump":1.0D,"piston":1.0D,"circuit":2.0D} as double[string], "f_heater": {"hull":1.0D,"wire_machine":2.0D,"glass":1.0D,"pump":2.0D,"circuit":1.0D,"wire_coil":8.0D} as double[string], "f_solidifier": {"hull":1.0D,"wire_machine":2.0D,"glass":1.0D,"pump":2.0D,"circuit":2.0D,"chest":1.0D} as double[string], "forge_hammer": {"hull":1.0D,"wire_machine":4.0D,"piston":1.0D,"iron":31.0D,"circuit":2.0D} as double[string], "forming_press": {"hull":1.0D,"wire_machine":4.0D,"piston":2.0D,"circuit":2.0D} as double[string], "lathe": {"hull":1.0D,"wire_machine":3.0D,"motor":1.0D,"piston":1.0D,"circuit":2.0D,"diamond":1.0D} as double[string], "microwave": {"hull":1.0D,"wire_machine":1.0D,"motor":1.0D,"emitter":1.0D,"circuit":2.0D,"lead":3.0D} as double[string], "mixer": {"hull":1.0D,"motor":1.0D,"circuit":2.0D,"glass":4.0D,"metal_fan":4.25D} as double[string], "washer": {"hull":1.0D,"wire_machine":2.0D,"motor":1.0D,"circuit":2.0D,"glass":1.0D,"metal_fan":8.5D} as double[string], "packager": {"hull":1.0D,"wire_machine":2.0D,"conveyor":1.0D,"robot_arm":1.0D,"circuit":2.0D,"chest":2.0D} as double[string], "unpackager": {"hull":1.0D,"wire_machine":2.0D,"conveyor":1.0D,"robot_arm":1.0D,"circuit":2.0D,"chest":2.0D} as double[string], "polarizer": {"hull":1.0D,"wire_machine":2.0D,"rod_separator":2.0D,"wire_separator":4.0D} as double[string], "sifter": {"hull":1.0D,"wire_machine":2.0D,"piston":2.0D,"circuit":2.0D,"filter":2.0D} as double[string], "wiremill": {"hull":1.0D,"wire_machine":2.0D,"motor":4.0D,"circuit":2.0D} as double[string], "diesel_generator": {"hull":1.0D,"wire_machine":1.0D,"motor":2.0D,"piston":2.0D,"circuit":1.0D,"metal_components":8.0D} as double[string], "steam_turbine": {"hull":1.0D,"wire_machine":1.0D,"motor":2.0D,"circuit":1.0D,"metal_fan":8.5D,"metal_pipe":6.0D} as double[string], "gas_turbine": {"hull":1.0D,"wire_machine":1.0D,"motor":2.0D,"circuit":2.0D,"metal_fan":12.75D} as double[string], "item_collector": {"hull":1.0D,"wire_machine":1.0D,"motor":2.0D,"circuit":2.0D,"metal_fan":12.75D} as double[string], "hull": {"casing":1.0D,"wire_hull":2.0D} as double[string], "transformer": {"hull":1.0D,"wire_machine":4.0D,"transformer_coil":2.0D} as double[string], "b_buffer_1x": {"hull":1.0D,"wire_hull":4.0D,"chest":1.0D} as double[string], "b_buffer_4x": {"hull":1.0D,"wire_hull":16.0D,"chest":1.0D} as double[string], "b_buffer_9x": {"hull":1.0D,"wire_hull":36.0D,"chest":1.0D} as double[string], "b_buffer_16x": {"hull":1.0D,"wire_hull":64.0D,"chest":1.0D} as double[string], "b_charger_4x": {"hull":1.0D,"wire_hull":64.0D,"chest":1.0D,"circuit":1.0D,"battery":2.0D} as double[string], "i_input": {"hull":1.0D,"chest":1.0D} as double[string], "i_output": {"hull":1.0D,"chest":1.0D} as double[string], "f_input": {"hull":1.0D,"plain_glass":1.0D} as double[string], "f_output": {"hull":1.0D,"plain_glass":1.0D} as double[string], "e_input": {"hull":1.0D,"wire_hull":1.0D} as double[string], "e_output": {"hull":1.0D,"wire_hull":1.0D} as double[string], "fisher": {"hull":1.0D,"motor":3.0D,"piston":2.0D,"pump":1.0D,"circuit":2.0D} as double[string], "f_pump": {"hull":1.0D,"pump":4.0D,"circuit":2.0D,"metal_pipe":6.0D} as double[string], "air_collector": {"hull":1.0D,"pump":2.0D,"circuit":1.0D,"filter":1.0D,"iron":1.5D} as double[string], "ceu_1x": {"hull":1.0D,"circuit":1.0D,"chest":1.0D,"wire_hull":4.0D,"red_wire":2.0D} as double[string], "cef_1x": {"hull":1.0D,"circuit":1.0D,"chest":1.0D,"wire_hull":4.0D,"red_wire":2.0D} as double[string], "ceu_4x": {"hull":1.0D,"circuit":1.0D,"chest":1.0D,"wire_hull":16.0D,"red_wire":8.0D} as double[string], "cef_4x": {"hull":1.0D,"circuit":1.0D,"chest":1.0D,"wire_hull":16.0D,"red_wire":8.0D} as double[string], "ceu_9x": {"hull":1.0D,"circuit":1.0D,"chest":1.0D,"wire_hull":36.0D,"red_wire":18.0D} as double[string], "cef_9x": {"hull":1.0D,"circuit":1.0D,"chest":1.0D,"wire_hull":36.0D,"red_wire":18.0D} as double[string], "ceu_16x": {"hull":1.0D,"circuit":1.0D,"chest":1.0D,"wire_hull":64.0D,"red_wire":32.0D} as double[string], "cef_16x": {"hull":1.0D,"circuit":1.0D,"chest":1.0D,"wire_hull":64.0D,"red_wire":32.0D} as double[string], "casing": {"metal_hull":8.0D} as double[string], "multiblock_casing": {"metal_hull":2.45833333333D} as double[string], "extruder+": {"hull":1.0D,"piston":1.0D,"circuit":2.0D,"metal_pipe":3.0D,"wire_coil":16.0D} as double[string], "extruder": {"hull":1.0D,"piston":1.0D,"circuit":2.0D,"metal_pipe":3.0D,"wire_coil":16.0D} as double[string], "plasma_furnace": {"hull":1.0D,"circuit":2.0D,"wire_machine":8.0D,"pump":2.0D,"graphite":1.0D,"metal_components":1.0D} as double[string], "mass_fabricator": {"hull":1.0D,"circuit":4.0D,"field_generator":2.0D,"wire_machine":8.0D} as double[string], "replicator": {"hull":1.0D,"circuit":4.0D,"field_generator":1.0D,"emitter":4.0D,"wire_machine":4.0D} as double[string], "naquadah_reactor": {"hull":1.0D,"field_generator":2.0D,"wire_machine":8.0D,"circuit":2.0D,"rod_naqreactor":2.0D} as double[string], "rotor_holder": {"hull":1.0D,"wire_components":112.0D,"metal_holder":4.0D} as double[string], "engraver": {"hull":1.0D,"wire_machine":2.0D,"piston":2.0D,"circuit":3.0D,"emitter":1.0D} as double[string], "t_centrifuge": {"hull":1.0D,"wire_machine":2.0D,"motor":2.0D,"wire_coil":8.0D,"circuit":2.0D} as double[string], "quantum_chest": {"hull":1.0D,"metal_components":3.0D,"circuit":4.0D,"field_generator":1.0D} as double[string], "quantum_tank": {"hull":1.0D,"metal_components":3.0D,"circuit":4.0D,"field_generator":1.0D} as double[string], "rftools_crafter": {"hull":1.0D,"compressed_crafting_table":1.0D,"lv_circuit":1.0D} as double[string], "mm_e_input": {"e_input":1.0D,"red_wire":2.0D}, "coke_oven": {"iron":4.0D,"coke_bricks":4.0D} as double[string], "vacuum_freezer": {"frost_casing":1.0D,"wire_machine":2.0D,"pump":3.0D,"atomic_alloy":3.0D} as double[string], "implosion_compressor": {"solidsteel_casing":1.0D,"wire_machine":2.0D,"circuit":3.0D,"obsidian":3.0D} as double[string], "pyrolyse": {"hull":1.0D,"piston":2.0D,"pump":1.0D,"circuit":3.0D,"wire_coil":8.0D} as double[string], "cracker": {"hull":1.0D,"pump":2.0D,"circuit":2.0D,"cupronickel_wire":64.0D} as double[string], "distillation_tower": {"hull":1.0D,"pump":2.0D,"circuit":4.0D,"metal_pipe":12.0D} as double[string], "ebf": {"circuit":1.0D,"heat_casing":1.0D,"wire_machine":2.0D,"furnace":1.0D,"graphite":3.0D} as double[string], "multismelter": {"furnace":2.0D,"circuit":3.0D,"heat_casing":2.0D,"annealed_wire":2.0D} as double[string], "lbb": {"circuit":4.0D,"wire_machine":4.0D,"bronze_casing":1.0D} as double[string], "lsb": {"circuit":2.0D} as double[string], "large_steam_turbine": {"hull":1.0D,"circuit":2.0D,"steel":16.0D,"vinteum":2.0D} as double[string], "large_gas_turbine": {"hull":1.0D,"circuit":2.0D,"metal_pump":28.0D} as double[string], "plasma_turbine": {"hull":1.0D,"circuit":2.0D,"tungstensteel":28.0D} as double[string], "assembly_line": {"hull":1.0D,"robot_arm":2.0D,"circuit":2.0D,"assembly_casing":4.0D} as double[string], "processing_array": {"hull":1.0D,"robot_arm":2.0D,"circuit":4.0D,"battery":1.0D,"data_orb":1.0D} as double[string], "reactor_i": {"hpic":32.0D,"superconductor_wire":32.0D,"field_generator":2.0D,"fusion_coil":1.0D,"plutonium":1.0D,"nether_star":1.0D,"circuit":4.0D} as double[string], "reactor_ii": {"hpic":48.0D,"superconductor_wire":64.0D,"field_generator":2.0D,"fusion_coil":1.0D,"europium":4.0D,"circuit":4.0D} as double[string], "reactor_iii": {"hpic":64.0D,"superconductor_wire":128.0D,"field_generator":2.0D,"fusion_coil":1.0D,"americium":4.0D,"circuit":4.0D} as double[string], "disassembler": {"hull":1.0D,"robot_arm":3.0D,"circuit":4.0D,"void_anvil":1.0D} as double[string], "black_hole_unit": {"hull":1.0D,"field_generator":1.0D,"circuit":4.0D,"ptfe":3.0D} as double[string], "black_hole_tank": {"hull":1.0D,"field_generator":1.0D,"circuit":4.0D,"ptfe":3.0D} as double[string], "magic_absorber": {"hull":1.0D,"pump":4.0D,"sensor":2.0D,"circuit":2.0D} as double[string], "large_diesel_engine": {"hull":1.0D,"tungstensteel_wire":1.0D,"motor":2.0D,"piston":2.0D,"circuit":1.0D,"metal_components":8.0D} as double[string] } as double[string][string]; // amount of various items the actual items give, eg if we specify tiny dust for metal_hull this would be 0.11 // but for small dust it would be 0.25 and for dust it would be 1, etc // 1 by default. Note that one wire for a wire_* is 1 not 0.5 // tiny dusts cause inherent losses, eg a pump should return 4.325 metal_pump but this must be rounded down to 4.222222 // there are also inherent losses for luv and uv recipes which yield metal_pipe because I just picked the largest dust // up to 1/3rd of the material in a pipe for that tier, which for small and large ultimet pipes is not // the correct fraction. Also, ultimet pipes can be made from tungsten pipes and ev pumps, but they are // pulverizable into ultimet dust by default so I did not consider this exploitable val item_units as double[string] = { "iron": 0.111111D, "metal_hull": 0.25D, "metal_components": 0.111111D, "metal_pump": 0.111111D, "metal_pipe": 0.25D, "metal_emitter": 0.25D, "metal_fan": 0.111111D, "rubber_pump": 0.25D, "rubber_conveyor": 0.25D } as double[string]; // NOTE luv+ robot arms, emitters, and sensors TIER SHIFT the required circuits by -2 // also note that the emitters in emitters and sensors in sensors are a tier lower (duh) val high_tiered_extras as double[string][string] = { "pump": {"rubber_pump":3.5D,"wire_components":1.0D,"motor":1.0D,"metal_pump":5.625D,"metal_pipe":3.0D} as double[string], "conveyor": {"rubber_conveyor":4.0D,"wire_components":1.0D,"metal_components":28.0D} as double[string], "piston": {"metal_components": 17.0D} as double[string], "robot_arm": {"metal_components":10.0D,"wire_components":29.0D,"circuit":7.0D} as double[string], "field_generator": {"circuit":12.0D,"emitter":4.0D,"wire_components":32.0D,"metal_components":1.375D} as double[string], "emitter": {"circuit":6.0D,"emitter_core":7.0D,"wire_components":14.0D,"metal_emitter":46.0D,"metal_components":1.375D,"emitter":2.0D} as double[string], "sensor": {"circuit":6.0D,"metal_components":-2.625D,"emitter_core":7.0D,"metal_emitter":47.5D,"wire_components":16.0D,"sensor":2.0D} as double[string] } as double[string][string]; // [input guaranteed, input chance, output guaranteed, output chance] multipliers for yields when an item is an input and output of disassembly // remember that guaranteed outputs must be rounded down, so keep this in mind for recipes that only use one of a microcomponent // however, if neither guaranteed multiplier is zero, at least one item will be returned unless the return amount is smaller than the unit size for that item // in which case none will ever be returned. // NOTE the meaning of these numbers is a little confusing: the guaranteed multiplier is interpreted as the fraction of outputs to guarantee, // and the chance multiplier is interpreted as the base chance to give the rest of the outputs. // the chance always increases by 13% of the difference between the base chance and 100% every tier. // since there are 7 times disassembling can overclock it can never reach 100% val yield_multipliers as double[][string] = { "graphite": [0.0D, 0.0D, 0.4D, 0.5D], "blazerod": [0.0D, 0.0D, 0.0D, 0.5D], "diamond": [0.0D, 0.0D, 0.4D, 0.5D], "cutting_saw": [0.0D, 0.0D, 0.0D, 0.7D], "chest": [0.0D, 0.0D, 0.0D, 0.7D], "lead": [0.0D, 0.0D, 0.4D, 0.5D], "filter": [0.0D, 0.0D, 0.5D, 0.5D], "plain_glass": [0.0D, 0.0D, 0.0D, 0.6D], "iron": [0.0D, 0.0D, 0.4D, 0.4D], "red_wire": [0.0D, 0.0D, 0.4D, 0.6D], "coke_bricks": [0.0D, 0.0D, 0.6D, 0.6D], "frost_casing": [0.0D, 0.0D, 0.6D, 0.6D], "atomic_alloy": [0.0D, 0.0D, 0.6D, 0.6D], "solidsteel_casing": [0.0D, 0.0D, 0.6D, 0.6D], "obsidian": [0.0D, 0.0D, 0.6D, 0.6D], "cupronickel_wire": [0.0D, 0.0D, 0.6D, 0.6D], "heat_casing": [0.0D, 0.0D, 0.6D, 0.6D], "annealed_wire": [0.0D, 0.0D, 0.6D, 0.6D], "bronze_casing": [0.0D, 0.0D, 0.6D, 0.6D], "steel": [0.0D, 0.0D, 0.6D, 0.6D], "vinteum": [0.0D, 0.0D, 0.6D, 0.6D], "tungstensteel": [0.0D, 0.0D, 0.6D, 0.6D], "assembly_casing": [0.0D, 0.0D, 0.6D, 0.6D], "data_orb": [0.0D, 0.0D, 0.6D, 0.6D], "hpic": [0.0D, 0.0D, 0.6D, 0.6D], "superconductor_wire": [0.0D, 0.0D, 0.6D, 0.6D], "fusion_coil": [0.0D, 0.0D, 0.6D, 0.6D], "plutonium": [0.0D, 0.0D, 0.6D, 0.6D], "nether_star": [0.0D, 0.0D, 0.6D, 0.6D], "europium": [0.0D, 0.0D, 0.6D, 0.6D], "americium": [0.0D, 0.0D, 0.6D, 0.6D], "void_anvil": [0.0D, 0.0D, 0.6D, 0.6D], "ptfe": [0.0D, 0.0D, 0.6D, 0.6D], "lv_circuit": [0.0D, 0.0D, 0.6D, 0.6D], "compressed_crafting_table": [0.0D, 0.0D, 0.6D, 0.6D], "tungstensteel_wire": [0.0D, 0.0D, 0.4D, 0.6D], "circuit": [0.0D, 0.0D, 0.6D, 0.6D], "motor": [0.0D, 0.0D, 0.6D, 0.6D], "pump": [1.0D, 1.0D, 0.7D, 0.6D], "conveyor": [1.0D, 1.0D, 0.7D, 0.6D], "piston": [1.0D, 1.0D, 0.7D, 0.6D], "robot_arm": [1.0D, 1.0D, 0.8D, 0.6D], "field_generator": [1.0D, 1.0D, 0.7D, 0.6D], "emitter": [1.0D, 1.0D, 0.7D, 0.3D], "sensor": [1.0D, 1.0D, 0.7D, 0.3D], "battery": [0.0D, 0.0D, 0.7D, 0.5D], "field_generator_core": [0.0D, 0.0D, 0.4D, 0.7D], "emitter_core": [0.0D, 0.0D, 0.4D, 0.7D], "grinding_head": [0.0D, 0.0D, 0.0D, 0.7D], "metal_hull": [0.0D, 0.0D, 0.4D, 0.6D], "metal_components": [0.0D, 0.0D, 0.4D, 0.6D], "metal_pump": [0.0D, 0.0D, 0.5D, 0.6D], "metal_pipe": [0.0D, 0.0D, 0.5D, 0.6D], "metal_emitter": [0.0D, 0.0D, 0.4D, 0.4D], "metal_fan": [0.0D, 0.0D, 0.5D, 0.5D], "metal_holder": [0.0D, 0.0D, 0.6D, 0.6D], "rubber_pump": [0.0D, 0.0D, 0.3D, 0.5D], "rubber_conveyor": [0.0D, 0.0D, 0.3D, 0.5D], "wire_hull": [0.0D, 0.0D, 0.5D, 0.6D], "wire_machine": [0.0D, 0.0D, 0.5D, 0.6D], "wire_components": [0.0D, 0.0D, 0.4D, 0.6D], "wire_coil": [0.0D, 0.0D, 0.5D, 0.7D], "wire_osmium": [0.0D, 0.0D, 0.5D, 0.3D], "wire_electrolyzer": [0.0D, 0.0D, 0.6D, 0.6D], "wire_separator": [0.0D, 0.0D, 0.4D, 0.5D], "rod_separator": [0.0D, 0.0D, 0.4D, 0.6D], "rod_naqreactor": [0.0D, 0.0D, 0.4D, 0.6D], "glass": [0.0D, 0.0D, 0.5D, 0.5D], "transformer_coil": [0.0D, 0.0D, 0.5D, 0.5D], "furnace": [0.9D, 0.9D, 0.8D, 0.2D], "macerator": [0.9D, 0.9D, 0.0D, 0.0D], "alloy_smelter": [0.9D, 0.9D, 0.0D, 0.0D], "arc_furnace": [0.8D, 0.8D, 0.0D, 0.0D], "assembler": [0.8D, 0.8D, 0.0D, 0.0D], "autoclave": [0.9D, 0.9D, 0.0D, 0.0D], "bender": [0.8D, 0.8D, 0.0D, 0.0D], "brewry": [0.9D, 0.9D, 0.0D, 0.0D], "canner": [0.7D, 0.7D, 0.0D, 0.0D], "centrifuge": [0.9D, 0.9D, 0.0D, 0.0D], "bath": [0.8D, 0.8D, 0.0D, 0.0D], "chem_reactor": [0.8D, 0.8D, 0.0D, 0.0D], "compressor": [0.6D, 0.6D, 0.0D, 0.0D], "cutting_machine": [0.9D, 0.9D, 0.0D, 0.0D], "distillery": [0.7D, 0.7D, 0.0D, 0.0D], "electrolyzer": [0.9D, 0.9D, 0.0D, 0.0D], "separator": [0.6D, 0.6D, 0.0D, 0.0D], "extractor": [0.6D, 0.6D, 0.0D, 0.0D], "fermenter": [0.9D, 0.9D, 0.0D, 0.0D], "f_canner": [0.6D, 0.6D, 0.0D, 0.0D], "f_extractor": [0.7D, 0.7D, 0.0D, 0.0D], "f_heater": [0.6D, 0.6D, 0.0D, 0.0D], "f_solidifier": [0.9D, 0.9D, 0.0D, 0.0D], "forge_hammer": [0.6D, 0.6D, 0.0D, 0.0D], "forming_press": [0.5D, 0.5D, 0.0D, 0.0D], "lathe": [0.9D, 0.9D, 0.0D, 0.0D], "microwave": [0.5D, 0.5D, 0.0D, 0.0D], "mixer": [0.8D, 0.8D, 0.0D, 0.0D], "washer": [0.9D, 0.9D, 0.0D, 0.0D], "packager": [0.6D, 0.6D, 0.0D, 0.0D], "unpackager": [0.6D, 0.6D, 0.0D, 0.0D], "polarizer": [0.6D, 0.6D, 0.0D, 0.0D], "sifter": [0.9D, 0.9D, 0.0D, 0.0D], "wiremill": [0.9D, 0.9D, 0.0D, 0.0D], "diesel_generator": [0.9D, 0.9D, 0.0D, 0.0D], "steam_turbine": [0.9D, 0.9D, 0.0D, 0.0D], "gas_turbine": [0.9D, 0.9D, 0.0D, 0.0D], "item_collector": [0.5D, 0.5D, 0.0D, 0.0D], "hull": [1.0D, 1.0D, 1.0D, 0.4D], "transformer": [1.0D, 1.0D, 0.0D, 0.0D], "b_buffer_1x": [0.7D, 0.7D, 0.0D, 0.0D], "b_buffer_4x": [0.7D, 0.7D, 0.0D, 0.0D], "b_buffer_9x": [0.7D, 0.7D, 0.0D, 0.0D], "b_buffer_16x": [0.7D, 0.7D, 0.0D, 0.0D], "b_charger_4x": [0.6D, 0.6D, 0.0D, 0.0D], "i_input": [0.6D, 0.6D, 0.0D, 0.0D], "i_output": [0.6D, 0.6D, 0.0D, 0.0D], "f_input": [0.6D, 0.6D, 0.0D, 0.0D], "f_output": [0.6D, 0.6D, 0.0D, 0.0D], "e_input": [0.6D, 0.6D, 0.6D, 0.6D], "e_output": [0.6D, 0.6D, 0.0D, 0.0D], "fisher": [0.5D, 0.5D, 0.0D, 0.0D], "f_pump": [0.5D, 0.5D, 0.0D, 0.0D], "air_collector": [0.7D, 0.7D, 0.0D, 0.0D], "ceu_1x": [0.6D, 0.6D, 0.0D, 0.0D], "cef_1x": [0.6D, 0.6D, 0.0D, 0.0D], "ceu_4x": [0.6D, 0.6D, 0.0D, 0.0D], "cef_4x": [0.7D, 0.7D, 0.0D, 0.0D], "ceu_9x": [0.6D, 0.6D, 0.0D, 0.0D], "cef_9x": [0.6D, 0.6D, 0.0D, 0.0D], "ceu_16x": [0.7D, 0.7D, 0.0D, 0.0D], "cef_16x": [0.6D, 0.6D, 0.0D, 0.0D], "casing": [1.0D, 1.0D, 1.0D, 0.0D], "multiblock_casing": [1.0D, 1.0D, 1.0D, 1.0D], "extruder+": [0.9D, 0.9D, 0.0D, 0.0D], "extruder": [0.8D, 0.8D, 0.0D, 0.0D], "plasma_furnace": [0.6D, 0.6D, 0.0D, 0.0D], "mass_fabricator": [0.6D, 0.6D, 0.0D, 0.0D], "replicator": [0.6D, 0.6D, 0.0D, 0.0D], "naquadah_reactor": [0.6D, 0.6D, 0.0D, 0.0D], "rotor_holder": [0.8D, 0.8D, 0.0D, 0.0D], "engraver": [0.9D, 0.9D, 0.0D, 0.0D], "t_centrifuge": [0.7D, 0.7D, 0.0D, 0.0D], "quantum_chest": [0.6D, 0.6D, 0.0D, 0.0D], "quantum_tank": [0.6D, 0.6D, 0.0D, 0.0D], "rftools_crafter": [0.0D, 0.7D, 0.0D, 0.0D], "mm_e_input": [0.6D, 0.6D, 0.0D, 0.0D], "coke_oven": [0.6D, 0.6D, 0.0D, 0.0D], "vacuum_freezer": [0.6D, 0.6D, 0.0D, 0.0D], "implosion_compressor": [0.6D, 0.6D, 0.0D, 0.0D], "pyrolyse": [0.6D, 0.6D, 0.0D, 0.0D], "cracker": [0.6D, 0.6D, 0.0D, 0.0D], "distillation_tower": [0.6D, 0.6D, 0.0D, 0.0D], "ebf": [0.6D, 0.6D, 0.0D, 0.0D], "multismelter": [0.6D, 0.6D, 0.0D, 0.0D], "lbb": [0.6D, 0.6D, 0.0D, 0.0D], "lsb": [0.6D, 0.6D, 0.0D, 0.0D], "large_steam_turbine": [0.6D, 0.6D, 0.0D, 0.0D], "large_gas_turbine": [0.6D, 0.6D, 0.0D, 0.0D], "plasma_turbine": [0.6D, 0.6D, 0.0D, 0.0D], "assembly_line": [0.6D, 0.6D, 0.0D, 0.0D], "processing_array": [0.6D, 0.6D, 0.0D, 0.0D], "reactor_i": [0.6D, 0.6D, 0.0D, 0.0D], "reactor_ii": [0.6D, 0.6D, 0.0D, 0.0D], "reactor_iii": [0.6D, 0.6D, 0.0D, 0.0D], "disassembler": [0.6D, 0.6D, 0.0D, 0.0D], "black_hole_unit": [0.6D, 0.6D, 0.0D, 0.0D], "black_hole_tank": [0.6D, 0.6D, 0.0D, 0.0D], "magic_absorber": [0.6D, 0.6D, 0.0D, 0.0D], "large_diesel_engine": [0.6D, 0.6D, 0.0D, 0.0D] } as double[][string]; // some UV items need their wire_machine/wire_hull yield divided by 4 // this is pretty much the set of machines that use `wire_hull` instead of `wire_machine` // besides cefs/ceus/battery bois/energy hatches, // except UV hulls themselves use 4x wire val uv_wire_mod as double[string] = { "arc_furnace": 0.25D, "plasma_furnace": 0.25D, "mass_fabricator": 0.25D, "replicator": 0.25D, "hull": 4.0D, "e_input": 4.0D, "e_output": 4.0D } as double[string]; val tier_shift_circuits as int[string] = { "plasma_furnace": 1, "mass_fabricator": 1, "replicator": 1, "cracker": 1, "multismelter": 2, "large_steam_turbine": -1, "plasma_turbine": -2, "reactor_i": 2, "reactor_ii": 2, "reactor_iii": 2, "black_hole_unit": 1, "black_hole_tank": 1 } as int[string]; // used as a set of what LuV+ items need to yield circuits two tiers lower val luvp_tier_unshift2_circuits as bool[string] = { "robot_arm": true, "emitter": true, "sensor": true } as bool[string]; //crafttweaker doesn't seem to support << val pow2 as int[] = [1, 2, 4, 8, 16, 32, 64, 128, 256] as int[]; for item_name, base_result_map in tiered_results { print("Processing recipes for " + item_name); if(item_name == "transformer"){ print("(expect 'unregistered tiered component: transformer_coil' warnings)"); } // for every tier from LV to MAX for i in 0 to 9 { val item_tier_i as IItemStack = tiered_items[item_name][i] as IItemStack; if(!isNull(item_tier_i)){ val item_guaranteed_multiplier as double = (yield_multipliers[item_name][0]) as double; val item_chance_multiplier as double = (yield_multipliers[item_name][1]) as double; var recipeBuilder = disassembler_recipe_map.recipeBuilder() .duration(2*60*20*pow2[i]) .EUt(128) .inputs(tiered_items[item_name][i]); var guaranteed_outputs as IItemStack[] = [] as IItemStack[]; for component_name, component_base_amount in base_result_map { var tier_shift as int = 0 as int; var component_amount as double = component_base_amount as double; if(!(yield_multipliers has component_name)){ print("WARNING"); print("component_name: " + component_name); print("was not present in yield_multipliers, this script will now crash"); } val component_guaranteed_frac as double = (item_guaranteed_multiplier*yield_multipliers[component_name][2]) as double; val component_chance as double = (item_chance_multiplier*yield_multipliers[component_name][3]) as double; if(component_name == "circuit"){ if(tier_shift_circuits has item_name){ tier_shift = tier_shift_circuits[item_name] as int; }else if(i >= 5 && (luvp_tier_unshift2_circuits has item_name)){ tier_shift -= 2; } }else if(component_name == item_name){ tier_shift -= 1; } val component_item as IItemStack = ((untiered_items has component_name) ? untiered_items[component_name] : tiered_items[component_name][i + tier_shift]) as IItemStack; if(i >= 5 && high_tiered_extras has item_name && high_tiered_extras[item_name] has component_name){ component_amount += high_tiered_extras[item_name][component_name]; } if(i == 7 && (component_name == "wire_hull" || component_name == "wire_machine") && (uv_wire_mod has item_name)){ component_amount *= uv_wire_mod[item_name]; }else if(i <= 3 && component_name == "wire_machine" && item_name == "bender"){ component_amount *= 0.5D;//low tier bending machines use a wrench instead of the top wire } if(item_units has component_name){ component_amount = component_amount/item_units[component_name]; } if(isNull(component_item)){ print("WARNING: disassembling tiered item requires unregistered tiered component, skipping component"); print("item_name: " + item_name); print("component_name: " + component_name); print("i: " + i); print("tier_shift: " + tier_shift); }else{ var component_guaranteed_amount as int = (component_amount*component_guaranteed_frac) as int; if(component_guaranteed_amount == 0 && component_guaranteed_frac != 0 && component_amount >= 1.0D){ component_guaranteed_amount += 1; } val component_chanced_amount as int = (component_amount - component_guaranteed_amount) as int; if(component_guaranteed_amount > 0){ guaranteed_outputs += component_item*component_guaranteed_amount; } if(component_chanced_amount > 0 && component_chance > 0.0D){ recipeBuilder.chancedOutput(component_item*component_chanced_amount, (component_chance*10000.0D) as int, ((1.0D-component_chance)*1300.0D) as int); } } } if(i >= 5 && (high_tiered_extras has item_name)){ for component_name, component_base_amount in high_tiered_extras[item_name] { if(!(tiered_results[item_name] has component_name)){ var tier_shift as int = 0 as int; if(component_name == item_name){ tier_shift -= 1; } val component_item as IItemStack = ((untiered_items has component_name) ? untiered_items[component_name] : tiered_items[component_name][i + tier_shift]) as IItemStack; var component_amount as double = component_base_amount as double; if(item_units has component_name){ component_amount = component_amount/item_units[component_name]; } val component_guaranteed_frac as double = (item_guaranteed_multiplier*yield_multipliers[component_name][2]) as double; val component_chance as double = (item_chance_multiplier*yield_multipliers[component_name][3]) as double; var component_guaranteed_amount as int = (component_amount*component_guaranteed_frac) as int; if(component_guaranteed_amount == 0 && component_guaranteed_frac != 0 && component_amount >= 1.0D){ component_guaranteed_amount += 1; } val component_chanced_amount as int = (component_amount - component_guaranteed_amount) as int; if(component_guaranteed_amount > 0){ guaranteed_outputs += component_item*component_guaranteed_amount; } if(component_chanced_amount > 0){ recipeBuilder.chancedOutput(component_item*component_chanced_amount, (component_chance*10000.0D) as int, ((1.0D-component_chance)*1300.0D) as int); } } } } if(item_name == "transformer"){ val nextwire_guaranteed_frac as double = (item_guaranteed_multiplier*yield_multipliers["wire_machine"][2]) as double; val nextwire_chance as double = (item_chance_multiplier*yield_multipliers["wire_machine"][3]) as double; val nextwire_amount as double = 1.0D as double; val nextwire_item as IItemStack = tiered_items["wire_machine"][i + 1] as IItemStack; var nextwire_guaranteed_amount as int = (nextwire_amount*nextwire_guaranteed_frac) as int; if(nextwire_guaranteed_amount == 0 && nextwire_guaranteed_frac != 0 && nextwire_amount >= 1.0D){ nextwire_guaranteed_amount += 1; } val nextwire_chanced_amount as int = (nextwire_amount - nextwire_guaranteed_amount) as int; if(nextwire_guaranteed_amount > 0){ guaranteed_outputs += nextwire_item*nextwire_guaranteed_amount; } if(nextwire_chanced_amount > 0){ recipeBuilder.chancedOutput(nextwire_item*nextwire_chanced_amount, (nextwire_chance*10000.0D) as int, ((1.0D-nextwire_chance)*1300.0D) as int); } } recipeBuilder.outputs(guaranteed_outputs); if(guaranteed_outputs.length == 0){ print("Potentially empty recipe output!"); } recipeBuilder.buildAndRegister(); } } } //begin non tiered recipes val nontiered_recipes as IItemStack[][IItemStack] = { *1: [*1,*2], *1: [*101], *1: [*5,*12], *1: [*9], *1: [*1,*4,*1,*3], *1: [*1,*3,*16,*1], *1: [*1,*1,*16,*1,*2], *1: [*1,*2,*3,*3], *1: [*16], *1: [*1,*4,*2,*2], *1: [*8,*1], *1: [*9], *1: [*23], *1: [*9], *1: [*23], *1: [*4,*18], *1: [*1,*6,*18], *1: [*1,*6,*18], *1: [*2,*7,*21,*3,*3], *1: [*1,*6,*18], *1: [*2,*1,*2,*4], *1: [*1,*24], *1: [*1,*24], *1: [*1,*1,*1,*32,*4], *1: [*4,*24], *1: [*1,*3,*1,*8], *1: [*1,*1,*14], *1: [*1,*3,*16,*17], *1: [*1,*2,*4,*2], *1: [*4,*1,*3,*1], *1: [*4,*12,*8,*7], *1: [*1,*2,*2,*1], *1: [*1,*1], *1: [*1,*1,*1], *1: [*1,*8,*4,*1], *1: [*1,*2,*8,*4], *1: [*1,*2,*8,*4], *1: [*1,*1,*1], *1: [*1,*28,*1], *1: [*1,*28,*1], *1: [*1,*4,*4], *1: [*1,*2,*2,*4], *1: [*1,*5,*1,*2], *1: [*4,*1], *1: [*8,*5], *1: [*1,*4,*2,*24], *1: [*1,*1,*2,*2,*2,*1], *1: [*4,*1,*4], *1: [*20,*1,*2,*1], *1: [*1,*1,*1,*2,*16], *1: [*1,*2,*2,*1,*4], *1: [*1,*1,*63], *1: [*16,*4,*1,*2], *1: [*24,*1,*1], *1: [*1,*12,*54,*3], *1: [*1,*1,*1,*18,*32], *1: [*1,*1,*1,*18,*32], *1: [*1,*1,*9], *1: [*1,*1,*32,*9,*2], *1: [*1,*1,*1,*32,*18], *1: [*1,*1,*1,*32,*18], *1: [*1,*1,*1,*32,*18], *1: [*1,*2,*2,*1,*16,*16], *1: [*1,*2,*1,*16,*2,*2], *1: [*1,*2,*1,*1,*2,*32], *1: [*1,*2,*32,*1,*1,*2], *1: [*1,*2,*2,*44,*1], *1: [*1,*2,*32,*1,*16,*1,*1], *1: [*1,*1,*3,*12], *1: [*1,*16,*2,*3,*8], *1: [*1,*2,*16,*2,*2,*1], *1: [*1,*2,*32,*28], *1: [*1,*2,*1,*2,*3], *1: [*1,*1,*2,*16,*3], *1: [*1,*4,*1,*1,*1,*1], *1: [*1,*5,*16], *1: [*1,*2,*3,*16,*2], *1: [*1,*1,*2,*2,*44], *1: [*1,*3,*2,*8,*1], *1: [*1,*16,*4,*2,*1], *1: [*1,*2,*32,*3,*1], *1: [*1,*4,*16], *1: [*2,*4], *1: [*1,*2], *1: [*32], *1: [*7,*1,*1], *1: [*4,*8,*2,*1], *1: [*3,*3,*6], *1: [*6,*2,*1], *1: [*3,*3,*4], *1: [*3,*3,*1], *2: [*3,*2,*1] } as IItemStack[][IItemStack]; val nontiered_times as int[IItemStack] = { *2: 480, *1: 2*60*20*128 } as int[IItemStack]; for inputstack, results in nontiered_recipes { val recipe_time = (nontiered_times has inputstack ? nontiered_times[inputstack] : 2*60*20*2 ); var recipeBuilder = disassembler_recipe_map.recipeBuilder() .duration(recipe_time) .EUt(128) .inputs(inputstack); var guaranteed_outputs as IItemStack[] = [] as IItemStack[]; val component_guaranteed_frac as double = 0.5D as double; val component_chance as double = 0.6D as double; for outputstack in results { val component_item = outputstack.withAmount(1); val component_amount as double = outputstack.amount as double; var component_guaranteed_amount as int = (component_amount*component_guaranteed_frac) as int; if(component_guaranteed_amount == 0 && component_guaranteed_frac != 0 && component_amount >= 1.0D){ component_guaranteed_amount += 1; } val component_chanced_amount as int = (component_amount - component_guaranteed_amount) as int; if(component_guaranteed_amount > 0){ guaranteed_outputs += component_item*component_guaranteed_amount; } if(component_chanced_amount > 0){ recipeBuilder.chancedOutput(component_item*component_chanced_amount, (component_chance*10000.0D) as int, ((1.0D-component_chance)*1300.0D) as int); } } if(guaranteed_outputs.length > 0){ recipeBuilder.outputs(guaranteed_outputs); } recipeBuilder.buildAndRegister(); } print("----------------Disassembler End-------------------");