From 4a28775e9cfee6575e4e4802ea4e0118347b843f Mon Sep 17 00:00:00 2001 From: agp8x Date: Mon, 17 Apr 2023 00:39:40 +0200 Subject: [PATCH] add caterium circuit board, migrate to recipe builder --- src/main/java/satisfactory/Database.java | 731 +++++++++--------- src/main/java/satisfactory/Test.java | 2 +- src/main/java/satisfactory/items/Item.java | 13 +- src/main/java/satisfactory/items/Recipe.java | 39 +- .../satisfactory/items/RecipeBuilder.java | 89 +++ .../java/satisfactory/items/ItemTest.java | 18 +- 6 files changed, 493 insertions(+), 399 deletions(-) create mode 100644 src/main/java/satisfactory/items/RecipeBuilder.java diff --git a/src/main/java/satisfactory/Database.java b/src/main/java/satisfactory/Database.java index 5b708f1..c68c26f 100644 --- a/src/main/java/satisfactory/Database.java +++ b/src/main/java/satisfactory/Database.java @@ -1,16 +1,18 @@ package satisfactory; import satisfactory.buildings.Building; -import satisfactory.buildings.ProductionBuilding; import satisfactory.buildings.PowerGenerationBuilding; +import satisfactory.buildings.ProductionBuilding; import satisfactory.items.Item; import satisfactory.items.Recipe; +import satisfactory.items.RecipeBuilder; import satisfactory.items.type.*; import java.util.*; public class Database { public static final Item TODO_ITEM = new Ore("TODO ITEM"); + // BUILDINGS public static final class Buildings { public static final Building ASSEMBLER = new ProductionBuilding("Assembler", 15, assembler()); @@ -168,9 +170,10 @@ public class Database { } public static final Building BIOMASS_BURNER = new PowerGenerationBuilding("Biomass Burner", 30, biomassBurner(), biomassBurnerConsumes()); - public static final Building COAL_GENERATOR = new PowerGenerationBuilding("Coal Generator", 75, coalGenerator(),coalGeneratorConsumes()); + public static final Building COAL_GENERATOR = new PowerGenerationBuilding("Coal Generator", 75, coalGenerator(), coalGeneratorConsumes()); public static final Building FUEL_GENERATOR = new PowerGenerationBuilding("Fuel Generator", 150, fuelGenerator(), fuelGeneratorConsumes()); public static final Building GEOTHERMAL_GENERATOR = new PowerGenerationBuilding("Geothermal Generator", 9999, geothermalGenerator(), new HashMap<>()); + private static Map biomassBurner() { Map cost = new HashMap<>(); cost.put(Database.IronPlate, 15); @@ -178,11 +181,13 @@ public class Database { cost.put(Database.Wire, 25); return cost; } + private static Map biomassBurnerConsumes() { Map cost = new HashMap<>(); // TODO values usage/min return cost; } + private static Map coalGenerator() { Map cost = new HashMap<>(); cost.put(Database.ReinforcedIronPlate, 20); @@ -190,11 +195,13 @@ public class Database { cost.put(Database.Cable, 30); return cost; } + private static Map coalGeneratorConsumes() { Map cost = new HashMap<>(); // TODO values usage/min return cost; } + private static Map fuelGenerator() { Map cost = new HashMap<>(); cost.put(Database.Computer, 5); @@ -204,11 +211,13 @@ public class Database { cost.put(Database.Quickwire, 50); return cost; } + private static Map fuelGeneratorConsumes() { Map cost = new HashMap<>(); // TODO values usage/min return cost; } + private static Map geothermalGenerator() { Map cost = new HashMap<>(); cost.put(Database.SuperComputer, 8); @@ -343,10 +352,10 @@ public class Database { Set ores = new HashSet<>(Arrays.asList(IronOre, Coal, Limestone, CopperOre, CateriumOre, Sulfur, Uranium)); ores.addAll(Arrays.asList(Bauxite, RawQuartz));// TODO: rly? for (Item ore : ores) { - Recipe mk1 = new Recipe(1, "Miner Mk1", false, Buildings.MINER_MK1); - ore.add(mk1, 1); - Recipe mk2 = new Recipe(1, "Miner Mk2", false, Buildings.MINER_MK2); - ore.add(mk2, 2); + Recipe mk1 = new RecipeBuilder().setDuration(1).setName("Miner Mk1").setIsHandCraftable(false).setBuilding(Buildings.MINER_MK1).addOutput(ore, 1).createRecipe(); + ore.add(mk1); + Recipe mk2 = new RecipeBuilder().setDuration(1).setName("Miner Mk2").setIsHandCraftable(false).setBuilding(Buildings.MINER_MK2).addOutput(ore, 2).createRecipe(); + ore.add(mk2); //Recipe mk3 = new Recipe(1, "Miner Mk3", false, MINER_MK2); //ore.add(mk3, 3); ore.setPreference(mk2); @@ -355,654 +364,654 @@ public class Database { // fluids Set rawFluids = new HashSet<>(Arrays.asList(CrudeOil, Water)); // no common well yet - CrudeOil.add(new Recipe(1, "Oil extracting thingy", false, Buildings.OIL_EXTRACTOR), 2); + CrudeOil.add(new RecipeBuilder().setDuration(1).setName("Oil extracting thingy").setIsHandCraftable(false).setBuilding(Buildings.OIL_EXTRACTOR).addOutput(CrudeOil, 2).createRecipe()); //CrudeOil.setPreference(); - Recipe water = new Recipe(1, "water pump thingy", false, Buildings.WATER_EXTRACTOR); - Water.add(water, 2); + Recipe water = new RecipeBuilder().setDuration(1).setName("water pump thingy").setIsHandCraftable(false).setBuilding(Buildings.WATER_EXTRACTOR).addOutput(Water, 2).createRecipe(); Water.setPreference(water); // gases - NitrogenGas.add(new Recipe(1, "pressure thingy", false, Buildings.RESOURCE_WELL_EXTRACTOR)); + NitrogenGas.add(new RecipeBuilder().setDuration(1).setName("pressure thingy").setIsHandCraftable(false).setBuilding(Buildings.RESOURCE_WELL_EXTRACTOR).addOutput(NitrogenGas, 1).createRecipe()); } { // Iron Ingot - IronIngot.add(new Recipe(2, IronOre, 1, Buildings.SMELTER)); - Recipe alt = new Recipe(12, Buildings.REFINERY); - alt.addInput(IronOre, 7); - alt.addInput(Water, 4); - alt.addOutput(IronIngot, 13); + IronIngot.add(new RecipeBuilder().setDuration(2).addInput(IronOre, 1).addOutput(IronIngot, 1).setBuilding(Buildings.SMELTER).createRecipe()); + Recipe alt = new RecipeBuilder().setDuration(12).setBuilding(Buildings.REFINERY) + .addInput(IronOre, 7) + .addInput(Water, 4) + .addOutput(IronIngot, 13).createRecipe(); IronIngot.add(alt); } { // Copper Ingot - CopperIngot.add(new Recipe(2, CopperOre, 1, Buildings.SMELTER)); + CopperIngot.add(new RecipeBuilder().setDuration(2).addInput(CopperOre, 1).addOutput(CopperIngot, 1).setBuilding(Buildings.SMELTER).createRecipe()); } { // Caterium Ingot - CateriumIngot.add(new Recipe(4, CateriumOre, 3, Buildings.SMELTER)); + CateriumIngot.add(new RecipeBuilder().setDuration(4).addInput(CateriumOre, 3).addOutput(CateriumIngot, 1).setBuilding(Buildings.SMELTER).createRecipe()); } { // Steel Ingot - Recipe recipe = new Recipe(4, Buildings.FOUNDRY); - recipe.addInput(IronOre, 3); - recipe.addInput(Coal, 3); - SteelIngot.add(recipe, 3); + Recipe recipe = new RecipeBuilder().setDuration(4).setBuilding(Buildings.FOUNDRY) + .addInput(IronOre, 3) + .addInput(Coal, 3) + .addOutput(SteelIngot, 3) + .createRecipe(); + SteelIngot.add(recipe); } { // Concrete - Concrete.add(new Recipe(4, Limestone, 3, Buildings.CONSTRUCTOR)); + Concrete.add(new RecipeBuilder().setDuration(4).addInput(Limestone, 3).addOutput(Concrete, 1).setBuilding(Buildings.CONSTRUCTOR).createRecipe()); } { // Iron Plate - Recipe recipe = new Recipe(6, IronIngot, 3, Buildings.CONSTRUCTOR); - IronPlate.add(recipe, 2); - Recipe steelCoated = new Recipe(24, "Steel Coated Plate", false, Buildings.ASSEMBLER); - steelCoated.addInput(SteelIngot, 3); - steelCoated.addInput(Plastic, 2); - IronPlate.add(steelCoated, 18); - IronPlate.setPreference(recipe); + Recipe recipe = new RecipeBuilder().setDuration(6).addInput(IronIngot, 3).addOutput(IronPlate, 2).setBuilding(Buildings.CONSTRUCTOR).createRecipe(); + IronPlate.add(recipe); + Recipe steelCoated = new RecipeBuilder().setDuration(24).setName("Steel Coated Plate").setIsHandCraftable(false).setBuilding(Buildings.ASSEMBLER) + .addInput(SteelIngot, 3) + .addInput(Plastic, 2) + .addOutput(IronPlate, 18) + + .createRecipe(); + IronPlate.add(steelCoated); } { // Iron Rod - IronRod.add(new Recipe(4, IronIngot, 1, Buildings.CONSTRUCTOR)); + IronRod.add(new RecipeBuilder().setDuration(4).addInput(IronIngot,1).addOutput(IronRod,1).setBuilding(Buildings.CONSTRUCTOR).createRecipe()); } { // Screw - Screw.add(new Recipe(6, IronRod, 1, Buildings.CONSTRUCTOR), 4); + Screw.add(new RecipeBuilder().setDuration(6).addInput(IronRod,1).addOutput(Screw,4).setBuilding(Buildings.CONSTRUCTOR).createRecipe()); } { // Steel Beam - SteelBeam.add(new Recipe(4, SteelIngot, 4, Buildings.CONSTRUCTOR)); + SteelBeam.add(new RecipeBuilder().setDuration(4).addInput(SteelIngot,4).addOutput(SteelBeam,1).setBuilding(Buildings.CONSTRUCTOR).createRecipe()); } { // Reinforced Iron Plate - Recipe recipe = new Recipe(12, Buildings.ASSEMBLER); - recipe.addInput(IronPlate, 6); - recipe.addInput(Screw, 12); + Recipe recipe = new RecipeBuilder().setDuration(12).setBuilding(Buildings.ASSEMBLER) + .addInput(IronPlate, 6) + .addInput(Screw, 12).addOutput(ReinforcedIronPlate,1) + .createRecipe(); ReinforcedIronPlate.add(recipe); - Recipe bolted = new Recipe(4, "Bolted Iron Plate", false, Buildings.ASSEMBLER); - bolted.addInput(IronPlate, 18); - bolted.addInput(Screw, 50); - ReinforcedIronPlate.add(bolted, 3); + Recipe bolted = new RecipeBuilder().setDuration(4).setName("Bolted Iron Plate").setIsHandCraftable(false).setBuilding(Buildings.ASSEMBLER).addOutput(ReinforcedIronPlate,3) + .addInput(IronPlate, 18) + .addInput(Screw, 50).createRecipe(); + ReinforcedIronPlate.add(bolted); ReinforcedIronPlate.setPreference(recipe); } { // Modular Frame - Recipe recipe = new Recipe(60, Buildings.ASSEMBLER); - recipe.addInput(ReinforcedIronPlate, 3); - recipe.addInput(IronRod, 12); - ModularFrame.add(recipe, 2); + Recipe recipe = new RecipeBuilder().setDuration(60).setBuilding(Buildings.ASSEMBLER).addOutput(ModularFrame,2) + .addInput(ReinforcedIronPlate, 3) + .addInput(IronRod, 12).createRecipe(); + ModularFrame.add(recipe); } { // Steel Pipe - Recipe recipe = new Recipe(6, Buildings.CONSTRUCTOR); - recipe.addInput(SteelIngot, 3); - SteelPipe.add(recipe, 2); + Recipe recipe = new RecipeBuilder().setDuration(6).setBuilding(Buildings.CONSTRUCTOR).addOutput(SteelPipe,2) + .addInput(SteelIngot, 3).createRecipe(); + SteelPipe.add(recipe); } { // Encased Industrial Beam - Recipe recipe = new Recipe(10, Buildings.ASSEMBLER); - recipe.addInput(SteelBeam, 4); - recipe.addInput(Concrete, 5); + Recipe recipe = new RecipeBuilder().setDuration(10).setBuilding(Buildings.ASSEMBLER) + .addInput(SteelBeam, 4) + .addInput(Concrete, 5).addOutput(EncasedIndustrialBeam,1).createRecipe(); EncasedIndustrialBeam.add(recipe); } { // Heavy Modular Frame - Recipe recipe = new Recipe(30, Buildings.MANUFACTURER); - recipe.addInput(ModularFrame, 5); - recipe.addInput(SteelPipe, 15); - recipe.addInput(EncasedIndustrialBeam, 5); - recipe.addInput(Screw, 100); + Recipe recipe = new RecipeBuilder().setDuration(30).setBuilding(Buildings.MANUFACTURER) + .addInput(ModularFrame, 5) + .addInput(SteelPipe, 15) + .addInput(EncasedIndustrialBeam, 5) + .addInput(Screw, 100).addOutput(HeavyModularFrame,1).createRecipe(); HeavyModularFrame.add(recipe); HeavyModularFrame.setPreference(recipe); - Recipe heavyEncasedFrame = new Recipe(21, Buildings.MANUFACTURER); + Recipe heavyEncasedFrame = new RecipeBuilder().setDuration(64).setBuilding(Buildings.MANUFACTURER) + .addInput(ModularFrame, 8) + .addInput(EncasedIndustrialBeam, 10) + .addInput(SteelPipe, 36) + .addInput(Concrete, 22) + .addOutput(HeavyModularFrame, 3).createRecipe(); // TODO: duration = 60/2.812 - heavyEncasedFrame.addInput(ModularFrame, 8); - heavyEncasedFrame.addInput(EncasedIndustrialBeam, 10); - heavyEncasedFrame.addInput(SteelPipe, 36); - heavyEncasedFrame.addInput(Concrete, 22); - heavyEncasedFrame.addOutput(HeavyModularFrame, 3); HeavyModularFrame.add(heavyEncasedFrame); } { // Wire - Wire.add(new Recipe(4, CopperIngot, 1, Buildings.CONSTRUCTOR), 2); + Wire.add(new RecipeBuilder().setDuration(4).addInput(CopperIngot,1).addOutput(Wire,2).setBuilding(Buildings.CONSTRUCTOR).createRecipe()); } { // Cable - Cable.add(new Recipe(2, Wire, 2, Buildings.CONSTRUCTOR)); - Recipe quickWireCable = new Recipe(2, Buildings.ASSEMBLER); + Cable.add(new RecipeBuilder().setDuration(2).addInput(Wire,2).addOutput(Cable,1).setBuilding(Buildings.CONSTRUCTOR).createRecipe()); + Recipe quickWireCable = new RecipeBuilder().setDuration(2).setBuilding(Buildings.ASSEMBLER) + .addInput(Quickwire, 3) + .addInput(Rubber, 2) + .addOutput(Cable, 11).createRecipe(); // TODO 60/27,5 - quickWireCable.addInput(Quickwire, 3); - quickWireCable.addInput(Rubber, 2); - quickWireCable.addOutput(Cable, 11); Cable.add(quickWireCable); } { // Copper Sheet - CopperSheet.add(new Recipe(6, CopperIngot, 2, Buildings.CONSTRUCTOR)); - Recipe steamedCopperSheet = new Recipe(2, Buildings.REFINERY); + CopperSheet.add(new RecipeBuilder().setDuration(6).addInput(CopperIngot,2).addOutput(CopperSheet,1).setBuilding(Buildings.CONSTRUCTOR).createRecipe()); + Recipe steamedCopperSheet = new RecipeBuilder().setDuration(2).setBuilding(Buildings.REFINERY) + .addInput(CopperIngot, 3) + .addInput(Water, 3) + .addOutput(CopperSheet, 3).createRecipe(); // TODO: duration = 60/22.5 - steamedCopperSheet.addInput(CopperIngot, 3); - steamedCopperSheet.addInput(Water, 3); - steamedCopperSheet.addOutput(CopperSheet, 3); CopperSheet.add(steamedCopperSheet); } { // Quickwire - Quickwire.add(new Recipe(5, CateriumIngot, 1, Buildings.CONSTRUCTOR), 5); + Quickwire.add(new RecipeBuilder().setDuration(5).addInput(CateriumIngot,1).addOutput(Quickwire,5).setBuilding(Buildings.CONSTRUCTOR).createRecipe()); } { // Circuit Board - Recipe recipe = new Recipe(8, Buildings.ASSEMBLER); - recipe.addInput(CopperSheet, 2); - recipe.addInput(Plastic, 4); + Recipe recipe = new RecipeBuilder().setDuration(8).setBuilding(Buildings.ASSEMBLER) + .addInput(CopperSheet, 2) + .addInput(Plastic, 4).addOutput(CircuitBoard,1).createRecipe(); CircuitBoard.add(recipe); // TODO: alternative - Recipe electrodeCircuitBoard = new Recipe(12, Buildings.ASSEMBLER); - electrodeCircuitBoard.addInput(Rubber, 6); - electrodeCircuitBoard.addInput(PetroleumCoke, 9); - electrodeCircuitBoard.addOutput(CircuitBoard, 1); + Recipe electrodeCircuitBoard = new RecipeBuilder().setDuration(12).setBuilding(Buildings.ASSEMBLER) + .addInput(Rubber, 6) + .addInput(PetroleumCoke, 9) + .addOutput(CircuitBoard, 1).createRecipe(); CircuitBoard.add(electrodeCircuitBoard); + Recipe cateriumCircuitBoard = new RecipeBuilder().setDuration(48).setName("Caterium Circuit Board").setIsHandCraftable(false).setBuilding(Buildings.ASSEMBLER) + .addInput(Plastic, 10) + .addInput(Quickwire, 30) + .addOutput(CircuitBoard, 7).createRecipe(); + CircuitBoard.add(cateriumCircuitBoard); } { // A.I. Limiter - Recipe recipe = new Recipe(12, Buildings.ASSEMBLER); - recipe.addInput(CopperSheet, 5); - recipe.addInput(Quickwire, 20); + Recipe recipe = new RecipeBuilder().setDuration(12).setBuilding(Buildings.ASSEMBLER) + .addInput(CopperSheet, 5) + .addInput(Quickwire, 20).addOutput(AILimiter,1).createRecipe(); AILimiter.add(recipe); } { // High Speed Connector - Recipe recipe = new Recipe(16, Buildings.MANUFACTURER); - recipe.addInput(Quickwire, 56); - recipe.addInput(Cable, 10); - recipe.addInput(CircuitBoard, 1); + Recipe recipe = new RecipeBuilder().setDuration(16).setBuilding(Buildings.MANUFACTURER) + .addInput(Quickwire, 56) + .addInput(Cable, 10) + .addInput(CircuitBoard, 1).addOutput(HighSpeedConnector,1).createRecipe(); HighSpeedConnector.add(recipe); } { // Biomass - Biomass.add(new Recipe(5, Leaves, 10, Buildings.CONSTRUCTOR), 5); // TODO CraftBench - Biomass.add(new Recipe(4, Wood, 4, Buildings.CONSTRUCTOR), 20); // TODO CraftBench - Biomass.add(new Recipe(4, Mycelia, 1, Buildings.CONSTRUCTOR), 10); // TODO CraftBench - Biomass.add(new Recipe(4, AlienProtein, 1, Buildings.CONSTRUCTOR), 100); // TODO CraftBench + Biomass.add(new RecipeBuilder().setDuration(5).addInput(Leaves,10).addOutput(Biomass,5).setBuilding(Buildings.CONSTRUCTOR).createRecipe()); // TODO CraftBench + Biomass.add(new RecipeBuilder().setDuration(4).addInput(Wood,4).addOutput(Biomass,20).setBuilding(Buildings.CONSTRUCTOR).createRecipe()); // TODO CraftBench + Biomass.add(new RecipeBuilder().setDuration(4).addInput(Mycelia,1).addOutput(Biomass,10).setBuilding(Buildings.CONSTRUCTOR).createRecipe()); // TODO CraftBench + Biomass.add(new RecipeBuilder().setDuration(4).addInput(AlienProtein,1).addOutput(Biomass,100).setBuilding(Buildings.CONSTRUCTOR).createRecipe()); // TODO CraftBench } { // Alien Protein - AlienProtein.add(new Recipe(3, HogRemains, 1, Buildings.CONSTRUCTOR)); // TODO CraftBench - AlienProtein.add(new Recipe(3, PlasmaSpitterRemains, 1, Buildings.CONSTRUCTOR)); // TODO CraftBench - AlienProtein.add(new Recipe(3, StingerRemains, 1, Buildings.CONSTRUCTOR)); // TODO CraftBench - AlienProtein.add(new Recipe(3, HatcherRemains, 1, Buildings.CONSTRUCTOR)); // TODO CraftBench + AlienProtein.add(new RecipeBuilder().setDuration(3).addInput(HogRemains,1).addOutput(AlienProtein,1).setBuilding(Buildings.CONSTRUCTOR).createRecipe()); // TODO CraftBench + AlienProtein.add(new RecipeBuilder().setDuration(3).addInput(PlasmaSpitterRemains,1).addOutput(AlienProtein,1).setBuilding(Buildings.CONSTRUCTOR).createRecipe()); // TODO CraftBench + AlienProtein.add(new RecipeBuilder().setDuration(3).addInput(StingerRemains,1).addOutput(AlienProtein,1).setBuilding(Buildings.CONSTRUCTOR).createRecipe()); // TODO CraftBench + AlienProtein.add(new RecipeBuilder().setDuration(3).addInput(HatcherRemains,1).addOutput(AlienProtein,1).setBuilding(Buildings.CONSTRUCTOR).createRecipe()); // TODO CraftBench } { // Fabric - Recipe recipe = new Recipe(4, Buildings.ASSEMBLER); - recipe.addInput(Mycelia); - recipe.addInput(Biomass, 5); + Recipe recipe = new RecipeBuilder().setDuration(4).setBuilding(Buildings.ASSEMBLER) + .addInput(Mycelia,1) + .addInput(Biomass, 5).addOutput(Fabric,1).createRecipe(); Fabric.add(recipe); - Recipe alt = new Recipe(2, Buildings.REFINERY); - recipe.addInput(PolymerResin, 1); - recipe.addInput(Water, 1); - recipe.addOutput(Fabric, 1); + Recipe alt = new RecipeBuilder().setDuration(2).setBuilding(Buildings.REFINERY) + .addInput(PolymerResin, 1) + .addInput(Water, 1) + .addOutput(Fabric, 1).createRecipe(); } { // Solid Biofuel - SolidBiofuel.add(new Recipe(4, Biomass, 8, Buildings.CONSTRUCTOR), 4); + SolidBiofuel.add(new RecipeBuilder().setDuration(4).addInput(Biomass,8).addOutput(SolidBiofuel,4).setBuilding(Buildings.CONSTRUCTOR).createRecipe()); } { // Rotor - Recipe recipe = new Recipe(15, Buildings.ASSEMBLER); - recipe.addInput(IronRod, 5); - recipe.addInput(Screw, 25); + Recipe recipe = new RecipeBuilder().setDuration(15).setBuilding(Buildings.ASSEMBLER) + .addInput(IronRod, 5) + .addInput(Screw, 25).addOutput(Rotor,1).createRecipe(); Rotor.add(recipe); } { // Stator - Recipe recipe = new Recipe(12, Buildings.ASSEMBLER); - recipe.addInput(SteelPipe, 3); - recipe.addInput(Wire, 8); + Recipe recipe = new RecipeBuilder().setDuration(12).setBuilding(Buildings.ASSEMBLER) + .addInput(SteelPipe, 3) + .addInput(Wire, 8).addOutput(Stator, 1).createRecipe(); Stator.add(recipe); Stator.setPreference(recipe); - Recipe quickwireStator = new Recipe(8, Buildings.ASSEMBLER); + Recipe quickwireStator = new RecipeBuilder().setDuration(15).setBuilding(Buildings.ASSEMBLER) + .addInput(SteelPipe, 4) + .addInput(Quickwire, 15) + .addOutput(Stator, 2).createRecipe(); //TODO 60/8 - quickwireStator.addInput(SteelPipe, 4); - quickwireStator.addInput(Quickwire, 15); - quickwireStator.addOutput(Stator, 2); Stator.add(quickwireStator); } { // Motor - Recipe recipe = new Recipe(12, Buildings.ASSEMBLER); - recipe.addInput(Rotor, 2); - recipe.addInput(Stator, 2); + Recipe recipe = new RecipeBuilder().setDuration(12).setBuilding(Buildings.ASSEMBLER) + .addInput(Rotor, 2) + .addInput(Stator, 2).addOutput(Motor,1).createRecipe(); Motor.add(recipe); } { // Power Shard - PowerShard.add(new Recipe(8, GreenPowerSlug, 1, Buildings.CONSTRUCTOR)); - PowerShard.add(new Recipe(12, YellowPowerSlug, 1, Buildings.CONSTRUCTOR), 2); - PowerShard.add(new Recipe(24, PurplePowerSlug, 1, Buildings.CONSTRUCTOR), 5); + PowerShard.add(new RecipeBuilder().setDuration(8).addInput(GreenPowerSlug,1).addOutput(PowerShard,1).setBuilding(Buildings.CONSTRUCTOR).createRecipe()); + PowerShard.add(new RecipeBuilder().setDuration(12).addInput(YellowPowerSlug,1).addOutput(PowerShard,2).setBuilding(Buildings.CONSTRUCTOR).createRecipe()); + PowerShard.add(new RecipeBuilder().setDuration(24).addInput(PurplePowerSlug,1).addOutput(PowerShard,5).setBuilding(Buildings.CONSTRUCTOR).createRecipe()); } { // Black Powder - Recipe recipe = new Recipe(8, Buildings.ASSEMBLER); - recipe.addInput(Coal); - recipe.addInput(Sulfur, 2); + Recipe recipe = new RecipeBuilder().setDuration(8).setBuilding(Buildings.ASSEMBLER) + .addInput(Coal,1) + .addInput(Sulfur, 2).addOutput(BlackPowder,1).createRecipe(); BlackPowder.add(recipe); } { // Color Catridge - ColorCatridge.add(new Recipe(6, FlowerPetals, 5, Buildings.CONSTRUCTOR), 10); + ColorCatridge.add(new RecipeBuilder().setDuration(6).addInput(FlowerPetals,5).addOutput(ColorCatridge,10).setBuilding(Buildings.CONSTRUCTOR).createRecipe()); } { // Gas Filter - Recipe recipe = new Recipe(8, Buildings.MANUFACTURER); - recipe.addInput(Coal, 5); - recipe.addInput(Rubber, 2); - recipe.addInput(Fabric, 2); + Recipe recipe = new RecipeBuilder().setDuration(8).setBuilding(Buildings.MANUFACTURER) + .addInput(Coal, 5) + .addInput(Rubber, 2) + .addInput(Fabric, 2).addOutput(GasFilter,1).createRecipe(); GasFilter.add(recipe); } { // Computer - Recipe recipe = new Recipe(24, Buildings.MANUFACTURER); - recipe.addInput(CircuitBoard, 10); - recipe.addInput(Cable, 9); - recipe.addInput(Plastic, 18); - recipe.addInput(Screw, 52); + Recipe recipe = new RecipeBuilder().setDuration(24).setBuilding(Buildings.MANUFACTURER) + .addInput(CircuitBoard, 10) + .addInput(Cable, 9) + .addInput(Plastic, 18) + .addInput(Screw, 52).addOutput(Computer,1).createRecipe(); Computer.add(recipe); - Recipe alternative = new Recipe(16, "Caterium Computer", false, Buildings.MANUFACTURER); - alternative.addInput(CircuitBoard, 7); - alternative.addInput(Quickwire, 28); - alternative.addInput(Rubber, 12); + Recipe alternative = new RecipeBuilder().setDuration(16).setName("Caterium Computer").setIsHandCraftable(false).setBuilding(Buildings.MANUFACTURER) + .addInput(CircuitBoard, 7) + .addInput(Quickwire, 28) + .addInput(Rubber, 12).addOutput(Computer,1).createRecipe(); Computer.add(alternative); Computer.setPreference(recipe); } { // Super Computer - Recipe recipe = new Recipe(32, Buildings.MANUFACTURER); - recipe.addInput(Computer, 2); - recipe.addInput(AILimiter, 2); - recipe.addInput(HighSpeedConnector, 3); - recipe.addInput(Plastic, 28); + Recipe recipe = new RecipeBuilder().setDuration(32).setBuilding(Buildings.MANUFACTURER) + .addInput(Computer, 2) + .addInput(AILimiter, 2) + .addInput(HighSpeedConnector, 3) + .addInput(Plastic, 28).addOutput(SuperComputer,1).createRecipe(); SuperComputer.add(recipe); } { // Empty Canister - EmptyCanister.add(new Recipe(4, Plastic, 2, Buildings.CONSTRUCTOR), 4); + EmptyCanister.add(new RecipeBuilder().setDuration(4).addInput(Plastic,2).addOutput(EmptyCanister,4).setBuilding(Buildings.CONSTRUCTOR).createRecipe()); } { // Beacon - Recipe recipe = new Recipe(8, Buildings.MANUFACTURER); - recipe.addInput(IronPlate, 3); - recipe.addInput(IronRod); - recipe.addInput(Wire, 15); - recipe.addInput(Cable, 2); + Recipe recipe = new RecipeBuilder().setDuration(8).setBuilding(Buildings.MANUFACTURER) + .addInput(IronPlate, 3) + .addInput(IronRod,1) + .addInput(Wire, 15) + .addInput(Cable, 2).addOutput(Beacon,1).createRecipe(); Beacon.add(recipe); } { // Modular Engine - Recipe recipe = new Recipe(60, false, Buildings.MANUFACTURER); - recipe.addInput(Motor, 2); - recipe.addInput(Rubber, 15); - recipe.addInput(SmartPlating, 2); + Recipe recipe = new RecipeBuilder().setDuration(60).setIsHandCraftable(false).setBuilding(Buildings.MANUFACTURER) + .addInput(Motor, 2) + .addInput(Rubber, 15) + .addInput(SmartPlating, 2).addOutput(ModularEngine,1).createRecipe(); ModularEngine.add(recipe); } { // Adaptive Control Unit - Recipe recipe = new Recipe(120, false, Buildings.MANUFACTURER); - recipe.addInput(AutomatedWiring, 15); - recipe.addInput(CircuitBoard, 10); - recipe.addInput(HeavyModularFrame, 2); - recipe.addInput(Computer, 2); - AdaptiveControlUnit.add(recipe, 2); + Recipe recipe = new RecipeBuilder().setDuration(120).setIsHandCraftable(false).setBuilding(Buildings.MANUFACTURER).addOutput(AdaptiveControlUnit,2) + .addInput(AutomatedWiring, 15) + .addInput(CircuitBoard, 10) + .addInput(HeavyModularFrame, 2) + .addInput(Computer, 2).addOutput(AdaptiveControlUnit,2).createRecipe(); + AdaptiveControlUnit.add(recipe); } { // Nobelisk - Recipe recipe = new Recipe(20, false, Buildings.ASSEMBLER); - recipe.addInput(BlackPowder, 5); - recipe.addInput(SteelPipe, 10); + Recipe recipe = new RecipeBuilder().setDuration(20).setIsHandCraftable(false).setBuilding(Buildings.ASSEMBLER) + .addInput(BlackPowder, 5) + .addInput(SteelPipe, 10).addOutput(Nobelisk,1).createRecipe(); Nobelisk.add(recipe); } { // Gas Nobelisk - Recipe recipe = new Recipe(12, Buildings.ASSEMBLER); //TODO EquipmentWorkshop - recipe.addInput(Nobelisk, 1); - recipe.addInput(Biomass, 10); - recipe.addOutput(GasNobelisk, 1); + Recipe recipe = new RecipeBuilder().setDuration(12).setBuilding(Buildings.ASSEMBLER) + .addInput(Nobelisk, 1) + .addInput(Biomass, 10) + .addOutput(GasNobelisk, 1).createRecipe(); //TODO EquipmentWorkshop GasNobelisk.add(recipe); } { // Cluster Nobelisk - Recipe recipe = new Recipe(24, Buildings.ASSEMBLER); //TODO EquipmentWorkshop - recipe.addInput(Nobelisk, 3); - recipe.addInput(SmokelessPowder, 4); - recipe.addOutput(ClusterNobelisk, 1); + Recipe recipe = new RecipeBuilder().setDuration(24).setBuilding(Buildings.ASSEMBLER) + .addInput(Nobelisk, 3) + .addInput(SmokelessPowder, 4) + .addOutput(ClusterNobelisk, 1).createRecipe(); //TODO EquipmentWorkshop ClusterNobelisk.add(recipe); } { // NobeliskDetonator - Recipe recipe = new Recipe(80, Buildings.EQUIPMENT_WORKSHOP); - recipe.addInput(ObjectScanner, 1); - recipe.addInput(SteelBeam, 10); - recipe.addInput(Cable, 50); - recipe.addOutput(NobeliskDetonator, 1); + Recipe recipe = new RecipeBuilder().setDuration(80).setBuilding(Buildings.EQUIPMENT_WORKSHOP) + .addInput(ObjectScanner, 1) + .addInput(SteelBeam, 10) + .addInput(Cable, 50) + .addOutput(NobeliskDetonator, 1).createRecipe(); NobeliskDetonator.add(recipe); } { // Smart Plating - Recipe recipe = new Recipe(30, false, Buildings.ASSEMBLER); - recipe.addInput(ReinforcedIronPlate); - recipe.addInput(Rotor); + Recipe recipe = new RecipeBuilder().setDuration(30).setIsHandCraftable(false).setBuilding(Buildings.ASSEMBLER) + .addInput(ReinforcedIronPlate,1) + .addInput(Rotor,1).addOutput(SmartPlating,1).createRecipe(); SmartPlating.add(recipe); } { // Automated Wiring - Recipe recipe = new Recipe(24, false, Buildings.ASSEMBLER); - recipe.addInput(Stator); - recipe.addInput(Cable, 20); + Recipe recipe = new RecipeBuilder().setDuration(24).setIsHandCraftable(false).setBuilding(Buildings.ASSEMBLER) + .addInput(Stator,1) + .addInput(Cable, 20).addOutput(AutomatedWiring,1).createRecipe(); AutomatedWiring.add(recipe); } { // Versatile Framework - Recipe recipe = new Recipe(24, false, Buildings.ASSEMBLER); - recipe.addInput(ModularFrame); - recipe.addInput(SteelBeam, 12); - VersatileFrameWork.add(recipe, 2); + Recipe recipe = new RecipeBuilder().setDuration(24).setIsHandCraftable(false).setBuilding(Buildings.ASSEMBLER).addOutput(VersatileFrameWork,2) + .addInput(ModularFrame,1) + .addInput(SteelBeam, 12).addOutput(VersatileFrameWork,2).createRecipe(); + VersatileFrameWork.add(recipe); } { // Fuel - Recipe residualFuel = new Recipe(6, "Residual Fuel", false, Buildings.REFINERY); - residualFuel.addInput(HeavyOilResidue, 6); - Fuel.add(residualFuel, 4); - Recipe recipe = new Recipe(6, false, Buildings.REFINERY); - recipe.addInput(CrudeOil, 6); - recipe.addOutput(PolymerResin, 3); - Fuel.add(recipe, 4); + Recipe residualFuel = new RecipeBuilder().setDuration(6).setName("Residual Fuel").setIsHandCraftable(false).setBuilding(Buildings.REFINERY).addOutput(Fuel,4) + .addInput(HeavyOilResidue, 6).addOutput(Fuel,1).createRecipe(); + Fuel.add(residualFuel); + Recipe recipe = new RecipeBuilder().setDuration(6).setIsHandCraftable(false).setBuilding(Buildings.REFINERY).addOutput(Fuel,4) + .addInput(CrudeOil, 6) + .addOutput(PolymerResin, 3, true).createRecipe(); + Fuel.add(recipe); Fuel.setPreference(recipe); } { - PolymerResin.setPreference(PolymerResin.getRecipe()); // Polymer Resin - Recipe polymerResin = new Recipe(1, Buildings.REFINERY); + Recipe polymerResin = new RecipeBuilder().setDuration(1).setBuilding(Buildings.REFINERY) + .addInput(CrudeOil, 6) + .addOutput(PolymerResin, 13) + .addOutput(HeavyOilResidue, 2, true).createRecipe(); // TODO: duration=60/130 - polymerResin.addInput(CrudeOil, 6); - polymerResin.addOutput(PolymerResin, 13); - polymerResin.addOutput(HeavyOilResidue, 2, true); PolymerResin.add(polymerResin); } { // Liquid Biofuel - Recipe recipe = new Recipe(4, false, Buildings.REFINERY); - recipe.addInput(SolidBiofuel, 6); - recipe.addInput(Water, 3); - LiquidBiofuel.add(recipe, 4); + Recipe recipe = new RecipeBuilder().setDuration(4).setIsHandCraftable(false).setBuilding(Buildings.REFINERY).addOutput(LiquidBiofuel,4) + .addInput(SolidBiofuel, 6) + .addInput(Water, 3).addOutput(LiquidBiofuel,1).createRecipe(); + LiquidBiofuel.add(recipe); - Recipe unpack = new Recipe(2, Buildings.PACKAGER); - recipe.addInput(PackagedLiquidBiofuel, 2); - recipe.addOutput(LiquidBiofuel, 2); - recipe.addOutput(EmptyCanister, 2,true); + Recipe unpack = new RecipeBuilder().setDuration(2).setBuilding(Buildings.PACKAGER) + .addInput(PackagedLiquidBiofuel, 2) + .addOutput(LiquidBiofuel, 2) + .addOutput(EmptyCanister, 2, true).createRecipe(); LiquidBiofuel.add(unpack); } - { - // Packaged Liquid Biofuel - - } { // Plastic - Recipe recipe = new Recipe(6, false, Buildings.REFINERY); - recipe.addInput(CrudeOil, 3); - recipe.addOutput(HeavyOilResidue, 1, true); - Plastic.add(recipe, 2); - Recipe residualPlastic = new Recipe(6, "Residual Plastic", false, Buildings.REFINERY); - residualPlastic.addInput(PolymerResin, 6); - residualPlastic.addInput(Water, 2); - Plastic.add(residualPlastic, 2); - - Plastic.setPreference(recipe); + Recipe recipe = new RecipeBuilder().setDuration(6).setIsHandCraftable(false).setBuilding(Buildings.REFINERY).addOutput(Plastic,2) + .addInput(CrudeOil, 3) + .addOutput(HeavyOilResidue, 1, true).createRecipe(); + Plastic.add(recipe); + Recipe residualPlastic = new RecipeBuilder().setDuration(6).setName("Residual Plastic").setIsHandCraftable(false).setBuilding(Buildings.REFINERY).addOutput(Plastic,2) + .addInput(PolymerResin, 6) + .addInput(Water, 2).createRecipe(); + Plastic.add(residualPlastic); } { // Rubber - Recipe recipe = new Recipe(6, false, Buildings.REFINERY); - recipe.addInput(CrudeOil, 3); - recipe.addOutput(HeavyOilResidue, 2, true); - Rubber.add(recipe, 2); - Recipe residualRubber = new Recipe(6, "Residual Rubber", false, Buildings.REFINERY); - residualRubber.addInput(PolymerResin, 6); - residualRubber.addInput(Water, 4); - Rubber.add(residualRubber, 2); - - Rubber.setPreference(recipe); + Recipe recipe = new RecipeBuilder().setDuration(6).setIsHandCraftable(false).setBuilding(Buildings.REFINERY).addOutput(Rubber,2) + .addInput(CrudeOil, 3) + .addOutput(HeavyOilResidue, 2, true).createRecipe(); + Rubber.add(recipe); + Recipe residualRubber = new RecipeBuilder().setDuration(6).setName("Residual Rubber").setIsHandCraftable(false).setBuilding(Buildings.REFINERY).addOutput(Rubber,2) + .addInput(PolymerResin, 6) + .addInput(Water, 4).createRecipe(); + Rubber.add(residualRubber); } { // Petroleum Coke - Recipe recipe = new Recipe(6, false, Buildings.REFINERY); - recipe.addInput(HeavyOilResidue, 4); - PetroleumCoke.add(recipe, 12); + Recipe recipe = new RecipeBuilder().setDuration(6).setIsHandCraftable(false).setBuilding(Buildings.REFINERY).addOutput(PetroleumCoke,12) + .addInput(HeavyOilResidue, 4).createRecipe(); + PetroleumCoke.add(recipe); } // TODO: verify below! { - Recipe recipe = new Recipe(6, AluminumIngot, 3, Buildings.ASSEMBLER); - recipe.addInput(CopperIngot, 1); - AlcladAluminumSheet.add(recipe, 3); + Recipe recipe = new RecipeBuilder().setDuration(6).addInput(AluminumIngot,3).addOutput(AlcladAluminumSheet,3).setBuilding(Buildings.ASSEMBLER) + .addInput(CopperIngot, 1).createRecipe(); + AlcladAluminumSheet.add(recipe); } { - Recipe recipe = new Recipe(120, QuartzCristal, 36, Buildings.MANUFACTURER); - recipe.addInput(Cable, 28); - recipe.addInput(ReinforcedIronPlate, 5); + Recipe recipe = new RecipeBuilder().setDuration(120).addInput(QuartzCristal,36).addOutput(CrystalOscillator,2).setBuilding(Buildings.MANUFACTURER) + .addInput(Cable, 28) + .addInput(ReinforcedIronPlate, 5).createRecipe(); - CrystalOscillator.add(recipe, 2); + CrystalOscillator.add(recipe); } { - Recipe recipe = new Recipe(48, AluminumCasing, 32, Buildings.MANUFACTURER); - recipe.addInput(CrystalOscillator, 1); - recipe.addInput(Computer, 1); + Recipe recipe = new RecipeBuilder().setDuration(48).addInput(AluminumCasing,32).addOutput(RadioControlUnit,2).setBuilding(Buildings.MANUFACTURER) + .addInput(CrystalOscillator, 1) + .addInput(Computer, 1).createRecipe(); - RadioControlUnit.add(recipe, 2); + RadioControlUnit.add(recipe); } { - Recipe recipe = new Recipe(2, AluminumIngot, 3, Buildings.CONSTRUCTOR); - AluminumCasing.add(recipe, 2); + Recipe recipe = new RecipeBuilder().setDuration(2).addInput(AluminumIngot,3).addOutput(AluminumCasing,2).setBuilding(Buildings.CONSTRUCTOR).createRecipe(); + AluminumCasing.add(recipe); } { - Recipe recipe = new Recipe(8, RawQuartz, 5, Buildings.CONSTRUCTOR); - QuartzCristal.add(recipe, 3); + Recipe recipe = new RecipeBuilder().setDuration(8).addInput(RawQuartz,5).addOutput(QuartzCristal,3).setBuilding(Buildings.CONSTRUCTOR).createRecipe(); + QuartzCristal.add(recipe); } { - Recipe recipe = new Recipe(8, RawQuartz, 3, Buildings.CONSTRUCTOR); - Silica.add(recipe, 5); + Recipe recipe = new RecipeBuilder().setDuration(8).addInput(RawQuartz,3).addOutput(Silica,5).setBuilding(Buildings.CONSTRUCTOR).createRecipe(); + Silica.add(recipe); } { - Recipe recipe = new Recipe(4, AluminumScrap, 6, Buildings.FOUNDRY); - recipe.addInput(Silica, 5); - recipe.addOutput(AluminumIngot, 4); + Recipe recipe = new RecipeBuilder().setDuration(4).addInput(AluminumScrap,6).addOutput(AluminumIngot,4).setBuilding(Buildings.FOUNDRY) + .addInput(Silica, 5) + .addOutput(AluminumIngot, 4).createRecipe(); } { - Recipe recipe = new Recipe(6, Buildings.REFINERY); - recipe.addInput(Bauxite, 12); - recipe.addInput(Water, 18); - recipe.addOutput(Silica, 5); - recipe.addOutput(AluminaSolution, 12,true); + Recipe recipe = new RecipeBuilder().setDuration(6).setBuilding(Buildings.REFINERY) + .addInput(Bauxite, 12) + .addInput(Water, 18) + .addOutput(Silica, 5) + .addOutput(AluminaSolution, 12, true).createRecipe(); } { - Recipe recipe = new Recipe(1, Buildings.REFINERY); - recipe.addInput(AluminaSolution, 4); - recipe.addInput(Coal, 2); - recipe.addOutput(AluminumScrap, 6); - recipe.addOutput(Water, 2,true); + Recipe recipe = new RecipeBuilder().setDuration(1).setBuilding(Buildings.REFINERY) + .addInput(AluminaSolution, 4) + .addInput(Coal, 2) + .addOutput(AluminumScrap, 6) + .addOutput(Water, 2, true).createRecipe(); } { - Recipe recipe = new Recipe(6, Buildings.REFINERY); - recipe.addInput(Sulfur, 5); - recipe.addInput(Water, 5); - recipe.addOutput(SulfuricAcid, 5); + Recipe recipe = new RecipeBuilder().setDuration(6).setBuilding(Buildings.REFINERY) + .addInput(Sulfur, 5) + .addInput(Water, 5) + .addOutput(SulfuricAcid, 5).createRecipe(); } { - Recipe recipe = new Recipe(150, Buildings.MANUFACTURER); - recipe.addInput(EncasedUraniumCell, 50); - recipe.addInput(EncasedIndustrialBeam, 3); - recipe.addInput(ElectromagneticControlRod, 5); - recipe.addOutput(UraniumFuelRod, 1); + Recipe recipe = new RecipeBuilder().setDuration(150).setBuilding(Buildings.MANUFACTURER) + .addInput(EncasedUraniumCell, 50) + .addInput(EncasedIndustrialBeam, 3) + .addInput(ElectromagneticControlRod, 5) + .addOutput(UraniumFuelRod, 1).createRecipe(); } { - Recipe recipe = new Recipe(12, Buildings.BLENDER); - recipe.addInput(Uranium, 10); - recipe.addInput(Concrete, 3); - recipe.addInput(SulfuricAcid, 8); - recipe.addOutput(EncasedUraniumCell, 5); - recipe.addOutput(SulfuricAcid, 2,true); + Recipe recipe = new RecipeBuilder().setDuration(12).setBuilding(Buildings.BLENDER) + .addInput(Uranium, 10) + .addInput(Concrete, 3) + .addInput(SulfuricAcid, 8) + .addOutput(EncasedUraniumCell, 5) + .addOutput(SulfuricAcid, 2, true).createRecipe(); } { - Recipe recipe = new Recipe(120, Buildings.MANUFACTURER); - recipe.addInput(VersatileFrameWork, 5); - recipe.addInput(ElectromagneticControlRod, 5); - recipe.addInput(Battery, 10); - recipe.addOutput(MagneticFieldGenerator, 2); + Recipe recipe = new RecipeBuilder().setDuration(120).setBuilding(Buildings.MANUFACTURER) + .addInput(VersatileFrameWork, 5) + .addInput(ElectromagneticControlRod, 5) + .addInput(Battery, 10) + .addOutput(MagneticFieldGenerator, 2).createRecipe(); } { - Recipe recipe = new Recipe(3, Buildings.BLENDER); - recipe.addInput(SulfuricAcid, 2.5); - recipe.addInput(AluminaSolution, 2); - recipe.addInput(AluminumCasing, 1); - recipe.addOutput(Battery, 1); - recipe.addOutput(Water, 1.5,true); + Recipe recipe = new RecipeBuilder().setDuration(3).setBuilding(Buildings.BLENDER) + .addInput(SulfuricAcid, 2.5) + .addInput(AluminaSolution, 2) + .addInput(AluminumCasing, 1) + .addOutput(Battery, 1) + .addOutput(Water, 1.5, true).createRecipe(); } { - Recipe recipe = new Recipe(8, Buildings.ASSEMBLER); - recipe.addInput(AlcladAluminumSheet, 5); - recipe.addInput(CopperSheet, 3); - recipe.addOutput(HeatSink, 1); + Recipe recipe = new RecipeBuilder().setDuration(8).setBuilding(Buildings.ASSEMBLER) + .addInput(AlcladAluminumSheet, 5) + .addInput(CopperSheet, 3) + .addOutput(HeatSink, 1).createRecipe(); } { - Recipe recipe = new Recipe(80, Buildings.ASSEMBLER); - recipe.addInput(AdaptiveControlUnit, 2); - recipe.addInput(SuperComputer, 1); - recipe.addOutput(AssemblyDirectorSystem, 1); + Recipe recipe = new RecipeBuilder().setDuration(80).setBuilding(Buildings.ASSEMBLER) + .addInput(AdaptiveControlUnit, 2) + .addInput(SuperComputer, 1) + .addOutput(AssemblyDirectorSystem, 1).createRecipe(); } { - Recipe recipe = new Recipe(30, Buildings.ASSEMBLER); - recipe.addInput(Stator, 3); - recipe.addInput(AILimiter, 2); - recipe.addOutput(ElectromagneticControlRod, 2); + Recipe recipe = new RecipeBuilder().setDuration(30).setBuilding(Buildings.ASSEMBLER) + .addInput(Stator, 3) + .addInput(AILimiter, 2) + .addOutput(ElectromagneticControlRod, 2).createRecipe(); } { - Recipe recipe = new Recipe(10, Buildings.BLENDER); - recipe.addInput(HeatSink, 2); - recipe.addInput(Rubber, 2); - recipe.addInput(Water, 5); - recipe.addInput(NitrogenGas, 25); - recipe.addOutput(CoolingSystem, 1); + Recipe recipe = new RecipeBuilder().setDuration(10).setBuilding(Buildings.BLENDER) + .addInput(HeatSink, 2) + .addInput(Rubber, 2) + .addInput(Water, 5) + .addInput(NitrogenGas, 25) + .addOutput(CoolingSystem, 1).createRecipe(); } { - Recipe recipe = new Recipe(40, Buildings.BLENDER); - recipe.addInput(HeavyModularFrame, 1); - recipe.addInput(AluminumCasing, 50); - recipe.addInput(NitrogenGas, 25); - recipe.addOutput(FusedModularFrame, 1); + Recipe recipe = new RecipeBuilder().setDuration(40).setBuilding(Buildings.BLENDER) + .addInput(HeavyModularFrame, 1) + .addInput(AluminumCasing, 50) + .addInput(NitrogenGas, 25) + .addOutput(FusedModularFrame, 1).createRecipe(); } { - Recipe recipe = new Recipe(40, true, Buildings.EQUIPMENT_WORKSHOP); - recipe.addInput(IronPlate, 2); - recipe.addInput(IronRod, 2); - recipe.addOutput(PortableMiner, 1); + Recipe recipe = new RecipeBuilder().setDuration(40).setIsHandCraftable(true).setBuilding(Buildings.EQUIPMENT_WORKSHOP) + .addInput(IronPlate, 2) + .addInput(IronRod, 2) + .addOutput(PortableMiner, 1).createRecipe(); } { //Turbofuel - Recipe recipe = new Recipe(3, Buildings.REFINERY); + Recipe recipe = new RecipeBuilder().setDuration(3).setBuilding(Buildings.REFINERY) + .addInput(Fuel, 6) + .addInput(CompactedCoal, 4) + .addOutput(Turbofuel, 5).createRecipe(); //TODO: 60/18,75 - recipe.addInput(Fuel, 6); - recipe.addInput(CompactedCoal, 4); - recipe.addOutput(Turbofuel, 5); Turbofuel.add(recipe); - Recipe packaged = new Recipe(3, Buildings.PACKAGER); - recipe.addInput(PackagedTurboFuel, 2); - recipe.addOutput(Turbofuel, 2); - recipe.addOutput(EmptyCanister, 2, true); + Recipe packaged = new RecipeBuilder().setDuration(3).setBuilding(Buildings.PACKAGER) + .addInput(PackagedTurboFuel, 2) + .addOutput(Turbofuel, 2) + .addOutput(EmptyCanister, 2, true).createRecipe(); Turbofuel.add(packaged); } { // Packaged Turbofuel - Recipe recipe = new Recipe(3, Buildings.PACKAGER); - recipe.addInput(Turbofuel, 2); - recipe.addInput(EmptyCanister, 2); - recipe.addOutput(PackagedTurboFuel, 2); + Recipe recipe = new RecipeBuilder().setDuration(3).setBuilding(Buildings.PACKAGER) + .addInput(Turbofuel, 2) + .addInput(EmptyCanister, 2) + .addOutput(PackagedTurboFuel, 2).createRecipe(); PackagedTurboFuel.add(recipe); } { // Compacted Coal - Recipe recipe = new Recipe(2, Buildings.ASSEMBLER); + Recipe recipe = new RecipeBuilder().setDuration(12).setBuilding(Buildings.ASSEMBLER) + .addInput(Coal, 5) + .addInput(Sulfur, 5) + .addOutput(CompactedCoal, 5).createRecipe(); //TODO: 60/25 - recipe.addInput(Coal, 5); - recipe.addInput(Sulfur, 5); - recipe.addOutput(CompactedCoal, 5); CompactedCoal.add(recipe); } { // Iron Rebar - IronRebar.add(new Recipe(4, IronRod, 1, Buildings.CONSTRUCTOR)); + IronRebar.add(new RecipeBuilder().setDuration(4).addInput(IronRod,1).addOutput(IronRebar,1).setBuilding(Buildings.CONSTRUCTOR).createRecipe()); } { // Stun Rebar - Recipe recipe = new Recipe(6, Buildings.ASSEMBLER);//TODO , EQUIPMENT_WORKSHOP) - recipe.addInput(IronRebar, 1); - recipe.addInput(Quickwire, 5); - recipe.addOutput(StunRebar, 1); + Recipe recipe = new RecipeBuilder().setDuration(6).setBuilding(Buildings.ASSEMBLER) + .addInput(IronRebar, 1) + .addInput(Quickwire, 5) + .addOutput(StunRebar, 1).createRecipe();//TODO , EQUIPMENT_WORKSHOP) StunRebar.add(recipe); } { // Explosive Rebar - Recipe recipe = new Recipe(12, Buildings.MANUFACTURER);//TODO , EQUIPMENT_WORKSHOP) - recipe.addInput(IronRebar, 1); - recipe.addInput(SmokelessPowder, 2); - recipe.addInput(SteelPipe, 2); - recipe.addOutput(ExplosiveRebar, 1); + Recipe recipe = new RecipeBuilder().setDuration(12).setBuilding(Buildings.MANUFACTURER) + .addInput(IronRebar, 1) + .addInput(SmokelessPowder, 2) + .addInput(SteelPipe, 2) + .addOutput(ExplosiveRebar, 1).createRecipe();//TODO , EQUIPMENT_WORKSHOP) ExplosiveRebar.add(recipe); } { // Rebar Gun - Recipe recipe = new Recipe(60, Buildings.EQUIPMENT_WORKSHOP); - recipe.addInput(ReinforcedIronPlate, 6); - recipe.addInput(IronRod, 16); - recipe.addInput(Screw, 100); - recipe.addOutput(RebarGun, 1); + Recipe recipe = new RecipeBuilder().setDuration(60).setBuilding(Buildings.EQUIPMENT_WORKSHOP) + .addInput(ReinforcedIronPlate, 6) + .addInput(IronRod, 16) + .addInput(Screw, 100) + .addOutput(RebarGun, 1).createRecipe(); RebarGun.add(recipe); } { // Rifle Ammo - Recipe recipe = new Recipe(12, Buildings.ASSEMBLER);//TODO , EQUIPMENT_WORKSHOP) - recipe.addInput(CopperSheet, 3); - recipe.addInput(SmokelessPowder, 2); - recipe.addOutput(RifleAmmo, 15); + Recipe recipe = new RecipeBuilder().setDuration(12).setBuilding(Buildings.ASSEMBLER) + .addInput(CopperSheet, 3) + .addInput(SmokelessPowder, 2) + .addOutput(RifleAmmo, 15).createRecipe();//TODO , EQUIPMENT_WORKSHOP) RifleAmmo.add(recipe); } { // Homing Rifle Ammo - Recipe recipe = new Recipe(12, Buildings.ASSEMBLER);//TODO , EQUIPMENT_WORKSHOP) - recipe.addInput(RifleAmmo, 20); - recipe.addInput(HighSpeedConnector, 1); - recipe.addOutput(HomingRifleAmmo, 10); + Recipe recipe = new RecipeBuilder().setDuration(12).setBuilding(Buildings.ASSEMBLER) + .addInput(RifleAmmo, 20) + .addInput(HighSpeedConnector, 1) + .addOutput(HomingRifleAmmo, 10).createRecipe();//TODO , EQUIPMENT_WORKSHOP) HomingRifleAmmo.add(recipe); } { // Rifle - Recipe recipe = new Recipe(120, Buildings.EQUIPMENT_WORKSHOP); - recipe.addInput(Motor, 2); - recipe.addInput(Rubber, 10); - recipe.addInput(SteelPipe, 25); - recipe.addInput(Screw, 250); - recipe.addOutput(Rifle, 1); + Recipe recipe = new RecipeBuilder().setDuration(120).setBuilding(Buildings.EQUIPMENT_WORKSHOP) + .addInput(Motor, 2) + .addInput(Rubber, 10) + .addInput(SteelPipe, 25) + .addInput(Screw, 250) + .addOutput(Rifle, 1).createRecipe(); Rifle.add(recipe); } { // Smokeless Powder - Recipe recipe = new Recipe(6, Buildings.REFINERY); - recipe.addInput(BlackPowder, 2); - recipe.addInput(HeavyOilResidue, 1); - recipe.addOutput(SmokelessPowder, 2); + Recipe recipe = new RecipeBuilder().setDuration(6).setBuilding(Buildings.REFINERY) + .addInput(BlackPowder, 2) + .addInput(HeavyOilResidue, 1) + .addOutput(SmokelessPowder, 2).createRecipe(); SmokelessPowder.add(recipe); } } diff --git a/src/main/java/satisfactory/Test.java b/src/main/java/satisfactory/Test.java index aa42ca8..3f7bbc9 100644 --- a/src/main/java/satisfactory/Test.java +++ b/src/main/java/satisfactory/Test.java @@ -132,7 +132,7 @@ public class Test { planFor("p3_vf", new Production(Database.VersatileFrameWork, 1)); planFor("screw", new Production(Database.ReinforcedIronPlate, 1)); planFor("rotor", new Production(Database.Rotor, 1)); - planFor("mf", new Production(Database.ModularFrame, 1)); + planFor("mf", new Production(Database.ModularFrame, 10)); } private static void planFor(Item item, int amount, String name) { diff --git a/src/main/java/satisfactory/items/Item.java b/src/main/java/satisfactory/items/Item.java index adfd3de..f71f811 100644 --- a/src/main/java/satisfactory/items/Item.java +++ b/src/main/java/satisfactory/items/Item.java @@ -40,20 +40,13 @@ public abstract class Item { } public void add(Recipe recipe) { + if (!recipe.checkOutput(this)){ + throw new IllegalStateException("tried to add recipe which does not produce item"); + } if (recipes.isEmpty()) { setPreference(recipe); } - add(recipe, 1); - } - - public void add(Recipe recipe, double output) { recipes.add(recipe); - recipe.checkOutput(this, output); - } - - public void add(Recipe recipe, int output) { - recipes.add(recipe); - recipe.checkOutput(this, output); } public String getName() { diff --git a/src/main/java/satisfactory/items/Recipe.java b/src/main/java/satisfactory/items/Recipe.java index 28ab6ed..b3a8950 100644 --- a/src/main/java/satisfactory/items/Recipe.java +++ b/src/main/java/satisfactory/items/Recipe.java @@ -41,6 +41,15 @@ public class Recipe { this.byProducts = byProducts; this.building = building; } + public Recipe(int duration, Map inputs, Map outputs, Set byProducts, Building building,String name, boolean isHandCraftable) { + this.duration = duration; + this.inputs = inputs; + this.outputs = outputs; + this.byProducts = byProducts; + this.building = building; + this.name=name; + this.isHandCraftable = isHandCraftable; + } public Recipe(int duration, String name, boolean isHandCraftable, Building building) { this(duration, building); @@ -56,11 +65,11 @@ public class Recipe { return names; } - public void addInput(Item item, int amount) { + protected void addInput(Item item, int amount) { inputs.put(item, (double) amount); } - public void addInput(Item item, double amount) { + protected void addInput(Item item, double amount) { inputs.put(item, amount); } @@ -75,41 +84,33 @@ public class Recipe { '}'; } - public void addInput(Item input) { + protected void addInput(Item input) { addInput(input, 1); } - public void addOutput(Item item, int amount, boolean isByProduct) { + protected void addOutput(Item item, int amount, boolean isByProduct) { addOutput(item, (double) amount, isByProduct); } - public void addOutput(Item item, int amount) { + protected void addOutput(Item item, int amount) { this.outputs.put(item, (double) amount); - item.add(this, amount); + item.add(this); } - public void addOutput(Item item, double amount, boolean isByProduct) { + protected void addOutput(Item item, double amount, boolean isByProduct) { addOutput(item, amount); if (isByProduct) { byProducts.add(item); } } - public void addOutput(Item item, double amount) { + protected void addOutput(Item item, double amount) { this.outputs.put(item, amount); - item.add(this, amount); + item.add(this); } - public void checkOutput(Item item, int amount) { - if (!(outputs.containsKey(item) && outputs.get(item) == amount)) { - outputs.put(item, (double) amount); - } - } - - public void checkOutput(Item item, double amount) { - if (!(outputs.containsKey(item) && outputs.get(item) == amount)) { - outputs.put(item, amount); - } + public boolean checkOutput(Item item) { + return outputs.containsKey(item); } private String formatIO(Map map) { diff --git a/src/main/java/satisfactory/items/RecipeBuilder.java b/src/main/java/satisfactory/items/RecipeBuilder.java new file mode 100644 index 0000000..65bc394 --- /dev/null +++ b/src/main/java/satisfactory/items/RecipeBuilder.java @@ -0,0 +1,89 @@ +package satisfactory.items; + +import satisfactory.buildings.Building; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +public class RecipeBuilder { + private int duration; + private Building building; + private Map inputs = new HashMap<>(); + private Map outputs = new HashMap<>(); + private Set byProducts = new HashSet<>(); + private boolean isHandCraftable; + private String name; + + public RecipeBuilder setDuration(int duration) { + this.duration = duration; + return this; + } + + public RecipeBuilder setBuilding(Building building) { + this.building = building; + return this; + } + + public RecipeBuilder addInput(Item item, Double n) { + this.inputs.put(item, n);// TODO: merge? + return this; + } + public RecipeBuilder addInput(Item item, Integer n) { + return addInput(item,(double) n); + } + + public RecipeBuilder addOutput(Item item, Double n, boolean isByProduct) { + addByProduct(item); + return this.addOutput(item, n); + } + public RecipeBuilder addOutput(Item item, Double n) { + this.outputs.put(item, n);// TODO: merge? + return this; + } + public RecipeBuilder addOutput(Item item, Integer n) { + return addOutput(item,(double) n); + } + public RecipeBuilder addOutput(Item item, Integer n, boolean isByProduct) { + return addOutput(item,(double) n, isByProduct); + } + public RecipeBuilder setInputs(Map inputs) { + this.inputs = inputs;// TODO: merge? + return this; + } + + public RecipeBuilder setOutputs(Map outputs) { + this.outputs = outputs;// TODO: merge? + return this; + } + + public RecipeBuilder addByProduct(Item byProduct) { + this.byProducts.add(byProduct); + return this; + } + public RecipeBuilder setByProducts(Set byProduct) { + this.byProducts =byProducts;// TODO: merge? + return this; + } + + public RecipeBuilder setIsHandCraftable(boolean isHandCraftable) { + this.isHandCraftable = isHandCraftable; + return this; + } + + public RecipeBuilder setName(String name) { + this.name = name; + return this; + } + + public Recipe createRecipe() { + // public Recipe(int duration, Map inputs, Map outputs, Set byProducts, Building building,String name) { + if (outputs.isEmpty()){ + throw new IllegalStateException("no outputs set"); + } + Recipe recipe = new Recipe(duration, inputs,outputs, byProducts,building,name,isHandCraftable ); + outputs.keySet().forEach(item -> item.add(recipe)); + return recipe; + } +} \ No newline at end of file diff --git a/src/test/java/satisfactory/items/ItemTest.java b/src/test/java/satisfactory/items/ItemTest.java index cebcb39..3c0a145 100644 --- a/src/test/java/satisfactory/items/ItemTest.java +++ b/src/test/java/satisfactory/items/ItemTest.java @@ -36,7 +36,7 @@ class ItemTest { @Test void productionEncasedIndustrialBeam() { - test(Database.EncasedIndustrialBeam,"enc_beam"); + test(Database.EncasedIndustrialBeam, "enc_beam"); } @Test @@ -46,22 +46,24 @@ class ItemTest { } @Test - void productionUraniumFuelRod(){ + void productionUraniumFuelRod() { //test(Database.UraniumFuelRod, "uranium_fuel_rod"); fail(); } @Test - void productionPlastic(){ - test(Database.Plastic,"plastic"); + void productionPlastic() { + test(Database.Plastic, "plastic"); } + @Test - void productionRubber(){ - test(Database.Rubber,"rubber"); + void productionRubber() { + test(Database.Rubber, "rubber"); } + @Test - void productionRubberAndPlastic(){ - test("rubberAndPlastic",Database.Rubber, Database.Plastic); + void productionRubberAndPlastic() { + test("rubberAndPlastic", Database.Rubber, Database.Plastic); } } \ No newline at end of file