From e34e92a344b70add29cecc5533a0934b67b8600d Mon Sep 17 00:00:00 2001 From: pupnewfster Date: Thu, 21 Mar 2019 15:12:06 -0400 Subject: [PATCH] Promote RecipeHandler.Recipe to a generic class --- .../client/jei/BaseRecipeCategory.java | 2 +- .../java/mekanism/client/jei/MekanismJEI.java | 16 +- .../client/jei/RecipeRegistryHelper.java | 106 +++--- .../RotaryCondensentratorRecipeCategory.java | 4 +- .../java/mekanism/common/base/IFactory.java | 11 +- .../commands/MekRecipesCommand.java | 317 ++++++++---------- .../handlers/ChemicalCrystallizer.java | 10 +- .../handlers/ChemicalDissolution.java | 11 +- .../handlers/ChemicalInfuser.java | 10 +- .../handlers/ChemicalInjection.java | 9 +- .../handlers/ChemicalOxidizer.java | 11 +- .../crafttweaker/handlers/ChemicalWasher.java | 12 +- .../crafttweaker/handlers/Combiner.java | 15 +- .../crafttweaker/handlers/Compressor.java | 10 +- .../crafttweaker/handlers/Crusher.java | 9 +- .../handlers/EnergizedSmelter.java | 10 +- .../crafttweaker/handlers/Enrichment.java | 10 +- .../crafttweaker/handlers/Infuser.java | 8 +- .../crafttweaker/handlers/Purification.java | 10 +- .../crafttweaker/handlers/Reaction.java | 8 +- .../crafttweaker/handlers/Sawmill.java | 10 +- .../crafttweaker/handlers/Separator.java | 12 +- .../handlers/SolarNeutronActivator.java | 12 +- .../handlers/ThermalEvaporation.java | 11 +- .../crafttweaker/util/AddMekanismRecipe.java | 6 +- .../util/RecipeMapModification.java | 20 +- .../util/RemoveAllMekanismRecipe.java | 6 +- .../util/RemoveMekanismRecipe.java | 3 +- .../ContainerMetallurgicInfuser.java | 9 +- .../mekanism/common/recipe/RecipeHandler.java | 246 ++++++++------ .../tile/TileEntityMetallurgicInfuser.java | 11 +- 31 files changed, 445 insertions(+), 500 deletions(-) diff --git a/src/main/java/mekanism/client/jei/BaseRecipeCategory.java b/src/main/java/mekanism/client/jei/BaseRecipeCategory.java index 2cfc36a33..a003fd4d4 100644 --- a/src/main/java/mekanism/client/jei/BaseRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/BaseRecipeCategory.java @@ -72,7 +72,7 @@ public abstract class BaseRecipeCategory implements IRecipeCategory recipeList = Recipe.ENERGIZED_SMELTER.get().values(); registry.addRecipes(recipeList.stream().map(MachineRecipeWrapper::new).collect(Collectors.toList()), - getCategory(Recipe.ENERGIZED_SMELTER)); + Recipe.ENERGIZED_SMELTER.getJEICategory()); registry - .addRecipeClickArea(GuiEnergizedSmelter.class, 79, 40, 24, 7, getCategory(Recipe.ENERGIZED_SMELTER)); + .addRecipeClickArea(GuiEnergizedSmelter.class, 79, 40, 24, 7, + Recipe.ENERGIZED_SMELTER.getJEICategory()); } else if (crafttweakerLoaded && EnergizedSmelter.hasAddedRecipe()) // Added but not removed { // Only add added recipes - HashMap smeltingRecipes = Recipe.ENERGIZED_SMELTER.get(); + Map smeltingRecipes = Recipe.ENERGIZED_SMELTER.get(); List smeltingWrapper = smeltingRecipes.entrySet().stream() .filter(entry -> !FurnaceRecipes.instance().getSmeltingList().keySet() .contains(entry.getKey().ingredient)).map(entry -> new MachineRecipeWrapper(entry.getValue())) .collect(Collectors.toList()); - registry.addRecipes(smeltingWrapper, getCategory(Recipe.ENERGIZED_SMELTER)); + registry.addRecipes(smeltingWrapper, Recipe.ENERGIZED_SMELTER.getJEICategory()); registry.addRecipeClickArea(GuiEnergizedSmelter.class, 79, 40, 24, 7, VanillaRecipeCategoryUid.SMELTING, - getCategory(Recipe.ENERGIZED_SMELTER)); + Recipe.ENERGIZED_SMELTER.getJEICategory()); registerVanillaSmeltingRecipeCatalyst(registry); } else { //Only use furnace list, so no extra registration. registry.addRecipeClickArea(GuiEnergizedSmelter.class, 79, 40, 24, 7, VanillaRecipeCategoryUid.SMELTING); registerVanillaSmeltingRecipeCatalyst(registry); } - registerRecipeItem(registry, MachineType.ENERGIZED_SMELTER); + registerRecipeItem(registry, MachineType.ENERGIZED_SMELTER, Recipe.ENERGIZED_SMELTER); } @@ -329,20 +336,15 @@ public class RecipeRegistryHelper { private static void addRecipes(IModRegistry registry, Recipe type, Class recipeClass, IRecipeWrapperFactory factory) { - String recipeCategoryUid = getCategory(type); + String recipeCategoryUid = type.getJEICategory(); registry.handleRecipes(recipeClass, factory, recipeCategoryUid); Collection recipeList = type.get().values(); registry.addRecipes(recipeList.stream().map(factory::getRecipeWrapper).collect(Collectors.toList()), recipeCategoryUid); } - private static String getCategory(Recipe type) { - return "mekanism." + type.getName(); - } - - private static void registerRecipeItem(IModRegistry registry, MachineType type) { - String category = "mekanism." + type.getName(); - registry.addRecipeCatalyst(type.getStack(), category); + private static void registerRecipeItem(IModRegistry registry, MachineType type, Recipe recipe) { + registry.addRecipeCatalyst(type.getStack(), recipe.getJEICategory()); RecipeType factoryType = null; for (RecipeType t : RecipeType.values()) { if (t.getType() == type) { @@ -353,7 +355,7 @@ public class RecipeRegistryHelper { if (factoryType != null) { for (Tier.FactoryTier tier : Tier.FactoryTier.values()) { if (tier.machineType.isEnabled()) { - registry.addRecipeCatalyst(MekanismUtils.getFactory(tier, factoryType), category); + registry.addRecipeCatalyst(MekanismUtils.getFactory(tier, factoryType), recipe.getJEICategory()); } } } diff --git a/src/main/java/mekanism/client/jei/machine/other/RotaryCondensentratorRecipeCategory.java b/src/main/java/mekanism/client/jei/machine/other/RotaryCondensentratorRecipeCategory.java index b81eefa1d..4b0fffbbc 100644 --- a/src/main/java/mekanism/client/jei/machine/other/RotaryCondensentratorRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/other/RotaryCondensentratorRecipeCategory.java @@ -18,8 +18,8 @@ public class RotaryCondensentratorRecipeCategory extends BaseRecipeCategory { public RotaryCondensentratorRecipeCategory(IGuiHelper helper, boolean condensentrating) { super(helper, "mekanism:gui/nei/GuiRotaryCondensentrator.png", - condensentrating ? "rotary_condensentrator_condensentrating" - : "rotary_condensentrator_decondensentrating", + condensentrating ? "mekanism.rotary_condensentrator_condensentrating" + : "mekanism.rotary_condensentrator_decondensentrating", condensentrating ? "gui.condensentrating" : "gui.decondensentrating", null, 3, 12, 170, 71); this.condensentrating = condensentrating; } diff --git a/src/main/java/mekanism/common/base/IFactory.java b/src/main/java/mekanism/common/base/IFactory.java index 3b400028b..dbfced202 100644 --- a/src/main/java/mekanism/common/base/IFactory.java +++ b/src/main/java/mekanism/common/base/IFactory.java @@ -2,6 +2,7 @@ package mekanism.common.base; import java.util.Locale; import java.util.Map; +import java.util.Map.Entry; import mekanism.api.gas.Gas; import mekanism.api.gas.GasStack; import mekanism.common.InfuseStorage; @@ -146,12 +147,10 @@ public interface IFactory { if (infuse.type != null) { return RecipeHandler.getMetallurgicInfuserRecipe(new InfusionInput(infuse, slotStack)); } else { - for (Object obj : Recipe.METALLURGIC_INFUSER.get().entrySet()) { - Map.Entry entry = (Map.Entry) obj; - InfusionInput input = (InfusionInput) entry.getKey(); - - if (input.inputStack.isItemEqual(slotStack)) { - return (MetallurgicInfuserRecipe) entry.getValue(); + for (Entry entry : Recipe.METALLURGIC_INFUSER.get() + .entrySet()) { + if (entry.getKey().inputStack.isItemEqual(slotStack)) { + return entry.getValue(); } } } diff --git a/src/main/java/mekanism/common/integration/crafttweaker/commands/MekRecipesCommand.java b/src/main/java/mekanism/common/integration/crafttweaker/commands/MekRecipesCommand.java index ff4e9ed04..02cdc0342 100644 --- a/src/main/java/mekanism/common/integration/crafttweaker/commands/MekRecipesCommand.java +++ b/src/main/java/mekanism/common/integration/crafttweaker/commands/MekRecipesCommand.java @@ -4,7 +4,6 @@ import crafttweaker.CraftTweakerAPI; import crafttweaker.mc1120.commands.CraftTweakerCommand; import crafttweaker.mc1120.commands.SpecialMessagesChat; import java.util.Arrays; -import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; @@ -64,248 +63,196 @@ public class MekRecipesCommand extends CraftTweakerCommand { } String subCommand = args[0]; CraftTweakerAPI.logCommand(subCommand + ":"); - Collection values = Collections.emptyList(); + Recipe type; switch (subCommand) { case "crystallizer": - values = Recipe.CHEMICAL_CRYSTALLIZER.get().values(); - for (Object value : values) { - if (value instanceof CrystallizerRecipe) { - CrystallizerRecipe recipe = ((CrystallizerRecipe) value); - CraftTweakerAPI - .logCommand(String.format("mods.mekanism.chemical.crystallizer.addRecipe(%s, %s)", - RecipeInfoHelper.getGasName(recipe.getInput().ingredient), - RecipeInfoHelper.getItemName(recipe.getOutput().output) - )); - } + type = Recipe.CHEMICAL_CRYSTALLIZER; + for (CrystallizerRecipe recipe : Recipe.CHEMICAL_CRYSTALLIZER.get().values()) { + CraftTweakerAPI.logCommand(String.format("mods.mekanism.chemical.crystallizer.addRecipe(%s, %s)", + RecipeInfoHelper.getGasName(recipe.getInput().ingredient), + RecipeInfoHelper.getItemName(recipe.getOutput().output) + )); } break; case "dissolution": - values = Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get().values(); - for (Object value : values) { - if (value instanceof DissolutionRecipe) { - DissolutionRecipe recipe = (DissolutionRecipe) value; - CraftTweakerAPI.logCommand(String.format("mods.mekanism.chemical.dissolution.addRecipe(%s, %s)", - RecipeInfoHelper.getItemName(recipe.getInput().ingredient), - RecipeInfoHelper.getGasName(recipe.getOutput().output) - )); - } + type = Recipe.CHEMICAL_DISSOLUTION_CHAMBER; + for (DissolutionRecipe recipe : Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get().values()) { + CraftTweakerAPI.logCommand(String.format("mods.mekanism.chemical.dissolution.addRecipe(%s, %s)", + RecipeInfoHelper.getItemName(recipe.getInput().ingredient), + RecipeInfoHelper.getGasName(recipe.getOutput().output) + )); } break; case "chemicalInfuser": - values = Recipe.METALLURGIC_INFUSER.get().values(); - for (Object value : values) { - if (value instanceof ChemicalInfuserRecipe) { - ChemicalInfuserRecipe recipe = (ChemicalInfuserRecipe) value; - CraftTweakerAPI.logCommand(String.format("mods.mekanism.chemical.infuser.addRecipe(%s, %s, %s)", - RecipeInfoHelper.getGasName(recipe.getInput().leftGas), - RecipeInfoHelper.getGasName(recipe.getInput().rightGas), - RecipeInfoHelper.getGasName(recipe.getOutput().output) - )); - } + type = Recipe.CHEMICAL_INFUSER; + for (ChemicalInfuserRecipe recipe : Recipe.CHEMICAL_INFUSER.get().values()) { + CraftTweakerAPI.logCommand(String.format("mods.mekanism.chemical.infuser.addRecipe(%s, %s, %s)", + RecipeInfoHelper.getGasName(recipe.getInput().leftGas), + RecipeInfoHelper.getGasName(recipe.getInput().rightGas), + RecipeInfoHelper.getGasName(recipe.getOutput().output) + )); } break; case "injection": - values = Recipe.CHEMICAL_INJECTION_CHAMBER.get().values(); - for (Object value : values) { - if (value instanceof InjectionRecipe) { - InjectionRecipe recipe = (InjectionRecipe) value; - CraftTweakerAPI - .logCommand(String.format("mods.mekanism.chemical.injection.addRecipe(%s, %s, %s)", - RecipeInfoHelper.getItemName(recipe.getInput().itemStack), - RecipeInfoHelper.getGasName(recipe.getInput().gasType), - RecipeInfoHelper.getItemName(recipe.getOutput().output) - )); - } + type = Recipe.CHEMICAL_INJECTION_CHAMBER; + for (InjectionRecipe recipe : Recipe.CHEMICAL_INJECTION_CHAMBER.get().values()) { + CraftTweakerAPI.logCommand(String.format("mods.mekanism.chemical.injection.addRecipe(%s, %s, %s)", + RecipeInfoHelper.getItemName(recipe.getInput().itemStack), + RecipeInfoHelper.getGasName(recipe.getInput().gasType), + RecipeInfoHelper.getItemName(recipe.getOutput().output) + )); } break; case "oxidizer": - values = Recipe.CHEMICAL_OXIDIZER.get().values(); - for (Object value : values) { - if (value instanceof OxidationRecipe) { - OxidationRecipe recipe = (OxidationRecipe) value; - CraftTweakerAPI.logCommand(String.format("mods.mekanism.chemical.oxidizer.addRecipe(%s, %s)", - RecipeInfoHelper.getItemName(recipe.getInput().ingredient), - RecipeInfoHelper.getGasName(recipe.getOutput().output) - )); - } + type = Recipe.CHEMICAL_OXIDIZER; + for (OxidationRecipe recipe : Recipe.CHEMICAL_OXIDIZER.get().values()) { + CraftTweakerAPI.logCommand(String.format("mods.mekanism.chemical.oxidizer.addRecipe(%s, %s)", + RecipeInfoHelper.getItemName(recipe.getInput().ingredient), + RecipeInfoHelper.getGasName(recipe.getOutput().output) + )); } break; case "washer": - values = Recipe.CHEMICAL_WASHER.get().values(); - for (Object value : values) { - if (value instanceof WasherRecipe) { - WasherRecipe recipe = (WasherRecipe) value; - CraftTweakerAPI.logCommand(String.format("mods.mekanism.chemical.washer.addRecipe(%s, %s)", - RecipeInfoHelper.getGasName(recipe.getInput().ingredient), - RecipeInfoHelper.getGasName(recipe.getOutput().output) - )); - } + type = Recipe.CHEMICAL_WASHER; + for (WasherRecipe recipe : Recipe.CHEMICAL_WASHER.get().values()) { + CraftTweakerAPI.logCommand(String.format("mods.mekanism.chemical.washer.addRecipe(%s, %s)", + RecipeInfoHelper.getGasName(recipe.getInput().ingredient), + RecipeInfoHelper.getGasName(recipe.getOutput().output) + )); } break; case "combiner": - values = Recipe.COMBINER.get().values(); - for (Object value : values) { - if (value instanceof CombinerRecipe) { - CombinerRecipe recipe = (CombinerRecipe) value; - CraftTweakerAPI.logCommand(String.format("mods.mekanism.combiner.addRecipe(%s, %s, %s)", - RecipeInfoHelper.getItemName(recipe.getInput().itemStack), - RecipeInfoHelper.getItemName(recipe.getInput().extraStack), - RecipeInfoHelper.getItemName(recipe.getOutput().output) - )); - } + type = Recipe.COMBINER; + for (CombinerRecipe recipe : Recipe.COMBINER.get().values()) { + CraftTweakerAPI.logCommand(String.format("mods.mekanism.combiner.addRecipe(%s, %s, %s)", + RecipeInfoHelper.getItemName(recipe.getInput().itemStack), + RecipeInfoHelper.getItemName(recipe.getInput().extraStack), + RecipeInfoHelper.getItemName(recipe.getOutput().output) + )); } break; case "crusher": - values = Recipe.CRUSHER.get().values(); - for (Object value : values) { - if (value instanceof CrusherRecipe) { - CrusherRecipe recipe = (CrusherRecipe) value; - CraftTweakerAPI.logCommand(String.format("mods.mekanism.crusher.addRecipe(%s, %s)", - RecipeInfoHelper.getItemName(recipe.getInput().ingredient), - RecipeInfoHelper.getItemName(recipe.getOutput().output) - )); - } + type = Recipe.CRUSHER; + for (CrusherRecipe recipe : Recipe.CRUSHER.get().values()) { + CraftTweakerAPI.logCommand(String.format("mods.mekanism.crusher.addRecipe(%s, %s)", + RecipeInfoHelper.getItemName(recipe.getInput().ingredient), + RecipeInfoHelper.getItemName(recipe.getOutput().output) + )); } break; case "separator": - values = Recipe.ELECTROLYTIC_SEPARATOR.get().values(); - for (Object value : values) { - if (value instanceof SeparatorRecipe) { - SeparatorRecipe recipe = (SeparatorRecipe) value; - CraftTweakerAPI.logCommand(String.format("mods.mekanism.separator.addRecipe(%s, %s, %s, %s)", - RecipeInfoHelper.getFluidName(recipe.getInput().ingredient), - recipe.energyUsage, - RecipeInfoHelper.getGasName(recipe.getOutput().leftGas), - RecipeInfoHelper.getGasName(recipe.getOutput().rightGas) - )); - } + type = Recipe.ELECTROLYTIC_SEPARATOR; + for (SeparatorRecipe recipe : Recipe.ELECTROLYTIC_SEPARATOR.get().values()) { + CraftTweakerAPI.logCommand(String.format("mods.mekanism.separator.addRecipe(%s, %s, %s, %s)", + RecipeInfoHelper.getFluidName(recipe.getInput().ingredient), + recipe.energyUsage, + RecipeInfoHelper.getGasName(recipe.getOutput().leftGas), + RecipeInfoHelper.getGasName(recipe.getOutput().rightGas) + )); } break; case "smelter": - values = Recipe.ENERGIZED_SMELTER.get().values(); - for (Object value : values) { - if (value instanceof SmeltingRecipe) { - SmeltingRecipe recipe = (SmeltingRecipe) value; - CraftTweakerAPI.logCommand(String.format("mods.mekanism.smelter.addRecipe(%s, %s)", - RecipeInfoHelper.getItemName(recipe.getInput().ingredient), - RecipeInfoHelper.getItemName(recipe.getOutput().output) - )); - } + type = Recipe.ENERGIZED_SMELTER; + for (SmeltingRecipe recipe : Recipe.ENERGIZED_SMELTER.get().values()) { + CraftTweakerAPI.logCommand(String.format("mods.mekanism.smelter.addRecipe(%s, %s)", + RecipeInfoHelper.getItemName(recipe.getInput().ingredient), + RecipeInfoHelper.getItemName(recipe.getOutput().output) + )); } break; case "enrichment": - values = Recipe.ENRICHMENT_CHAMBER.get().values(); - for (Object value : values) { - if (value instanceof EnrichmentRecipe) { - EnrichmentRecipe recipe = (EnrichmentRecipe) value; - CraftTweakerAPI.logCommand(String.format("mods.mekanism.enrichment.addRecipe(%s, %s)", - RecipeInfoHelper.getItemName(recipe.getInput().ingredient), - RecipeInfoHelper.getItemName(recipe.getOutput().output) - )); - } + type = Recipe.ENRICHMENT_CHAMBER; + for (EnrichmentRecipe recipe : Recipe.ENRICHMENT_CHAMBER.get().values()) { + CraftTweakerAPI.logCommand(String.format("mods.mekanism.enrichment.addRecipe(%s, %s)", + RecipeInfoHelper.getItemName(recipe.getInput().ingredient), + RecipeInfoHelper.getItemName(recipe.getOutput().output) + )); } break; case "metallurgicInfuser": - values = Recipe.METALLURGIC_INFUSER.get().values(); - for (Object value : values) { - if (value instanceof MetallurgicInfuserRecipe) { - MetallurgicInfuserRecipe recipe = (MetallurgicInfuserRecipe) value; - CraftTweakerAPI.logCommand(String.format("mods.mekanism.infuser.addRecipe(%s, %s, %s, %s)", - recipe.getInput().infuse.type, - recipe.getInput().infuse.amount, - RecipeInfoHelper.getItemName(recipe.getInput().inputStack), - RecipeInfoHelper.getItemName(recipe.getOutput().output) - )); - } + type = Recipe.METALLURGIC_INFUSER; + for (MetallurgicInfuserRecipe recipe : Recipe.METALLURGIC_INFUSER.get().values()) { + CraftTweakerAPI.logCommand(String.format("mods.mekanism.infuser.addRecipe(%s, %s, %s, %s)", + recipe.getInput().infuse.type, + recipe.getInput().infuse.amount, + RecipeInfoHelper.getItemName(recipe.getInput().inputStack), + RecipeInfoHelper.getItemName(recipe.getOutput().output) + )); } break; case "compressor": - values = Recipe.OSMIUM_COMPRESSOR.get().values(); - for (Object value : values) { - if (value instanceof OsmiumCompressorRecipe) { - OsmiumCompressorRecipe recipe = (OsmiumCompressorRecipe) value; - CraftTweakerAPI.logCommand(String.format("mods.mekanism.compressor.addRecipe(%s, %s, %s)", - RecipeInfoHelper.getItemName(recipe.getInput().itemStack), - RecipeInfoHelper.getGasName(recipe.getInput().gasType), - RecipeInfoHelper.getItemName(recipe.getOutput().output) - )); - } + type = Recipe.OSMIUM_COMPRESSOR; + for (OsmiumCompressorRecipe recipe : Recipe.OSMIUM_COMPRESSOR.get().values()) { + CraftTweakerAPI.logCommand(String.format("mods.mekanism.compressor.addRecipe(%s, %s, %s)", + RecipeInfoHelper.getItemName(recipe.getInput().itemStack), + RecipeInfoHelper.getGasName(recipe.getInput().gasType), + RecipeInfoHelper.getItemName(recipe.getOutput().output) + )); } break; case "sawmill": - values = Recipe.PRECISION_SAWMILL.get().values(); - for (Object value : values) { - if (value instanceof SawmillRecipe) { - SawmillRecipe recipe = (SawmillRecipe) value; - CraftTweakerAPI.logCommand(String.format("mods.mekanism.sawmill.addRecipe(%s, %s, %s, %s)", - RecipeInfoHelper.getItemName(recipe.getInput().ingredient), - RecipeInfoHelper.getItemName(recipe.getOutput().primaryOutput), - RecipeInfoHelper.getItemName(recipe.getOutput().secondaryOutput), - recipe.getOutput().secondaryChance - )); - } + type = Recipe.PRECISION_SAWMILL; + for (SawmillRecipe recipe : Recipe.PRECISION_SAWMILL.get().values()) { + CraftTweakerAPI.logCommand(String.format("mods.mekanism.sawmill.addRecipe(%s, %s, %s, %s)", + RecipeInfoHelper.getItemName(recipe.getInput().ingredient), + RecipeInfoHelper.getItemName(recipe.getOutput().primaryOutput), + RecipeInfoHelper.getItemName(recipe.getOutput().secondaryOutput), + recipe.getOutput().secondaryChance + )); } break; case "prc": - values = Recipe.PRESSURIZED_REACTION_CHAMBER.get().values(); - for (Object value : values) { - if (value instanceof PressurizedRecipe) { - PressurizedRecipe recipe = (PressurizedRecipe) value; - CraftTweakerAPI - .logCommand(String.format("mods.mekanism.reaction.addRecipe(%s, %s, %s, %s, %s, %s, %s)", - RecipeInfoHelper.getItemName(recipe.getInput().getSolid()), - RecipeInfoHelper.getFluidName(recipe.getInput().getFluid()), - RecipeInfoHelper.getGasName(recipe.getInput().getGas()), - RecipeInfoHelper.getItemName(recipe.getOutput().getItemOutput()), - RecipeInfoHelper.getGasName(recipe.getOutput().getGasOutput()), - recipe.extraEnergy, - recipe.ticks - )); - } + type = Recipe.PRESSURIZED_REACTION_CHAMBER; + for (PressurizedRecipe recipe : Recipe.PRESSURIZED_REACTION_CHAMBER.get().values()) { + CraftTweakerAPI + .logCommand(String.format("mods.mekanism.reaction.addRecipe(%s, %s, %s, %s, %s, %s, %s)", + RecipeInfoHelper.getItemName(recipe.getInput().getSolid()), + RecipeInfoHelper.getFluidName(recipe.getInput().getFluid()), + RecipeInfoHelper.getGasName(recipe.getInput().getGas()), + RecipeInfoHelper.getItemName(recipe.getOutput().getItemOutput()), + RecipeInfoHelper.getGasName(recipe.getOutput().getGasOutput()), + recipe.extraEnergy, + recipe.ticks + )); } break; case "purification": - values = Recipe.PURIFICATION_CHAMBER.get().values(); - for (Object value : values) { - if (value instanceof PurificationRecipe) { - PurificationRecipe recipe = (PurificationRecipe) value; - CraftTweakerAPI.logCommand(String.format("mods.mekanism.purification.addRecipe(%s, %s, %s)", - RecipeInfoHelper.getItemName(recipe.getInput().itemStack), - RecipeInfoHelper.getGasName(recipe.getInput().gasType), - RecipeInfoHelper.getItemName(recipe.getOutput().output) - )); - } + type = Recipe.PURIFICATION_CHAMBER; + for (PurificationRecipe recipe : Recipe.PURIFICATION_CHAMBER.get().values()) { + CraftTweakerAPI.logCommand(String.format("mods.mekanism.purification.addRecipe(%s, %s, %s)", + RecipeInfoHelper.getItemName(recipe.getInput().itemStack), + RecipeInfoHelper.getGasName(recipe.getInput().gasType), + RecipeInfoHelper.getItemName(recipe.getOutput().output) + )); } break; case "solarneutronactivator": - values = Recipe.SOLAR_NEUTRON_ACTIVATOR.get().values(); - for (Object value : values) { - if (value instanceof SolarNeutronRecipe) { - SolarNeutronRecipe recipe = (SolarNeutronRecipe) value; - CraftTweakerAPI - .logCommand(String.format("mods.mekanism.solarneutronactivator.addRecipe(%s, %s)", - RecipeInfoHelper.getGasName(recipe.getInput().ingredient), - RecipeInfoHelper.getGasName(recipe.getOutput().output) - )); - } + type = Recipe.SOLAR_NEUTRON_ACTIVATOR; + for (SolarNeutronRecipe recipe : Recipe.SOLAR_NEUTRON_ACTIVATOR.get().values()) { + CraftTweakerAPI.logCommand(String.format("mods.mekanism.solarneutronactivator.addRecipe(%s, %s)", + RecipeInfoHelper.getGasName(recipe.getInput().ingredient), + RecipeInfoHelper.getGasName(recipe.getOutput().output) + )); } break; case "thermalevaporation": - values = Recipe.THERMAL_EVAPORATION_PLANT.get().values(); - for (Object value : values) { - if (value instanceof ThermalEvaporationRecipe) { - ThermalEvaporationRecipe recipe = (ThermalEvaporationRecipe) value; - CraftTweakerAPI.logCommand(String.format("mods.mekanism.thermalevaporation.addRecipe(%s, %s)", - RecipeInfoHelper.getFluidName(recipe.getInput().ingredient), - RecipeInfoHelper.getFluidName(recipe.getOutput().output) - )); - } + type = Recipe.THERMAL_EVAPORATION_PLANT; + for (ThermalEvaporationRecipe recipe : Recipe.THERMAL_EVAPORATION_PLANT.get().values()) { + CraftTweakerAPI.logCommand(String.format("mods.mekanism.thermalevaporation.addRecipe(%s, %s)", + RecipeInfoHelper.getFluidName(recipe.getInput().ingredient), + RecipeInfoHelper.getFluidName(recipe.getOutput().output) + )); } break; + default: + sender.sendMessage(SpecialMessagesChat.getNormalMessage( + "Recipe Type required, pick one of the following: " + Arrays.toString(subCommands.toArray()))); + return; } sender.sendMessage(SpecialMessagesChat - .getLinkToCraftTweakerLog("List of " + values.size() + " " + subCommand + " recipes generated;", sender)); + .getLinkToCraftTweakerLog("List of " + type.get().size() + " " + subCommand + " recipes generated;", + sender)); } @Override diff --git a/src/main/java/mekanism/common/integration/crafttweaker/handlers/ChemicalCrystallizer.java b/src/main/java/mekanism/common/integration/crafttweaker/handlers/ChemicalCrystallizer.java index 6f01a7bb2..12ac73b40 100644 --- a/src/main/java/mekanism/common/integration/crafttweaker/handlers/ChemicalCrystallizer.java +++ b/src/main/java/mekanism/common/integration/crafttweaker/handlers/ChemicalCrystallizer.java @@ -13,9 +13,7 @@ import mekanism.common.integration.crafttweaker.util.IngredientWrapper; import mekanism.common.integration.crafttweaker.util.RemoveAllMekanismRecipe; import mekanism.common.integration.crafttweaker.util.RemoveMekanismRecipe; import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.inputs.GasInput; import mekanism.common.recipe.machines.CrystallizerRecipe; -import mekanism.common.recipe.outputs.ItemStackOutput; import stanhebben.zenscript.annotations.Optional; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -30,7 +28,7 @@ public class ChemicalCrystallizer { public static void addRecipe(IGasStack gasInput, IItemStack itemOutput) { if (IngredientHelper.checkNotNull(NAME, gasInput, itemOutput)) { CrafttweakerIntegration.LATE_ADDITIONS - .add(new AddMekanismRecipe(NAME, Recipe.CHEMICAL_CRYSTALLIZER, + .add(new AddMekanismRecipe<>(NAME, Recipe.CHEMICAL_CRYSTALLIZER, new CrystallizerRecipe(GasHelper.toGas(gasInput), IngredientHelper.toStack(itemOutput)))); } } @@ -39,15 +37,13 @@ public class ChemicalCrystallizer { public static void removeRecipe(IIngredient itemOutput, @Optional IIngredient gasInput) { if (IngredientHelper.checkNotNull(NAME, itemOutput)) { CrafttweakerIntegration.LATE_REMOVALS - .add(new RemoveMekanismRecipe(NAME, - Recipe.CHEMICAL_CRYSTALLIZER, new IngredientWrapper(itemOutput), + .add(new RemoveMekanismRecipe<>(NAME, Recipe.CHEMICAL_CRYSTALLIZER, new IngredientWrapper(itemOutput), new IngredientWrapper(gasInput))); } } @ZenMethod public static void removeAllRecipes() { - CrafttweakerIntegration.LATE_REMOVALS - .add(new RemoveAllMekanismRecipe(NAME, Recipe.CHEMICAL_CRYSTALLIZER)); + CrafttweakerIntegration.LATE_REMOVALS.add(new RemoveAllMekanismRecipe<>(NAME, Recipe.CHEMICAL_CRYSTALLIZER)); } } \ No newline at end of file diff --git a/src/main/java/mekanism/common/integration/crafttweaker/handlers/ChemicalDissolution.java b/src/main/java/mekanism/common/integration/crafttweaker/handlers/ChemicalDissolution.java index 128ca0c9c..d04788a45 100644 --- a/src/main/java/mekanism/common/integration/crafttweaker/handlers/ChemicalDissolution.java +++ b/src/main/java/mekanism/common/integration/crafttweaker/handlers/ChemicalDissolution.java @@ -13,9 +13,7 @@ import mekanism.common.integration.crafttweaker.util.IngredientWrapper; import mekanism.common.integration.crafttweaker.util.RemoveAllMekanismRecipe; import mekanism.common.integration.crafttweaker.util.RemoveMekanismRecipe; import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.inputs.ItemStackInput; import mekanism.common.recipe.machines.DissolutionRecipe; -import mekanism.common.recipe.outputs.GasOutput; import stanhebben.zenscript.annotations.Optional; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -30,7 +28,7 @@ public class ChemicalDissolution { public static void addRecipe(IItemStack itemInput, IGasStack gasOutput) { if (IngredientHelper.checkNotNull(NAME, itemInput, gasOutput)) { CrafttweakerIntegration.LATE_ADDITIONS - .add(new AddMekanismRecipe(NAME, Recipe.CHEMICAL_DISSOLUTION_CHAMBER, + .add(new AddMekanismRecipe<>(NAME, Recipe.CHEMICAL_DISSOLUTION_CHAMBER, new DissolutionRecipe(IngredientHelper.toStack(itemInput), GasHelper.toGas(gasOutput)))); } } @@ -39,15 +37,14 @@ public class ChemicalDissolution { public static void removeRecipe(IIngredient gasOutput, @Optional IIngredient itemInput) { if (IngredientHelper.checkNotNull(NAME, gasOutput)) { CrafttweakerIntegration.LATE_REMOVALS - .add(new RemoveMekanismRecipe(NAME, - Recipe.CHEMICAL_DISSOLUTION_CHAMBER, new IngredientWrapper(gasOutput), - new IngredientWrapper(itemInput))); + .add(new RemoveMekanismRecipe<>(NAME, Recipe.CHEMICAL_DISSOLUTION_CHAMBER, + new IngredientWrapper(gasOutput), new IngredientWrapper(itemInput))); } } @ZenMethod public static void removeAllRecipes() { CrafttweakerIntegration.LATE_REMOVALS - .add(new RemoveAllMekanismRecipe(NAME, Recipe.CHEMICAL_DISSOLUTION_CHAMBER)); + .add(new RemoveAllMekanismRecipe<>(NAME, Recipe.CHEMICAL_DISSOLUTION_CHAMBER)); } } \ No newline at end of file diff --git a/src/main/java/mekanism/common/integration/crafttweaker/handlers/ChemicalInfuser.java b/src/main/java/mekanism/common/integration/crafttweaker/handlers/ChemicalInfuser.java index b79182686..0d236745c 100644 --- a/src/main/java/mekanism/common/integration/crafttweaker/handlers/ChemicalInfuser.java +++ b/src/main/java/mekanism/common/integration/crafttweaker/handlers/ChemicalInfuser.java @@ -12,9 +12,7 @@ import mekanism.common.integration.crafttweaker.util.IngredientWrapper; import mekanism.common.integration.crafttweaker.util.RemoveAllMekanismRecipe; import mekanism.common.integration.crafttweaker.util.RemoveMekanismRecipe; import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.inputs.ChemicalPairInput; import mekanism.common.recipe.machines.ChemicalInfuserRecipe; -import mekanism.common.recipe.outputs.GasOutput; import stanhebben.zenscript.annotations.Optional; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -29,7 +27,7 @@ public class ChemicalInfuser { public static void addRecipe(IGasStack leftGasInput, IGasStack rightGasInput, IGasStack gasOutput) { if (IngredientHelper.checkNotNull(NAME, leftGasInput, rightGasInput, gasOutput)) { CrafttweakerIntegration.LATE_ADDITIONS - .add(new AddMekanismRecipe(NAME, Recipe.CHEMICAL_INFUSER, + .add(new AddMekanismRecipe<>(NAME, Recipe.CHEMICAL_INFUSER, new ChemicalInfuserRecipe(GasHelper.toGas(leftGasInput), GasHelper.toGas(rightGasInput), GasHelper.toGas(gasOutput)))); } @@ -40,15 +38,13 @@ public class ChemicalInfuser { @Optional IIngredient rightGasInput) { if (IngredientHelper.checkNotNull(NAME, gasOutput)) { CrafttweakerIntegration.LATE_REMOVALS - .add(new RemoveMekanismRecipe(NAME, - Recipe.CHEMICAL_INFUSER, new IngredientWrapper(gasOutput), + .add(new RemoveMekanismRecipe<>(NAME, Recipe.CHEMICAL_INFUSER, new IngredientWrapper(gasOutput), new IngredientWrapper(leftGasInput, rightGasInput))); } } @ZenMethod public static void removeAllRecipes() { - CrafttweakerIntegration.LATE_REMOVALS - .add(new RemoveAllMekanismRecipe(NAME, Recipe.CHEMICAL_INFUSER)); + CrafttweakerIntegration.LATE_REMOVALS.add(new RemoveAllMekanismRecipe<>(NAME, Recipe.CHEMICAL_INFUSER)); } } \ No newline at end of file diff --git a/src/main/java/mekanism/common/integration/crafttweaker/handlers/ChemicalInjection.java b/src/main/java/mekanism/common/integration/crafttweaker/handlers/ChemicalInjection.java index 799a4d80d..c36a4e836 100644 --- a/src/main/java/mekanism/common/integration/crafttweaker/handlers/ChemicalInjection.java +++ b/src/main/java/mekanism/common/integration/crafttweaker/handlers/ChemicalInjection.java @@ -30,7 +30,7 @@ public class ChemicalInjection { public static void addRecipe(IItemStack itemInput, IGasStack gasInput, IItemStack itemOutput) { if (IngredientHelper.checkNotNull(NAME, itemInput, gasInput, itemOutput)) { CrafttweakerIntegration.LATE_ADDITIONS - .add(new AddMekanismRecipe(NAME, Recipe.CHEMICAL_INJECTION_CHAMBER, + .add(new AddMekanismRecipe<>(NAME, Recipe.CHEMICAL_INJECTION_CHAMBER, new InjectionRecipe(new AdvancedMachineInput(IngredientHelper.toStack(itemInput), GasHelper.toGas(gasInput).getGas()), new ItemStackOutput(IngredientHelper.toStack(itemOutput))))); @@ -42,15 +42,14 @@ public class ChemicalInjection { @Optional IIngredient gasInput) { if (IngredientHelper.checkNotNull(NAME, itemOutput)) { CrafttweakerIntegration.LATE_REMOVALS - .add(new RemoveMekanismRecipe(NAME, - Recipe.CHEMICAL_INJECTION_CHAMBER, new IngredientWrapper(itemOutput), - new IngredientWrapper(itemInput, gasInput))); + .add(new RemoveMekanismRecipe<>(NAME, Recipe.CHEMICAL_INJECTION_CHAMBER, + new IngredientWrapper(itemOutput), new IngredientWrapper(itemInput, gasInput))); } } @ZenMethod public static void removeAllRecipes() { CrafttweakerIntegration.LATE_REMOVALS - .add(new RemoveAllMekanismRecipe(NAME, Recipe.CHEMICAL_INJECTION_CHAMBER)); + .add(new RemoveAllMekanismRecipe<>(NAME, Recipe.CHEMICAL_INJECTION_CHAMBER)); } } \ No newline at end of file diff --git a/src/main/java/mekanism/common/integration/crafttweaker/handlers/ChemicalOxidizer.java b/src/main/java/mekanism/common/integration/crafttweaker/handlers/ChemicalOxidizer.java index 8685b2006..f4b07da3d 100644 --- a/src/main/java/mekanism/common/integration/crafttweaker/handlers/ChemicalOxidizer.java +++ b/src/main/java/mekanism/common/integration/crafttweaker/handlers/ChemicalOxidizer.java @@ -13,9 +13,7 @@ import mekanism.common.integration.crafttweaker.util.IngredientWrapper; import mekanism.common.integration.crafttweaker.util.RemoveAllMekanismRecipe; import mekanism.common.integration.crafttweaker.util.RemoveMekanismRecipe; import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.inputs.ItemStackInput; import mekanism.common.recipe.machines.OxidationRecipe; -import mekanism.common.recipe.outputs.GasOutput; import stanhebben.zenscript.annotations.Optional; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -30,7 +28,7 @@ public class ChemicalOxidizer { public static void addRecipe(IItemStack itemInput, IGasStack gasOutput) { if (IngredientHelper.checkNotNull(NAME, itemInput, gasOutput)) { CrafttweakerIntegration.LATE_ADDITIONS - .add(new AddMekanismRecipe(NAME, Recipe.CHEMICAL_OXIDIZER, + .add(new AddMekanismRecipe<>(NAME, Recipe.CHEMICAL_OXIDIZER, new OxidationRecipe(IngredientHelper.toStack(itemInput), GasHelper.toGas(gasOutput)))); } } @@ -39,14 +37,13 @@ public class ChemicalOxidizer { public static void removeRecipe(IIngredient gasOutput, @Optional IIngredient itemInput) { if (IngredientHelper.checkNotNull(NAME, gasOutput)) { CrafttweakerIntegration.LATE_REMOVALS - .add(new RemoveMekanismRecipe(NAME, - Recipe.CHEMICAL_OXIDIZER, new IngredientWrapper(gasOutput), new IngredientWrapper(itemInput))); + .add(new RemoveMekanismRecipe<>(NAME, Recipe.CHEMICAL_OXIDIZER, new IngredientWrapper(gasOutput), + new IngredientWrapper(itemInput))); } } @ZenMethod public static void removeAllRecipes() { - CrafttweakerIntegration.LATE_REMOVALS - .add(new RemoveAllMekanismRecipe(NAME, Recipe.CHEMICAL_OXIDIZER)); + CrafttweakerIntegration.LATE_REMOVALS.add(new RemoveAllMekanismRecipe<>(NAME, Recipe.CHEMICAL_OXIDIZER)); } } \ No newline at end of file diff --git a/src/main/java/mekanism/common/integration/crafttweaker/handlers/ChemicalWasher.java b/src/main/java/mekanism/common/integration/crafttweaker/handlers/ChemicalWasher.java index ce7f745cc..f2e14f1b3 100644 --- a/src/main/java/mekanism/common/integration/crafttweaker/handlers/ChemicalWasher.java +++ b/src/main/java/mekanism/common/integration/crafttweaker/handlers/ChemicalWasher.java @@ -12,9 +12,7 @@ import mekanism.common.integration.crafttweaker.util.IngredientWrapper; import mekanism.common.integration.crafttweaker.util.RemoveAllMekanismRecipe; import mekanism.common.integration.crafttweaker.util.RemoveMekanismRecipe; import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.inputs.GasInput; import mekanism.common.recipe.machines.WasherRecipe; -import mekanism.common.recipe.outputs.GasOutput; import stanhebben.zenscript.annotations.Optional; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -28,7 +26,7 @@ public class ChemicalWasher { @ZenMethod public static void addRecipe(IGasStack gasInput, IGasStack gasOutput) { if (IngredientHelper.checkNotNull(NAME, gasInput, gasOutput)) { - CrafttweakerIntegration.LATE_ADDITIONS.add(new AddMekanismRecipe(NAME, Recipe.CHEMICAL_WASHER, + CrafttweakerIntegration.LATE_ADDITIONS.add(new AddMekanismRecipe<>(NAME, Recipe.CHEMICAL_WASHER, new WasherRecipe(GasHelper.toGas(gasInput), GasHelper.toGas(gasOutput)))); } } @@ -36,14 +34,14 @@ public class ChemicalWasher { @ZenMethod public static void removeRecipe(IIngredient gasOutput, @Optional IIngredient gasInput) { if (IngredientHelper.checkNotNull(NAME, gasOutput)) { - CrafttweakerIntegration.LATE_REMOVALS.add(new RemoveMekanismRecipe(NAME, - Recipe.CHEMICAL_WASHER, new IngredientWrapper(gasOutput), new IngredientWrapper(gasInput))); + CrafttweakerIntegration.LATE_REMOVALS + .add(new RemoveMekanismRecipe<>(NAME, Recipe.CHEMICAL_WASHER, new IngredientWrapper(gasOutput), + new IngredientWrapper(gasInput))); } } @ZenMethod public static void removeAllRecipes() { - CrafttweakerIntegration.LATE_REMOVALS - .add(new RemoveAllMekanismRecipe(NAME, Recipe.CHEMICAL_WASHER)); + CrafttweakerIntegration.LATE_REMOVALS.add(new RemoveAllMekanismRecipe<>(NAME, Recipe.CHEMICAL_WASHER)); } } \ No newline at end of file diff --git a/src/main/java/mekanism/common/integration/crafttweaker/handlers/Combiner.java b/src/main/java/mekanism/common/integration/crafttweaker/handlers/Combiner.java index 3f1ea4894..e9c53be7b 100644 --- a/src/main/java/mekanism/common/integration/crafttweaker/handlers/Combiner.java +++ b/src/main/java/mekanism/common/integration/crafttweaker/handlers/Combiner.java @@ -27,9 +27,11 @@ public class Combiner { @ZenMethod public static void addRecipe(IItemStack itemInput, IItemStack extraInput, IItemStack itemOutput) { if (IngredientHelper.checkNotNull(NAME, itemInput, extraInput, itemOutput)) { - CrafttweakerIntegration.LATE_ADDITIONS.add(new AddMekanismRecipe(NAME, Recipe.COMBINER, new CombinerRecipe( - new DoubleMachineInput(IngredientHelper.toStack(itemInput), IngredientHelper.toStack(extraInput)), - new ItemStackOutput(IngredientHelper.toStack(itemOutput))))); + CrafttweakerIntegration.LATE_ADDITIONS + .add(new AddMekanismRecipe<>(NAME, Recipe.COMBINER, new CombinerRecipe( + new DoubleMachineInput(IngredientHelper.toStack(itemInput), + IngredientHelper.toStack(extraInput)), + new ItemStackOutput(IngredientHelper.toStack(itemOutput))))); } } @@ -41,7 +43,7 @@ public class Combiner { @Deprecated public static void addRecipe(IItemStack itemInput, IItemStack itemOutput) { if (IngredientHelper.checkNotNull(NAME, itemInput, itemOutput)) { - CrafttweakerIntegration.LATE_ADDITIONS.add(new AddMekanismRecipe(NAME, Recipe.COMBINER, + CrafttweakerIntegration.LATE_ADDITIONS.add(new AddMekanismRecipe<>(NAME, Recipe.COMBINER, new CombinerRecipe(IngredientHelper.toStack(itemInput), IngredientHelper.toStack(itemOutput)))); } } @@ -51,14 +53,13 @@ public class Combiner { @Optional IIngredient extraInput) { if (IngredientHelper.checkNotNull(NAME, itemOutput)) { CrafttweakerIntegration.LATE_REMOVALS - .add(new RemoveMekanismRecipe(NAME, - Recipe.COMBINER, new IngredientWrapper(itemOutput), + .add(new RemoveMekanismRecipe<>(NAME, Recipe.COMBINER, new IngredientWrapper(itemOutput), new IngredientWrapper(itemInput, extraInput))); } } @ZenMethod public static void removeAllRecipes() { - CrafttweakerIntegration.LATE_REMOVALS.add(new RemoveAllMekanismRecipe(NAME, Recipe.COMBINER)); + CrafttweakerIntegration.LATE_REMOVALS.add(new RemoveAllMekanismRecipe<>(NAME, Recipe.COMBINER)); } } \ No newline at end of file diff --git a/src/main/java/mekanism/common/integration/crafttweaker/handlers/Compressor.java b/src/main/java/mekanism/common/integration/crafttweaker/handlers/Compressor.java index 76847f7e3..d061d5971 100644 --- a/src/main/java/mekanism/common/integration/crafttweaker/handlers/Compressor.java +++ b/src/main/java/mekanism/common/integration/crafttweaker/handlers/Compressor.java @@ -30,7 +30,7 @@ public class Compressor { public static void addRecipe(IItemStack itemInput, IItemStack itemOutput) { if (IngredientHelper.checkNotNull(NAME, itemInput, itemOutput)) { CrafttweakerIntegration.LATE_ADDITIONS - .add(new AddMekanismRecipe(NAME, Recipe.OSMIUM_COMPRESSOR, + .add(new AddMekanismRecipe<>(NAME, Recipe.OSMIUM_COMPRESSOR, new OsmiumCompressorRecipe(IngredientHelper.toStack(itemInput), IngredientHelper.toStack(itemOutput)))); } @@ -40,7 +40,7 @@ public class Compressor { public static void addRecipe(IItemStack itemInput, IGasStack gasInput, IItemStack itemOutput) { if (IngredientHelper.checkNotNull(NAME, itemInput, gasInput, itemOutput)) { CrafttweakerIntegration.LATE_ADDITIONS - .add(new AddMekanismRecipe(NAME, Recipe.OSMIUM_COMPRESSOR, + .add(new AddMekanismRecipe<>(NAME, Recipe.OSMIUM_COMPRESSOR, new OsmiumCompressorRecipe(new AdvancedMachineInput(IngredientHelper.toStack(itemInput), GasHelper.toGas(gasInput).getGas()), new ItemStackOutput(IngredientHelper.toStack(itemOutput))))); @@ -52,15 +52,13 @@ public class Compressor { @Optional IIngredient gasInput) { if (IngredientHelper.checkNotNull(NAME, itemOutput)) { CrafttweakerIntegration.LATE_REMOVALS - .add(new RemoveMekanismRecipe(NAME, - Recipe.OSMIUM_COMPRESSOR, new IngredientWrapper(itemOutput), + .add(new RemoveMekanismRecipe<>(NAME, Recipe.OSMIUM_COMPRESSOR, new IngredientWrapper(itemOutput), new IngredientWrapper(itemInput, gasInput))); } } @ZenMethod public static void removeAllRecipes() { - CrafttweakerIntegration.LATE_REMOVALS - .add(new RemoveAllMekanismRecipe(NAME, Recipe.OSMIUM_COMPRESSOR)); + CrafttweakerIntegration.LATE_REMOVALS.add(new RemoveAllMekanismRecipe<>(NAME, Recipe.OSMIUM_COMPRESSOR)); } } \ No newline at end of file diff --git a/src/main/java/mekanism/common/integration/crafttweaker/handlers/Crusher.java b/src/main/java/mekanism/common/integration/crafttweaker/handlers/Crusher.java index ef6f91a80..625acd153 100644 --- a/src/main/java/mekanism/common/integration/crafttweaker/handlers/Crusher.java +++ b/src/main/java/mekanism/common/integration/crafttweaker/handlers/Crusher.java @@ -11,9 +11,7 @@ import mekanism.common.integration.crafttweaker.util.IngredientWrapper; import mekanism.common.integration.crafttweaker.util.RemoveAllMekanismRecipe; import mekanism.common.integration.crafttweaker.util.RemoveMekanismRecipe; import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.inputs.ItemStackInput; import mekanism.common.recipe.machines.CrusherRecipe; -import mekanism.common.recipe.outputs.ItemStackOutput; import stanhebben.zenscript.annotations.Optional; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -27,7 +25,7 @@ public class Crusher { @ZenMethod public static void addRecipe(IItemStack itemInput, IItemStack itemOutput) { if (IngredientHelper.checkNotNull(NAME, itemInput, itemOutput)) { - CrafttweakerIntegration.LATE_ADDITIONS.add(new AddMekanismRecipe(NAME, Recipe.CRUSHER, + CrafttweakerIntegration.LATE_ADDITIONS.add(new AddMekanismRecipe<>(NAME, Recipe.CRUSHER, new CrusherRecipe(IngredientHelper.toStack(itemInput), IngredientHelper.toStack(itemOutput)))); } } @@ -36,14 +34,13 @@ public class Crusher { public static void removeRecipe(IIngredient itemOutput, @Optional IIngredient itemInput) { if (IngredientHelper.checkNotNull(NAME, itemOutput)) { CrafttweakerIntegration.LATE_REMOVALS - .add(new RemoveMekanismRecipe(NAME, - Recipe.CRUSHER, new IngredientWrapper(itemOutput), + .add(new RemoveMekanismRecipe<>(NAME, Recipe.CRUSHER, new IngredientWrapper(itemOutput), new IngredientWrapper(itemInput))); } } @ZenMethod public static void removeAllRecipes() { - CrafttweakerIntegration.LATE_REMOVALS.add(new RemoveAllMekanismRecipe(NAME, Recipe.CRUSHER)); + CrafttweakerIntegration.LATE_REMOVALS.add(new RemoveAllMekanismRecipe<>(NAME, Recipe.CRUSHER)); } } \ No newline at end of file diff --git a/src/main/java/mekanism/common/integration/crafttweaker/handlers/EnergizedSmelter.java b/src/main/java/mekanism/common/integration/crafttweaker/handlers/EnergizedSmelter.java index 1f39e8fb3..b6e321743 100644 --- a/src/main/java/mekanism/common/integration/crafttweaker/handlers/EnergizedSmelter.java +++ b/src/main/java/mekanism/common/integration/crafttweaker/handlers/EnergizedSmelter.java @@ -11,9 +11,7 @@ import mekanism.common.integration.crafttweaker.util.IngredientWrapper; import mekanism.common.integration.crafttweaker.util.RemoveAllMekanismRecipe; import mekanism.common.integration.crafttweaker.util.RemoveMekanismRecipe; import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.inputs.ItemStackInput; import mekanism.common.recipe.machines.SmeltingRecipe; -import mekanism.common.recipe.outputs.ItemStackOutput; import stanhebben.zenscript.annotations.Optional; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -38,7 +36,7 @@ public class EnergizedSmelter { public static void addRecipe(IItemStack itemInput, IItemStack itemOutput) { if (IngredientHelper.checkNotNull(NAME, itemInput, itemOutput)) { CrafttweakerIntegration.LATE_ADDITIONS - .add(new AddMekanismRecipe(NAME, Recipe.ENERGIZED_SMELTER, + .add(new AddMekanismRecipe<>(NAME, Recipe.ENERGIZED_SMELTER, new SmeltingRecipe(IngredientHelper.toStack(itemInput), IngredientHelper.toStack(itemOutput)))); addedRecipe = true; } @@ -48,8 +46,7 @@ public class EnergizedSmelter { public static void removeRecipe(IIngredient itemInput, @Optional IIngredient itemOutput) { if (IngredientHelper.checkNotNull(NAME, itemInput)) { CrafttweakerIntegration.LATE_REMOVALS - .add(new RemoveMekanismRecipe(NAME, - Recipe.ENERGIZED_SMELTER, new IngredientWrapper(itemOutput), + .add(new RemoveMekanismRecipe<>(NAME, Recipe.ENERGIZED_SMELTER, new IngredientWrapper(itemOutput), new IngredientWrapper(itemInput))); removedRecipe = true; } @@ -57,7 +54,6 @@ public class EnergizedSmelter { @ZenMethod public static void removeAllRecipes() { - CrafttweakerIntegration.LATE_REMOVALS - .add(new RemoveAllMekanismRecipe(NAME, Recipe.ENERGIZED_SMELTER)); + CrafttweakerIntegration.LATE_REMOVALS.add(new RemoveAllMekanismRecipe<>(NAME, Recipe.ENERGIZED_SMELTER)); } } \ No newline at end of file diff --git a/src/main/java/mekanism/common/integration/crafttweaker/handlers/Enrichment.java b/src/main/java/mekanism/common/integration/crafttweaker/handlers/Enrichment.java index b04d3a4ab..113366d68 100644 --- a/src/main/java/mekanism/common/integration/crafttweaker/handlers/Enrichment.java +++ b/src/main/java/mekanism/common/integration/crafttweaker/handlers/Enrichment.java @@ -11,9 +11,7 @@ import mekanism.common.integration.crafttweaker.util.IngredientWrapper; import mekanism.common.integration.crafttweaker.util.RemoveAllMekanismRecipe; import mekanism.common.integration.crafttweaker.util.RemoveMekanismRecipe; import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.inputs.ItemStackInput; import mekanism.common.recipe.machines.EnrichmentRecipe; -import mekanism.common.recipe.outputs.ItemStackOutput; import stanhebben.zenscript.annotations.Optional; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -28,7 +26,7 @@ public class Enrichment { public static void addRecipe(IItemStack itemInput, IItemStack itemOutput) { if (IngredientHelper.checkNotNull(NAME, itemInput, itemOutput)) { CrafttweakerIntegration.LATE_ADDITIONS - .add(new AddMekanismRecipe(NAME, Recipe.ENRICHMENT_CHAMBER, + .add(new AddMekanismRecipe<>(NAME, Recipe.ENRICHMENT_CHAMBER, new EnrichmentRecipe(IngredientHelper.toStack(itemInput), IngredientHelper.toStack(itemOutput)))); } @@ -38,15 +36,13 @@ public class Enrichment { public static void removeRecipe(IIngredient itemInput, @Optional IIngredient itemOutput) { if (IngredientHelper.checkNotNull(NAME, itemInput)) { CrafttweakerIntegration.LATE_REMOVALS - .add(new RemoveMekanismRecipe(NAME, - Recipe.ENRICHMENT_CHAMBER, new IngredientWrapper(itemOutput), + .add(new RemoveMekanismRecipe<>(NAME, Recipe.ENRICHMENT_CHAMBER, new IngredientWrapper(itemOutput), new IngredientWrapper(itemInput))); } } @ZenMethod public static void removeAllRecipes() { - CrafttweakerIntegration.LATE_REMOVALS - .add(new RemoveAllMekanismRecipe(NAME, Recipe.ENRICHMENT_CHAMBER)); + CrafttweakerIntegration.LATE_REMOVALS.add(new RemoveAllMekanismRecipe<>(NAME, Recipe.ENRICHMENT_CHAMBER)); } } \ No newline at end of file diff --git a/src/main/java/mekanism/common/integration/crafttweaker/handlers/Infuser.java b/src/main/java/mekanism/common/integration/crafttweaker/handlers/Infuser.java index 2e140f200..6815a4d8f 100644 --- a/src/main/java/mekanism/common/integration/crafttweaker/handlers/Infuser.java +++ b/src/main/java/mekanism/common/integration/crafttweaker/handlers/Infuser.java @@ -34,7 +34,7 @@ public class Infuser { } if (IngredientHelper.checkNotNull(NAME, itemInput, itemOutput)) { CrafttweakerIntegration.LATE_ADDITIONS - .add(new AddMekanismRecipe(NAME, Recipe.METALLURGIC_INFUSER, + .add(new AddMekanismRecipe<>(NAME, Recipe.METALLURGIC_INFUSER, new MetallurgicInfuserRecipe(new InfusionInput(InfuseRegistry.get(infuseType), infuseAmount, IngredientHelper.toStack(itemInput)), new ItemStackOutput(IngredientHelper.toStack(itemOutput))))); @@ -46,15 +46,13 @@ public class Infuser { @Optional String infuseType) { if (IngredientHelper.checkNotNull(NAME, itemOutput)) { CrafttweakerIntegration.LATE_REMOVALS - .add(new RemoveMekanismRecipe(NAME, - Recipe.METALLURGIC_INFUSER, new IngredientWrapper(itemOutput), + .add(new RemoveMekanismRecipe<>(NAME, Recipe.METALLURGIC_INFUSER, new IngredientWrapper(itemOutput), new IngredientWrapper(itemInput, infuseType))); } } @ZenMethod public static void removeAllRecipes() { - CrafttweakerIntegration.LATE_REMOVALS - .add(new RemoveAllMekanismRecipe(NAME, Recipe.CHEMICAL_CRYSTALLIZER)); + CrafttweakerIntegration.LATE_REMOVALS.add(new RemoveAllMekanismRecipe<>(NAME, Recipe.CHEMICAL_CRYSTALLIZER)); } } \ No newline at end of file diff --git a/src/main/java/mekanism/common/integration/crafttweaker/handlers/Purification.java b/src/main/java/mekanism/common/integration/crafttweaker/handlers/Purification.java index d4fa92ffc..a1ca94cd4 100644 --- a/src/main/java/mekanism/common/integration/crafttweaker/handlers/Purification.java +++ b/src/main/java/mekanism/common/integration/crafttweaker/handlers/Purification.java @@ -30,7 +30,7 @@ public class Purification { public static void addRecipe(IItemStack itemInput, IItemStack itemOutput) { if (IngredientHelper.checkNotNull(NAME, itemInput, itemOutput)) { CrafttweakerIntegration.LATE_ADDITIONS - .add(new AddMekanismRecipe(NAME, Recipe.PURIFICATION_CHAMBER, + .add(new AddMekanismRecipe<>(NAME, Recipe.PURIFICATION_CHAMBER, new PurificationRecipe(IngredientHelper.toStack(itemInput), IngredientHelper.toStack(itemOutput)))); } @@ -40,7 +40,7 @@ public class Purification { public static void addRecipe(IItemStack itemInput, IGasStack gasInput, IItemStack itemOutput) { if (IngredientHelper.checkNotNull(NAME, itemInput, gasInput, itemOutput)) { CrafttweakerIntegration.LATE_ADDITIONS - .add(new AddMekanismRecipe(NAME, Recipe.PURIFICATION_CHAMBER, + .add(new AddMekanismRecipe<>(NAME, Recipe.PURIFICATION_CHAMBER, new PurificationRecipe(new AdvancedMachineInput(IngredientHelper.toStack(itemInput), GasHelper.toGas(gasInput).getGas()), new ItemStackOutput(IngredientHelper.toStack(itemOutput))))); @@ -52,15 +52,13 @@ public class Purification { @Optional IIngredient gasInput) { if (IngredientHelper.checkNotNull(NAME, itemOutput)) { CrafttweakerIntegration.LATE_REMOVALS - .add(new RemoveMekanismRecipe(NAME, - Recipe.PURIFICATION_CHAMBER, new IngredientWrapper(itemOutput), + .add(new RemoveMekanismRecipe<>(NAME, Recipe.PURIFICATION_CHAMBER, new IngredientWrapper(itemOutput), new IngredientWrapper(itemInput, gasInput))); } } @ZenMethod public static void removeAllRecipes() { - CrafttweakerIntegration.LATE_REMOVALS - .add(new RemoveAllMekanismRecipe(NAME, Recipe.PURIFICATION_CHAMBER)); + CrafttweakerIntegration.LATE_REMOVALS.add(new RemoveAllMekanismRecipe<>(NAME, Recipe.PURIFICATION_CHAMBER)); } } \ No newline at end of file diff --git a/src/main/java/mekanism/common/integration/crafttweaker/handlers/Reaction.java b/src/main/java/mekanism/common/integration/crafttweaker/handlers/Reaction.java index da7cfce38..6b84378f9 100644 --- a/src/main/java/mekanism/common/integration/crafttweaker/handlers/Reaction.java +++ b/src/main/java/mekanism/common/integration/crafttweaker/handlers/Reaction.java @@ -32,7 +32,7 @@ public class Reaction { IItemStack itemOutput, IGasStack gasOutput, double energy, int duration) { if (IngredientHelper.checkNotNull(NAME, itemInput, liquidInput, gasInput, itemOutput, gasOutput)) { CrafttweakerIntegration.LATE_ADDITIONS - .add(new AddMekanismRecipe(NAME, Recipe.PRESSURIZED_REACTION_CHAMBER, + .add(new AddMekanismRecipe<>(NAME, Recipe.PRESSURIZED_REACTION_CHAMBER, new PressurizedRecipe( new PressurizedInput(IngredientHelper.toStack(itemInput), IngredientHelper.toFluid(liquidInput), GasHelper.toGas(gasInput)), @@ -46,8 +46,8 @@ public class Reaction { @Optional IIngredient liquidInput, @Optional IIngredient gasInput) { if (IngredientHelper.checkNotNull(NAME, itemOutput, gasOutput)) { CrafttweakerIntegration.LATE_REMOVALS - .add(new RemoveMekanismRecipe(NAME, - Recipe.PRESSURIZED_REACTION_CHAMBER, new IngredientWrapper(itemOutput, gasOutput), + .add(new RemoveMekanismRecipe<>(NAME, Recipe.PRESSURIZED_REACTION_CHAMBER, + new IngredientWrapper(itemOutput, gasOutput), new IngredientWrapper(itemInput, liquidInput, gasInput))); } } @@ -55,6 +55,6 @@ public class Reaction { @ZenMethod public static void removeAllRecipes() { CrafttweakerIntegration.LATE_REMOVALS - .add(new RemoveAllMekanismRecipe(NAME, Recipe.PRESSURIZED_REACTION_CHAMBER)); + .add(new RemoveAllMekanismRecipe<>(NAME, Recipe.PRESSURIZED_REACTION_CHAMBER)); } } \ No newline at end of file diff --git a/src/main/java/mekanism/common/integration/crafttweaker/handlers/Sawmill.java b/src/main/java/mekanism/common/integration/crafttweaker/handlers/Sawmill.java index 8e1b85445..5f8b5b7f6 100644 --- a/src/main/java/mekanism/common/integration/crafttweaker/handlers/Sawmill.java +++ b/src/main/java/mekanism/common/integration/crafttweaker/handlers/Sawmill.java @@ -29,7 +29,7 @@ public class Sawmill { @Optional double optionalChance) { if (IngredientHelper.checkNotNull(NAME, itemInput, itemOutput)) { CrafttweakerIntegration.LATE_ADDITIONS - .add(new AddMekanismRecipe(NAME, Recipe.PRECISION_SAWMILL, + .add(new AddMekanismRecipe<>(NAME, Recipe.PRECISION_SAWMILL, new SawmillRecipe(new ItemStackInput(IngredientHelper.toStack(itemInput)), optionalItemOutput == null ? new ChanceOutput(IngredientHelper.toStack(itemOutput)) : new ChanceOutput(IngredientHelper.toStack(itemOutput), @@ -42,15 +42,13 @@ public class Sawmill { @Optional IIngredient optionalItemOutput) { if (IngredientHelper.checkNotNull(NAME, itemInput)) { CrafttweakerIntegration.LATE_REMOVALS - .add(new RemoveMekanismRecipe(NAME, - Recipe.PRECISION_SAWMILL, new IngredientWrapper(itemOutput, optionalItemOutput), - new IngredientWrapper(itemInput))); + .add(new RemoveMekanismRecipe<>(NAME, Recipe.PRECISION_SAWMILL, + new IngredientWrapper(itemOutput, optionalItemOutput), new IngredientWrapper(itemInput))); } } @ZenMethod public static void removeAllRecipes() { - CrafttweakerIntegration.LATE_REMOVALS - .add(new RemoveAllMekanismRecipe(NAME, Recipe.PRECISION_SAWMILL)); + CrafttweakerIntegration.LATE_REMOVALS.add(new RemoveAllMekanismRecipe<>(NAME, Recipe.PRECISION_SAWMILL)); } } \ No newline at end of file diff --git a/src/main/java/mekanism/common/integration/crafttweaker/handlers/Separator.java b/src/main/java/mekanism/common/integration/crafttweaker/handlers/Separator.java index 482e7a4ae..dcabc823e 100644 --- a/src/main/java/mekanism/common/integration/crafttweaker/handlers/Separator.java +++ b/src/main/java/mekanism/common/integration/crafttweaker/handlers/Separator.java @@ -13,9 +13,7 @@ import mekanism.common.integration.crafttweaker.util.IngredientWrapper; import mekanism.common.integration.crafttweaker.util.RemoveAllMekanismRecipe; import mekanism.common.integration.crafttweaker.util.RemoveMekanismRecipe; import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.inputs.FluidInput; import mekanism.common.recipe.machines.SeparatorRecipe; -import mekanism.common.recipe.outputs.ChemicalPairOutput; import stanhebben.zenscript.annotations.Optional; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -31,7 +29,7 @@ public class Separator { IGasStack rightGasOutput) { if (IngredientHelper.checkNotNull(NAME, liquidInput, leftGasOutput, rightGasOutput)) { CrafttweakerIntegration.LATE_ADDITIONS - .add(new AddMekanismRecipe(NAME, Recipe.ELECTROLYTIC_SEPARATOR, + .add(new AddMekanismRecipe<>(NAME, Recipe.ELECTROLYTIC_SEPARATOR, new SeparatorRecipe(IngredientHelper.toFluid(liquidInput), energy, GasHelper.toGas(leftGasOutput), GasHelper.toGas(rightGasOutput)))); } @@ -42,15 +40,13 @@ public class Separator { @Optional IIngredient rightGasOutput) { if (IngredientHelper.checkNotNull(NAME, liquidInput)) { CrafttweakerIntegration.LATE_REMOVALS - .add(new RemoveMekanismRecipe(NAME, - Recipe.ELECTROLYTIC_SEPARATOR, new IngredientWrapper(leftGasOutput, rightGasOutput), - new IngredientWrapper(liquidInput))); + .add(new RemoveMekanismRecipe<>(NAME, Recipe.ELECTROLYTIC_SEPARATOR, + new IngredientWrapper(leftGasOutput, rightGasOutput), new IngredientWrapper(liquidInput))); } } @ZenMethod public static void removeAllRecipes() { - CrafttweakerIntegration.LATE_REMOVALS - .add(new RemoveAllMekanismRecipe(NAME, Recipe.ELECTROLYTIC_SEPARATOR)); + CrafttweakerIntegration.LATE_REMOVALS.add(new RemoveAllMekanismRecipe<>(NAME, Recipe.ELECTROLYTIC_SEPARATOR)); } } \ No newline at end of file diff --git a/src/main/java/mekanism/common/integration/crafttweaker/handlers/SolarNeutronActivator.java b/src/main/java/mekanism/common/integration/crafttweaker/handlers/SolarNeutronActivator.java index 10f156ee7..6d6afd95a 100644 --- a/src/main/java/mekanism/common/integration/crafttweaker/handlers/SolarNeutronActivator.java +++ b/src/main/java/mekanism/common/integration/crafttweaker/handlers/SolarNeutronActivator.java @@ -12,9 +12,7 @@ import mekanism.common.integration.crafttweaker.util.IngredientWrapper; import mekanism.common.integration.crafttweaker.util.RemoveAllMekanismRecipe; import mekanism.common.integration.crafttweaker.util.RemoveMekanismRecipe; import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.inputs.GasInput; import mekanism.common.recipe.machines.SolarNeutronRecipe; -import mekanism.common.recipe.outputs.GasOutput; import stanhebben.zenscript.annotations.Optional; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -29,7 +27,7 @@ public class SolarNeutronActivator { public static void addRecipe(IGasStack gasInput, IGasStack gasOutput) { if (IngredientHelper.checkNotNull(NAME, gasInput, gasOutput)) { CrafttweakerIntegration.LATE_ADDITIONS - .add(new AddMekanismRecipe(NAME, Recipe.SOLAR_NEUTRON_ACTIVATOR, + .add(new AddMekanismRecipe<>(NAME, Recipe.SOLAR_NEUTRON_ACTIVATOR, new SolarNeutronRecipe(GasHelper.toGas(gasInput), GasHelper.toGas(gasOutput)))); } } @@ -38,15 +36,13 @@ public class SolarNeutronActivator { public static void removeRecipe(IIngredient gasInput, @Optional IIngredient gasOutput) { if (IngredientHelper.checkNotNull(NAME, gasInput)) { CrafttweakerIntegration.LATE_REMOVALS - .add(new RemoveMekanismRecipe(NAME, - Recipe.SOLAR_NEUTRON_ACTIVATOR, new IngredientWrapper(gasOutput), - new IngredientWrapper(gasInput))); + .add(new RemoveMekanismRecipe<>(NAME, Recipe.SOLAR_NEUTRON_ACTIVATOR, + new IngredientWrapper(gasOutput), new IngredientWrapper(gasInput))); } } @ZenMethod public static void removeAllRecipes() { - CrafttweakerIntegration.LATE_REMOVALS - .add(new RemoveAllMekanismRecipe(NAME, Recipe.SOLAR_NEUTRON_ACTIVATOR)); + CrafttweakerIntegration.LATE_REMOVALS.add(new RemoveAllMekanismRecipe<>(NAME, Recipe.SOLAR_NEUTRON_ACTIVATOR)); } } \ No newline at end of file diff --git a/src/main/java/mekanism/common/integration/crafttweaker/handlers/ThermalEvaporation.java b/src/main/java/mekanism/common/integration/crafttweaker/handlers/ThermalEvaporation.java index bf6fd065c..4ce459018 100644 --- a/src/main/java/mekanism/common/integration/crafttweaker/handlers/ThermalEvaporation.java +++ b/src/main/java/mekanism/common/integration/crafttweaker/handlers/ThermalEvaporation.java @@ -11,9 +11,7 @@ import mekanism.common.integration.crafttweaker.util.IngredientWrapper; import mekanism.common.integration.crafttweaker.util.RemoveAllMekanismRecipe; import mekanism.common.integration.crafttweaker.util.RemoveMekanismRecipe; import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.inputs.FluidInput; import mekanism.common.recipe.machines.ThermalEvaporationRecipe; -import mekanism.common.recipe.outputs.FluidOutput; import stanhebben.zenscript.annotations.Optional; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -28,7 +26,7 @@ public class ThermalEvaporation { public static void addRecipe(ILiquidStack liquidInput, ILiquidStack liquidOutput) { if (IngredientHelper.checkNotNull(NAME, liquidInput, liquidOutput)) { CrafttweakerIntegration.LATE_ADDITIONS - .add(new AddMekanismRecipe(NAME, Recipe.THERMAL_EVAPORATION_PLANT, + .add(new AddMekanismRecipe<>(NAME, Recipe.THERMAL_EVAPORATION_PLANT, new ThermalEvaporationRecipe(IngredientHelper.toFluid(liquidInput), IngredientHelper.toFluid(liquidOutput)))); } @@ -38,15 +36,14 @@ public class ThermalEvaporation { public static void removeRecipe(IIngredient liquidInput, @Optional IIngredient liquidOutput) { if (IngredientHelper.checkNotNull(NAME, liquidInput)) { CrafttweakerIntegration.LATE_REMOVALS - .add(new RemoveMekanismRecipe(NAME, - Recipe.THERMAL_EVAPORATION_PLANT, new IngredientWrapper(liquidOutput), - new IngredientWrapper(liquidInput))); + .add(new RemoveMekanismRecipe<>(NAME, Recipe.THERMAL_EVAPORATION_PLANT, + new IngredientWrapper(liquidOutput), new IngredientWrapper(liquidInput))); } } @ZenMethod public static void removeAllRecipes() { CrafttweakerIntegration.LATE_REMOVALS - .add(new RemoveAllMekanismRecipe(NAME, Recipe.THERMAL_EVAPORATION_PLANT)); + .add(new RemoveAllMekanismRecipe<>(NAME, Recipe.THERMAL_EVAPORATION_PLANT)); } } \ No newline at end of file diff --git a/src/main/java/mekanism/common/integration/crafttweaker/util/AddMekanismRecipe.java b/src/main/java/mekanism/common/integration/crafttweaker/util/AddMekanismRecipe.java index adab3f242..36f8f64de 100644 --- a/src/main/java/mekanism/common/integration/crafttweaker/util/AddMekanismRecipe.java +++ b/src/main/java/mekanism/common/integration/crafttweaker/util/AddMekanismRecipe.java @@ -3,10 +3,12 @@ package mekanism.common.integration.crafttweaker.util; import mekanism.common.recipe.RecipeHandler.Recipe; import mekanism.common.recipe.inputs.MachineInput; import mekanism.common.recipe.machines.MachineRecipe; +import mekanism.common.recipe.outputs.MachineOutput; -public class AddMekanismRecipe extends RecipeMapModification { +public class AddMekanismRecipe, OUTPUT extends MachineOutput, RECIPE extends MachineRecipe> extends + RecipeMapModification { - public AddMekanismRecipe(String name, Recipe recipeType, MachineRecipe recipe) { + public AddMekanismRecipe(String name, Recipe recipeType, RECIPE recipe) { super(name, true, recipeType); recipes.put(recipe.getInput(), recipe); } diff --git a/src/main/java/mekanism/common/integration/crafttweaker/util/RecipeMapModification.java b/src/main/java/mekanism/common/integration/crafttweaker/util/RecipeMapModification.java index e9c01315c..acc5a1525 100644 --- a/src/main/java/mekanism/common/integration/crafttweaker/util/RecipeMapModification.java +++ b/src/main/java/mekanism/common/integration/crafttweaker/util/RecipeMapModification.java @@ -13,14 +13,15 @@ import mekanism.common.recipe.RecipeHandler.Recipe; import mekanism.common.recipe.inputs.MachineInput; import mekanism.common.recipe.machines.MachineRecipe; -public abstract class RecipeMapModification implements IAction { +public abstract class RecipeMapModification, RECIPE extends MachineRecipe> implements + IAction { - protected final HashMap recipes; - protected final Map map; + protected final HashMap recipes; + protected final Map map; protected final String name; protected boolean add; - protected RecipeMapModification(String name, boolean add, Recipe recipeType) { + protected RecipeMapModification(String name, boolean add, Recipe recipeType) { this.name = name; this.map = recipeType.get(); this.add = add; @@ -31,16 +32,16 @@ public abstract class RecipeMapModification entry : recipes.entrySet()) { - K key = entry.getKey(); - V value = entry.getValue(); + for (Entry entry : recipes.entrySet()) { + INPUT key = entry.getKey(); + RECIPE value = entry.getValue(); if (map.put(key, value) != null) { CraftTweakerAPI.logInfo(String.format("Overwritten %s Recipe for %s", name, RecipeInfoHelper.getRecipeInfo(new AbstractMap.SimpleEntry<>(entry.getKey(), value)))); } } } else { - for (K key : recipes.keySet()) { + for (INPUT key : recipes.keySet()) { if (map.remove(key) == null) { CraftTweakerAPI.logError(String.format("Error removing %s Recipe : null object", name)); } @@ -61,5 +62,4 @@ public abstract class RecipeMapModification extends RecipeMapModification { +public class RemoveAllMekanismRecipe, OUTPUT extends MachineOutput, RECIPE extends MachineRecipe> extends + RecipeMapModification { - public RemoveAllMekanismRecipe(String name, Recipe recipeType) { + public RemoveAllMekanismRecipe(String name, Recipe recipeType) { super(name, false, recipeType); } diff --git a/src/main/java/mekanism/common/integration/crafttweaker/util/RemoveMekanismRecipe.java b/src/main/java/mekanism/common/integration/crafttweaker/util/RemoveMekanismRecipe.java index 25d6a9371..e8c25fb56 100644 --- a/src/main/java/mekanism/common/integration/crafttweaker/util/RemoveMekanismRecipe.java +++ b/src/main/java/mekanism/common/integration/crafttweaker/util/RemoveMekanismRecipe.java @@ -13,7 +13,8 @@ public class RemoveMekanismRecipe, OUTPUT exte private final IngredientWrapper input; private final IngredientWrapper output; - public RemoveMekanismRecipe(String name, Recipe recipeType, IngredientWrapper output, IngredientWrapper input) { + public RemoveMekanismRecipe(String name, Recipe recipeType, IngredientWrapper output, + IngredientWrapper input) { super(name, false, recipeType); this.input = input; this.output = output; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerMetallurgicInfuser.java b/src/main/java/mekanism/common/inventory/container/ContainerMetallurgicInfuser.java index 2f7b6d74e..bf76723b8 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerMetallurgicInfuser.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerMetallurgicInfuser.java @@ -82,15 +82,10 @@ public class ContainerMetallurgicInfuser extends ContainerMekanism input.inputStack.isItemEqual(itemStack)); } - return false; } @Override diff --git a/src/main/java/mekanism/common/recipe/RecipeHandler.java b/src/main/java/mekanism/common/recipe/RecipeHandler.java index 95604d65f..5a1f9d6db 100644 --- a/src/main/java/mekanism/common/recipe/RecipeHandler.java +++ b/src/main/java/mekanism/common/recipe/RecipeHandler.java @@ -6,7 +6,7 @@ import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; -import java.util.Set; +import java.util.Map.Entry; import mekanism.api.gas.Gas; import mekanism.api.gas.GasStack; import mekanism.api.infuse.InfuseType; @@ -296,7 +296,7 @@ public final class RecipeHandler { */ public static MetallurgicInfuserRecipe getMetallurgicInfuserRecipe(InfusionInput input) { if (input.isValid()) { - HashMap recipes = Recipe.METALLURGIC_INFUSER.get(); + Map recipes = Recipe.METALLURGIC_INFUSER.get(); MetallurgicInfuserRecipe recipe = recipes.get(input); @@ -318,7 +318,7 @@ public final class RecipeHandler { */ public static ChemicalInfuserRecipe getChemicalInfuserRecipe(ChemicalPairInput input) { if (input.isValid()) { - HashMap recipes = Recipe.CHEMICAL_INFUSER.get(); + Map recipes = Recipe.CHEMICAL_INFUSER.get(); ChemicalInfuserRecipe recipe = recipes.get(input); return recipe == null ? null : recipe.copy(); @@ -335,7 +335,7 @@ public final class RecipeHandler { */ public static CrystallizerRecipe getChemicalCrystallizerRecipe(GasInput input) { if (input.isValid()) { - HashMap recipes = Recipe.CHEMICAL_CRYSTALLIZER.get(); + Map recipes = Recipe.CHEMICAL_CRYSTALLIZER.get(); CrystallizerRecipe recipe = recipes.get(input); return recipe == null ? null : recipe.copy(); @@ -352,7 +352,7 @@ public final class RecipeHandler { */ public static WasherRecipe getChemicalWasherRecipe(GasInput input) { if (input.isValid()) { - HashMap recipes = Recipe.CHEMICAL_WASHER.get(); + Map recipes = Recipe.CHEMICAL_WASHER.get(); WasherRecipe recipe = recipes.get(input); return recipe == null ? null : recipe.copy(); @@ -369,7 +369,7 @@ public final class RecipeHandler { */ public static DissolutionRecipe getDissolutionRecipe(ItemStackInput input) { if (input.isValid()) { - HashMap recipes = Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get(); + Map recipes = Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get(); DissolutionRecipe recipe = getRecipeTryWildcard(input, recipes); return recipe == null ? null : recipe.copy(); @@ -386,7 +386,7 @@ public final class RecipeHandler { */ public static OxidationRecipe getOxidizerRecipe(ItemStackInput input) { if (input.isValid()) { - HashMap recipes = Recipe.CHEMICAL_OXIDIZER.get(); + Map recipes = Recipe.CHEMICAL_OXIDIZER.get(); OxidationRecipe recipe = getRecipeTryWildcard(input, recipes); return recipe == null ? null : recipe.copy(); @@ -482,7 +482,7 @@ public final class RecipeHandler { */ public static SeparatorRecipe getElectrolyticSeparatorRecipe(FluidInput input) { if (input.isValid()) { - HashMap recipes = Recipe.ELECTROLYTIC_SEPARATOR.get(); + Map recipes = Recipe.ELECTROLYTIC_SEPARATOR.get(); SeparatorRecipe recipe = recipes.get(input); return recipe == null ? null : recipe.copy(); @@ -493,7 +493,7 @@ public final class RecipeHandler { public static ThermalEvaporationRecipe getThermalEvaporationRecipe(FluidInput input) { if (input.isValid()) { - HashMap recipes = Recipe.THERMAL_EVAPORATION_PLANT.get(); + Map recipes = Recipe.THERMAL_EVAPORATION_PLANT.get(); ThermalEvaporationRecipe recipe = recipes.get(input); return recipe == null ? null : recipe.copy(); @@ -504,7 +504,7 @@ public final class RecipeHandler { public static SolarNeutronRecipe getSolarNeutronRecipe(GasInput input) { if (input.isValid()) { - HashMap recipes = Recipe.SOLAR_NEUTRON_ACTIVATOR.get(); + Map recipes = Recipe.SOLAR_NEUTRON_ACTIVATOR.get(); SolarNeutronRecipe recipe = recipes.get(input); return recipe == null ? null : recipe.copy(); @@ -515,7 +515,7 @@ public final class RecipeHandler { public static PressurizedRecipe getPRCRecipe(PressurizedInput input) { if (input.isValid()) { - HashMap recipes = Recipe.PRESSURIZED_REACTION_CHAMBER.get(); + Map recipes = Recipe.PRESSURIZED_REACTION_CHAMBER.get(); PressurizedRecipe recipe = recipes.get(input); @@ -530,7 +530,7 @@ public final class RecipeHandler { } public static AmbientGasRecipe getDimensionGas(IntegerInput input) { - HashMap recipes = Recipe.AMBIENT_ACCUMULATOR.get(); + Map recipes = Recipe.AMBIENT_ACCUMULATOR.get(); AmbientGasRecipe recipe = recipes.get(input); return recipe == null ? null : recipe.copy(); @@ -562,7 +562,7 @@ public final class RecipeHandler { public static boolean isInPressurizedRecipe(ItemStack stack) { if (!stack.isEmpty()) { - for (PressurizedInput key : (Set) Recipe.PRESSURIZED_REACTION_CHAMBER.get().keySet()) { + for (PressurizedInput key : Recipe.PRESSURIZED_REACTION_CHAMBER.get().keySet()) { if (key.containsType(stack)) { return true; } @@ -588,66 +588,113 @@ public final class RecipeHandler { return recipe; } - public enum Recipe { - ENERGIZED_SMELTER(MachineType.ENERGIZED_SMELTER.blockName, ItemStackInput.class, ItemStackOutput.class, - SmeltingRecipe.class), - ENRICHMENT_CHAMBER(MachineType.ENRICHMENT_CHAMBER.blockName, ItemStackInput.class, ItemStackOutput.class, - EnrichmentRecipe.class), - OSMIUM_COMPRESSOR(MachineType.OSMIUM_COMPRESSOR.blockName, AdvancedMachineInput.class, ItemStackOutput.class, - OsmiumCompressorRecipe.class), - COMBINER(MachineType.COMBINER.blockName, DoubleMachineInput.class, ItemStackOutput.class, CombinerRecipe.class), - CRUSHER(MachineType.CRUSHER.blockName, ItemStackInput.class, ItemStackOutput.class, CrusherRecipe.class), - PURIFICATION_CHAMBER(MachineType.PURIFICATION_CHAMBER.blockName, AdvancedMachineInput.class, - ItemStackOutput.class, PurificationRecipe.class), - METALLURGIC_INFUSER(MachineType.METALLURGIC_INFUSER.blockName, InfusionInput.class, ItemStackOutput.class, - MetallurgicInfuserRecipe.class), - CHEMICAL_INFUSER(MachineType.CHEMICAL_INFUSER.blockName, ChemicalPairInput.class, GasOutput.class, - ChemicalInfuserRecipe.class), - CHEMICAL_OXIDIZER(MachineType.CHEMICAL_OXIDIZER.blockName, ItemStackInput.class, GasOutput.class, - OxidationRecipe.class), - CHEMICAL_INJECTION_CHAMBER(MachineType.CHEMICAL_INJECTION_CHAMBER.blockName, AdvancedMachineInput.class, - ItemStackOutput.class, InjectionRecipe.class), - ELECTROLYTIC_SEPARATOR(MachineType.ELECTROLYTIC_SEPARATOR.blockName, FluidInput.class, ChemicalPairOutput.class, - SeparatorRecipe.class), - PRECISION_SAWMILL(MachineType.PRECISION_SAWMILL.blockName, ItemStackInput.class, ChanceOutput.class, - SawmillRecipe.class), - CHEMICAL_DISSOLUTION_CHAMBER(MachineType.CHEMICAL_DISSOLUTION_CHAMBER.blockName, ItemStackInput.class, - GasOutput.class, DissolutionRecipe.class), - CHEMICAL_WASHER(MachineType.CHEMICAL_WASHER.blockName, GasInput.class, GasOutput.class, WasherRecipe.class), - CHEMICAL_CRYSTALLIZER(MachineType.CHEMICAL_CRYSTALLIZER.blockName, GasInput.class, ItemStackOutput.class, - CrystallizerRecipe.class), - PRESSURIZED_REACTION_CHAMBER(MachineType.PRESSURIZED_REACTION_CHAMBER.blockName, PressurizedInput.class, - PressurizedOutput.class, PressurizedRecipe.class), - AMBIENT_ACCUMULATOR(MachineType.AMBIENT_ACCUMULATOR.blockName, IntegerInput.class, GasOutput.class, - AmbientGasRecipe.class), - THERMAL_EVAPORATION_PLANT("ThermalEvaporationPlant", FluidInput.class, FluidOutput.class, - ThermalEvaporationRecipe.class), - SOLAR_NEUTRON_ACTIVATOR(MachineType.SOLAR_NEUTRON_ACTIVATOR.blockName, GasInput.class, GasOutput.class, + public static class Recipe, OUTPUT extends MachineOutput, RECIPE extends MachineRecipe> { + + private static final List values = new ArrayList<>(); + + public static final Recipe ENERGIZED_SMELTER = new Recipe<>( + MachineType.ENERGIZED_SMELTER.blockName, ItemStackInput.class, ItemStackOutput.class, + SmeltingRecipe.class); + + public static final Recipe ENRICHMENT_CHAMBER = new Recipe<>( + MachineType.ENRICHMENT_CHAMBER.blockName, ItemStackInput.class, ItemStackOutput.class, + EnrichmentRecipe.class); + + public static final Recipe OSMIUM_COMPRESSOR = new Recipe<>( + MachineType.OSMIUM_COMPRESSOR.blockName, AdvancedMachineInput.class, ItemStackOutput.class, + OsmiumCompressorRecipe.class); + + public static final Recipe COMBINER = new Recipe<>( + MachineType.COMBINER.blockName, DoubleMachineInput.class, ItemStackOutput.class, CombinerRecipe.class); + + public static final Recipe CRUSHER = new Recipe<>( + MachineType.CRUSHER.blockName, ItemStackInput.class, ItemStackOutput.class, CrusherRecipe.class); + + public static final Recipe PURIFICATION_CHAMBER = new Recipe<>( + MachineType.PURIFICATION_CHAMBER.blockName, AdvancedMachineInput.class, + ItemStackOutput.class, PurificationRecipe.class); + + public static final Recipe METALLURGIC_INFUSER = new Recipe<>( + MachineType.METALLURGIC_INFUSER.blockName, InfusionInput.class, ItemStackOutput.class, + MetallurgicInfuserRecipe.class); + + public static final Recipe CHEMICAL_INFUSER = new Recipe<>( + MachineType.CHEMICAL_INFUSER.blockName, ChemicalPairInput.class, GasOutput.class, + ChemicalInfuserRecipe.class); + + public static final Recipe CHEMICAL_OXIDIZER = new Recipe<>( + MachineType.CHEMICAL_OXIDIZER.blockName, ItemStackInput.class, GasOutput.class, + OxidationRecipe.class); + + public static final Recipe CHEMICAL_INJECTION_CHAMBER = new Recipe<>( + MachineType.CHEMICAL_INJECTION_CHAMBER.blockName, AdvancedMachineInput.class, + ItemStackOutput.class, InjectionRecipe.class); + + public static final Recipe ELECTROLYTIC_SEPARATOR = new Recipe<>( + MachineType.ELECTROLYTIC_SEPARATOR.blockName, FluidInput.class, ChemicalPairOutput.class, + SeparatorRecipe.class); + + public static final Recipe PRECISION_SAWMILL = new Recipe<>( + MachineType.PRECISION_SAWMILL.blockName, ItemStackInput.class, ChanceOutput.class, + SawmillRecipe.class); + + public static final Recipe CHEMICAL_DISSOLUTION_CHAMBER = new Recipe<>( + MachineType.CHEMICAL_DISSOLUTION_CHAMBER.blockName, ItemStackInput.class, + GasOutput.class, DissolutionRecipe.class); + + public static final Recipe CHEMICAL_WASHER = new Recipe<>( + MachineType.CHEMICAL_WASHER.blockName, GasInput.class, GasOutput.class, WasherRecipe.class); + + public static final Recipe CHEMICAL_CRYSTALLIZER = new Recipe<>( + MachineType.CHEMICAL_CRYSTALLIZER.blockName, GasInput.class, ItemStackOutput.class, + CrystallizerRecipe.class); + + public static final Recipe PRESSURIZED_REACTION_CHAMBER = new Recipe<>( + MachineType.PRESSURIZED_REACTION_CHAMBER.blockName, PressurizedInput.class, + PressurizedOutput.class, PressurizedRecipe.class); + + public static final Recipe AMBIENT_ACCUMULATOR = new Recipe<>( + MachineType.AMBIENT_ACCUMULATOR.blockName, IntegerInput.class, GasOutput.class, + AmbientGasRecipe.class); + + public static final Recipe THERMAL_EVAPORATION_PLANT = new Recipe<>( + "ThermalEvaporationPlant", FluidInput.class, FluidOutput.class, + ThermalEvaporationRecipe.class); + + public static final Recipe SOLAR_NEUTRON_ACTIVATOR = new Recipe<>( + MachineType.SOLAR_NEUTRON_ACTIVATOR.blockName, GasInput.class, GasOutput.class, SolarNeutronRecipe.class); - private HashMap recipes; - private String recipeName; + //TODO: Replace this with Recipe being Iterable + public static List values() { + return values; + } + + private final Map recipes = new HashMap<>(); + private final String recipeName; + private final String jeiCategory; private Class inputClass; private Class outputClass; private Class recipeClass; - , OUTPUT extends MachineOutput, RECIPE extends MachineRecipe> Recipe( - String name, Class input, Class output, Class recipe) { + + private Recipe(String name, Class input, Class output, Class recipe) { recipeName = name; + jeiCategory = "mekanism." + recipeName.toLowerCase(Locale.ROOT); inputClass = input; outputClass = output; recipeClass = recipe; - recipes = new HashMap(); + values.add(this); } - public > void put(RECIPE recipe) { + public void put(RECIPE recipe) { recipes.put(recipe.getInput(), recipe); } - public > void remove(RECIPE recipe) { + public void remove(RECIPE recipe) { recipes.remove(recipe.getInput()); } @@ -655,11 +702,11 @@ public final class RecipeHandler { return recipeName; } - public String getName() { - return name().toLowerCase(Locale.ROOT); + public String getJEICategory() { + return jeiCategory; } - public INPUT createInput(NBTTagCompound nbtTags) { + public INPUT createInput(NBTTagCompound nbtTags) { try { MachineInput input = inputClass.newInstance(); input.load(nbtTags); @@ -670,7 +717,7 @@ public final class RecipeHandler { } } - public RECIPE createRecipe(INPUT input, NBTTagCompound nbtTags) { + public RECIPE createRecipe(INPUT input, NBTTagCompound nbtTags) { try { MachineOutput output = outputClass.newInstance(); output.load(nbtTags); @@ -691,26 +738,22 @@ public final class RecipeHandler { public boolean containsRecipe(ItemStack input) { //TODO: Support other input types - for (Object obj : get().entrySet()) { - if (obj instanceof Map.Entry) { - Map.Entry entry = (Map.Entry) obj; + for (Entry entry : recipes.entrySet()) { + if (entry.getKey() instanceof ItemStackInput) { + ItemStack stack = ((ItemStackInput) entry.getKey()).ingredient; - if (entry.getKey() instanceof ItemStackInput) { - ItemStack stack = ((ItemStackInput) entry.getKey()).ingredient; + if (StackUtils.equalsWildcard(stack, input)) { + return true; + } + } else if (entry.getKey() instanceof FluidInput) { + if (((FluidInput) entry.getKey()).ingredient.isFluidEqual(input)) { + return true; + } + } else if (entry.getKey() instanceof AdvancedMachineInput) { + ItemStack stack = ((AdvancedMachineInput) entry.getKey()).itemStack; - if (StackUtils.equalsWildcard(stack, input)) { - return true; - } - } else if (entry.getKey() instanceof FluidInput) { - if (((FluidInput) entry.getKey()).ingredient.isFluidEqual(input)) { - return true; - } - } else if (entry.getKey() instanceof AdvancedMachineInput) { - ItemStack stack = ((AdvancedMachineInput) entry.getKey()).itemStack; - - if (StackUtils.equalsWildcard(stack, input)) { - return true; - } + if (StackUtils.equalsWildcard(stack, input)) { + return true; } } } @@ -720,14 +763,10 @@ public final class RecipeHandler { public boolean containsRecipe(Fluid input) { //TODO: Support other input types - for (Object obj : get().entrySet()) { - if (obj instanceof Map.Entry) { - Map.Entry entry = (Map.Entry) obj; - - if (entry.getKey() instanceof FluidInput) { - if (((FluidInput) entry.getKey()).ingredient.getFluid() == input) { - return true; - } + for (Entry entry : recipes.entrySet()) { + if (entry.getKey() instanceof FluidInput) { + if (((FluidInput) entry.getKey()).ingredient.getFluid() == input) { + return true; } } } @@ -737,27 +776,36 @@ public final class RecipeHandler { public boolean containsRecipe(Gas input) { //TODO: Support other input types - for (Object obj : get().entrySet()) { - if (obj instanceof Map.Entry) { - Map.Entry entry = (Map.Entry) obj; - - Gas toCheck = null; - if (entry.getKey() instanceof GasInput) { - toCheck = ((GasInput) entry.getKey()).ingredient.getGas(); - } else if (entry.getKey() instanceof AdvancedMachineInput) { - toCheck = ((AdvancedMachineInput) entry.getKey()).gasType; - } - if (toCheck == input) { - return true; - } + for (Entry entry : recipes.entrySet()) { + Gas toCheck = null; + if (entry.getKey() instanceof GasInput) { + toCheck = ((GasInput) entry.getKey()).ingredient.getGas(); + } else if (entry.getKey() instanceof AdvancedMachineInput) { + toCheck = ((AdvancedMachineInput) entry.getKey()).gasType; + } + if (toCheck == input) { + return true; } } return false; } - public HashMap get() { + public Map get() { return recipes; } + + /*@Nullable + public RECIPE getRecipe(INPUT input) { + if (input.isValid()) { + RECIPE recipe; + recipe = recipes.get(input); + if (recipe == null && input instanceof ItemStackInput) { + recipe = recipes.get(((ItemStackInput) input).wildCopy()); + } + return recipe == null ? null : recipe.copy(); + } + return null; + }*/ } } diff --git a/src/main/java/mekanism/common/tile/TileEntityMetallurgicInfuser.java b/src/main/java/mekanism/common/tile/TileEntityMetallurgicInfuser.java index d92d4ce56..630b4b3e4 100644 --- a/src/main/java/mekanism/common/tile/TileEntityMetallurgicInfuser.java +++ b/src/main/java/mekanism/common/tile/TileEntityMetallurgicInfuser.java @@ -4,6 +4,7 @@ import io.netty.buffer.ByteBuf; import javax.annotation.Nonnull; import mekanism.api.EnumColor; import mekanism.api.IConfigCardAccess; +import mekanism.api.TileNetworkList; import mekanism.api.infuse.InfuseObject; import mekanism.api.infuse.InfuseRegistry; import mekanism.api.transmitters.TransmissionType; @@ -18,7 +19,6 @@ import mekanism.common.base.IFactory.RecipeType; import mekanism.common.base.ISideConfiguration; import mekanism.common.base.ISustainedData; import mekanism.common.base.ITierUpgradeable; -import mekanism.api.TileNetworkList; import mekanism.common.block.states.BlockStateMachine; import mekanism.common.capabilities.Capabilities; import mekanism.common.config.MekanismConfig.usage; @@ -216,13 +216,8 @@ public class TileEntityMetallurgicInfuser extends TileEntityOperationalMachine i if (infuseStored.type != null) { return RecipeHandler.getMetallurgicInfuserRecipe(new InfusionInput(infuseStored, itemstack)) != null; } else { - for (Object obj : Recipe.METALLURGIC_INFUSER.get().keySet()) { - InfusionInput input = (InfusionInput) obj; - - if (input.inputStack.isItemEqual(itemstack)) { - return true; - } - } + return Recipe.METALLURGIC_INFUSER.get().keySet().stream() + .anyMatch(input -> input.inputStack.isItemEqual(itemstack)); } } else if (slotID == 4) { return ChargeUtils.canBeDischarged(itemstack);