diff options
| author | miozune <miozune@gmail.com> | 2023-12-04 05:34:27 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-12-03 21:34:27 +0100 |
| commit | f74c7cc297d1d19d38a19683cd277ad9ce605d3a (patch) | |
| tree | b2a5d66ec5a959099240fb1db239ffc0f9531839 /src/main/java/gregtech/api/util | |
| parent | b08cde7de4ec93cba05fb070991ad1dffb800ce1 (diff) | |
| download | GT5-Unofficial-f74c7cc297d1d19d38a19683cd277ad9ce605d3a.tar.gz GT5-Unofficial-f74c7cc297d1d19d38a19683cd277ad9ce605d3a.tar.bz2 GT5-Unofficial-f74c7cc297d1d19d38a19683cd277ad9ce605d3a.zip | |
Refactor RecipeMap (#2345)
* Remove deprecated and unused things
* Move recipemap subclasses
* Move GT_Recipe_Map to outside and rename to RecipeMap
* Move recipemap instances to separated class & remove prepending s
* Remove useless GT_Recipe constructors
* Always use ModularUI
* Rename IGT_RecipeMap -> IRecipeMap
* Add RecipeMapBuilder
* Remove more deprecated and unused things
* Fix RecipeMap type parameters
* Use multimap for recipe index
* Fix bending recipe error in dev env
* Remove mUniqueIdentifier
* Update AE2FC
* Less edgy texture for NEI recipe background
* Add replicator fluid output slot for NEI and machine GUI
* Fix fluid fuels not having fuel value in large boilers
* Remove GT_RectHandler and NEI_TransferRectHost
* Remove RecipeMapHandler
* Move NEI energy description from RecipeMapFrontend to Power
* Refactor the way to filter fusion recipes
* Check restriction for some properties
* Remove showVoltageAmperage
* Make Power accept GT_Recipe
* Fix NPE
* Move NEI duration description to Power from Frontend
* Directly implement IRecipeProcessingAwareHatch for GT_MetaTileEntity_Hatch_InputBus_ME
* Make Power integrated with GT_OverclockCalculator
* Rename Power -> OverclockDescriber
* Don't modify recipe find logic until postload finishes
* Reformat reserved MTE ids
* Fix check for too few inputs on recipe addition
* Move replicator logic to backend
* Stop un-hiding assline recipes
* Allow setting custom recipe comparator & implement for fusion
* Update AE2FC
* Rename getRecipeList and getRecipes -> getRecipeMap
* Automatically register recipe catalysts
* Cleanup the way to detect recipe collision
* Make use of BasicUIProperties for basic machines
* Make use of BasicUIProperties for UIHelper
* Rename specialHandler -> recipeTransformer
* Add way to automatically register handler info
* Add recipe category
* Add some APIs for addons
* Rename blastRecipes ->
blastFurnaceRecipes
* Remove GT_MetaTileEntity_BasicMachine_GT_Recipe#mSharedTank and #mRequiresFluidForFiltering
* Don't require setting duration and EU/t for fuel recipes
* Don't require setting EU/t for primitive blast furnace recipes
* Revert change to addMultiblockChemicalRecipe
* Fix large boiler general desc recipe not being added
* Hide duration and EU/t from large boiler
* Cleanup recipe stacktrace draw
* Extend metadata usage of recipe builder to recipe itself
* Implement metadata handling & NEI comparator for PCB factory
* Some rename around NEIRecipeInfo
* Some toString implementations
* Add more APIs for addons & some rename
* Infer handler icon from recipe catalyst if one is not set
* Also shrink recipe title when OC is not used
* Remove rare earth centrifuge recipe
* Use metadata for replicator backend
* Adjust geothermal generator output slot
* Allow having multiple transferrects
* Store recipemap reference in backend
* Rename vacuumRecipes -> vacuumFreezerRecipes
* Add config to tweak visibility of recipe categories
* Remove mHideRecyclingRecipes in favor of recipe category config
* Fix typo fluidSolidfierRecipes -> fluidSolidifierRecipes
* Refactor findRecipe and ProcessingLogic to use Stream
* Fix BBF handler icon & remove bronze blast furnace
* Add fluent API for findRecipe
* Add way to stop adding progressbar
* Change arg order for special texture
* Avoid overwriting interesting failure with NO_RECIPE
* Some changes for FuelBackend
* Set space project icon
* Remove localization from TT
* Remove CNC recipe adder
* Move recipe extractor from AE2FC
* Minor internal change for ProcessingLogic#applyRecipe
* More javadoc on #getAvailableRecipeMaps
* Better implementation of #ofSupplier
* Move replicator exponent config to GT_Proxy
* Remove RC & IC2 macerator handling
* Rename StreamUtil -> GT_StreamUtil
* Refactor code around RecipeMetadataStorage
* Revise #compileRecipe javadoc
* Switch extreme diesel recipe loader to downstream recipe map
* Optimize #reMap
* Rename reload -> reloadNEICache
* Minor tweak for drawEnergyInfo
* a bit more doc
* Adjust recipe catalysts
* Add toString implementation for GT_Fluid for debug
* Minor revision for OilCrackerBackend
* Index replicator recipes by material
---------
Co-authored-by: Glease <4586901+Glease@users.noreply.github.com>
Diffstat (limited to 'src/main/java/gregtech/api/util')
17 files changed, 558 insertions, 6069 deletions
diff --git a/src/main/java/gregtech/api/util/FieldsAreNonnullByDefault.java b/src/main/java/gregtech/api/util/FieldsAreNonnullByDefault.java new file mode 100644 index 0000000000..1f51aa39a7 --- /dev/null +++ b/src/main/java/gregtech/api/util/FieldsAreNonnullByDefault.java @@ -0,0 +1,18 @@ +package gregtech.api.util; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +import javax.annotation.Nonnull; +import javax.annotation.meta.TypeQualifierDefault; + +/** + * This annotation can be applied to a package or class to indicate that + * the fields in that element are nonnull by default unless there is an explicit nullness annotation. + * </ul> + */ +@Nonnull +@TypeQualifierDefault({ ElementType.FIELD }) +@Retention(RetentionPolicy.RUNTIME) +public @interface FieldsAreNonnullByDefault {} diff --git a/src/main/java/gregtech/api/util/GT_Config.java b/src/main/java/gregtech/api/util/GT_Config.java index 36585559c2..dc56def68f 100644 --- a/src/main/java/gregtech/api/util/GT_Config.java +++ b/src/main/java/gregtech/api/util/GT_Config.java @@ -139,6 +139,20 @@ public class GT_Config implements Runnable { return rResult; } + public String getWithValidValues(Object aCategory, String aName, String[] validValues, String aDefault) { + if (GT_Utility.isStringInvalid(aName)) return aDefault; + Property tProperty = mConfig.get( + aCategory.toString() + .replaceAll("\\|", "_"), + aName.replaceAll("\\|", "_"), + aDefault, + null, + validValues); + String rResult = tProperty.getString(); + if (!tProperty.wasRead() && GregTech_API.sPostloadFinished) mConfig.save(); + return rResult; + } + @Override public void run() { mConfig.save(); diff --git a/src/main/java/gregtech/api/util/GT_Forestry_Compat.java b/src/main/java/gregtech/api/util/GT_Forestry_Compat.java index 933c379db1..427703e6f7 100644 --- a/src/main/java/gregtech/api/util/GT_Forestry_Compat.java +++ b/src/main/java/gregtech/api/util/GT_Forestry_Compat.java @@ -11,12 +11,13 @@ import forestry.api.recipes.RecipeManagers; import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; +import gregtech.api.recipe.RecipeMaps; public class GT_Forestry_Compat { public static void populateFakeNeiRecipes() { if (ItemList.FR_Bee_Drone.get(1L) != null) { - GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe( + RecipeMaps.scannerFakeRecipes.addFakeRecipe( false, new ItemStack[] { ItemList.FR_Bee_Drone.getWildcard(1L) }, new ItemStack[] { ItemList.FR_Bee_Drone.getWithName(1L, "Scanned Drone") }, @@ -28,7 +29,7 @@ public class GT_Forestry_Compat { 0); } if (ItemList.FR_Bee_Princess.get(1L) != null) { - GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe( + RecipeMaps.scannerFakeRecipes.addFakeRecipe( false, new ItemStack[] { ItemList.FR_Bee_Princess.getWildcard(1L) }, new ItemStack[] { ItemList.FR_Bee_Princess.getWithName(1L, "Scanned Princess") }, @@ -40,7 +41,7 @@ public class GT_Forestry_Compat { 0); } if (ItemList.FR_Bee_Queen.get(1L) != null) { - GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe( + RecipeMaps.scannerFakeRecipes.addFakeRecipe( false, new ItemStack[] { ItemList.FR_Bee_Queen.getWildcard(1L) }, new ItemStack[] { ItemList.FR_Bee_Queen.getWithName(1L, "Scanned Queen") }, @@ -52,7 +53,7 @@ public class GT_Forestry_Compat { 0); } if (ItemList.FR_Tree_Sapling.get(1L) != null) { - GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe( + RecipeMaps.scannerFakeRecipes.addFakeRecipe( false, new ItemStack[] { ItemList.FR_Tree_Sapling.getWildcard(1L) }, new ItemStack[] { ItemList.FR_Tree_Sapling.getWithName(1L, "Scanned Sapling") }, @@ -64,7 +65,7 @@ public class GT_Forestry_Compat { 0); } if (ItemList.FR_Butterfly.get(1L) != null) { - GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe( + RecipeMaps.scannerFakeRecipes.addFakeRecipe( false, new ItemStack[] { ItemList.FR_Butterfly.getWildcard(1L) }, new ItemStack[] { ItemList.FR_Butterfly.getWithName(1L, "Scanned Butterfly") }, @@ -76,7 +77,7 @@ public class GT_Forestry_Compat { 0); } if (ItemList.FR_Larvae.get(1L) != null) { - GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe( + RecipeMaps.scannerFakeRecipes.addFakeRecipe( false, new ItemStack[] { ItemList.FR_Larvae.getWildcard(1L) }, new ItemStack[] { ItemList.FR_Larvae.getWithName(1L, "Scanned Larvae") }, @@ -88,7 +89,7 @@ public class GT_Forestry_Compat { 0); } if (ItemList.FR_Serum.get(1L) != null) { - GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe( + RecipeMaps.scannerFakeRecipes.addFakeRecipe( false, new ItemStack[] { ItemList.FR_Serum.getWildcard(1L) }, new ItemStack[] { ItemList.FR_Serum.getWithName(1L, "Scanned Serum") }, @@ -100,7 +101,7 @@ public class GT_Forestry_Compat { 0); } if (ItemList.FR_Caterpillar.get(1L) != null) { - GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe( + RecipeMaps.scannerFakeRecipes.addFakeRecipe( false, new ItemStack[] { ItemList.FR_Caterpillar.getWildcard(1L) }, new ItemStack[] { ItemList.FR_Caterpillar.getWithName(1L, "Scanned Caterpillar") }, @@ -112,7 +113,7 @@ public class GT_Forestry_Compat { 0); } if (ItemList.FR_PollenFertile.get(1L) != null) { - GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe( + RecipeMaps.scannerFakeRecipes.addFakeRecipe( false, new ItemStack[] { ItemList.FR_PollenFertile.getWildcard(1L) }, new ItemStack[] { ItemList.FR_PollenFertile.getWithName(1L, "Scanned Pollen") }, @@ -138,7 +139,7 @@ public class GT_Forestry_Compat { .copy(); i++; } - GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes.addRecipe( + RecipeMaps.centrifugeRecipes.addRecipe( true, new ItemStack[] { tRecipe.getInput() }, tOutputs, @@ -149,7 +150,7 @@ public class GT_Forestry_Compat { 128, 5, 0); - GT_Recipe.GT_Recipe_Map.sMultiblockCentrifugeRecipes.addRecipe( + RecipeMaps.centrifugeNonCellRecipes.addRecipe( true, new ItemStack[] { tRecipe.getInput() }, tOutputs, @@ -172,7 +173,7 @@ public class GT_Forestry_Compat { try { for (ISqueezerRecipe tRecipe : RecipeManagers.squeezerManager.recipes()) { if ((tRecipe.getResources().length == 1) && (tRecipe.getFluidOutput() != null)) { - GT_Recipe.GT_Recipe_Map.sFluidExtractionRecipes.addRecipe( + RecipeMaps.fluidExtractionRecipes.addRecipe( true, new ItemStack[] { tRecipe.getResources()[0] }, new ItemStack[] { tRecipe.getRemnants() }, diff --git a/src/main/java/gregtech/api/util/GT_LanguageManager.java b/src/main/java/gregtech/api/util/GT_LanguageManager.java index 76e59eed22..ed82befbcc 100644 --- a/src/main/java/gregtech/api/util/GT_LanguageManager.java +++ b/src/main/java/gregtech/api/util/GT_LanguageManager.java @@ -315,7 +315,6 @@ public class GT_LanguageManager { addStringLocalization("Interaction_DESCRIPTION_Index_151.2", "Outputs 1 specific Fluid"); addStringLocalization("Interaction_DESCRIPTION_Index_151.4", "Successfully locked Fluid to %s"); addStringLocalization("Interaction_DESCRIPTION_Index_152", "Total: "); - addStringLocalization("Interaction_DESCRIPTION_Index_152.1", "Max EU: "); addStringLocalization("Interaction_DESCRIPTION_Index_153", "Usage: "); addStringLocalization("Interaction_DESCRIPTION_Index_154", "Voltage: "); addStringLocalization("Interaction_DESCRIPTION_Index_155", "Amperage: "); diff --git a/src/main/java/gregtech/api/util/GT_ModHandler.java b/src/main/java/gregtech/api/util/GT_ModHandler.java index e16e559360..b83c70d7de 100644 --- a/src/main/java/gregtech/api/util/GT_ModHandler.java +++ b/src/main/java/gregtech/api/util/GT_ModHandler.java @@ -9,9 +9,9 @@ import static gregtech.api.enums.GT_Values.M; import static gregtech.api.enums.GT_Values.RA; import static gregtech.api.enums.GT_Values.V; import static gregtech.api.enums.GT_Values.W; -import static gregtech.api.util.GT_Recipe.GT_Recipe_Map.sAlloySmelterRecipes; -import static gregtech.api.util.GT_Recipe.GT_Recipe_Map.sExtractorRecipes; -import static gregtech.api.util.GT_Recipe.GT_Recipe_Map.sOreWasherRecipes; +import static gregtech.api.recipe.RecipeMaps.alloySmelterRecipes; +import static gregtech.api.recipe.RecipeMaps.extractorRecipes; +import static gregtech.api.recipe.RecipeMaps.oreWasherRecipes; import static gregtech.api.util.GT_RecipeBuilder.SECONDS; import static gregtech.api.util.GT_RecipeBuilder.TICKS; @@ -70,6 +70,8 @@ import gregtech.api.items.GT_MetaBase_Item; import gregtech.api.objects.GT_HashSet; import gregtech.api.objects.GT_ItemStack; import gregtech.api.objects.ItemData; +import gregtech.api.recipe.RecipeCategories; +import gregtech.api.recipe.RecipeMap; import ic2.api.item.IBoxable; import ic2.api.item.IC2Items; import ic2.api.item.IElectricItem; @@ -569,11 +571,12 @@ public class GT_ModHandler { } recipeBuilder.itemOutputs(aOutput) .duration(duration * TICKS) - .eut(3); + .eut(3) + .recipeCategory(RecipeCategories.alloySmelterRecycling); if (hidden) { recipeBuilder.hidden(); } - recipeBuilder.addTo(sAlloySmelterRecipes); + recipeBuilder.addTo(alloySmelterRecipes); return true; } @@ -617,7 +620,7 @@ public class GT_ModHandler { .itemOutputs(aOutput) .duration(15 * SECONDS) .eut(2) - .addTo(sExtractorRecipes); + .addTo(extractorRecipes); return true; } @@ -733,7 +736,7 @@ public class GT_ModHandler { .itemOutputs(aOutput1) .duration(aDuration) .eut(aEUt) - .addTo(sAlloySmelterRecipes); + .addTo(alloySmelterRecipes); return true; } @@ -759,9 +762,8 @@ public class GT_ModHandler { /** * Adds GT versions of the IC2 recipes from the supplied IC2RecipeList. */ - public static void addIC2RecipesToGT(Map<IRecipeInput, RecipeOutput> aIC2RecipeList, - GT_Recipe.GT_Recipe_Map aGTRecipeMap, boolean aAddGTRecipe, boolean aRemoveIC2Recipe, - boolean aExcludeGTIC2Items) { + public static void addIC2RecipesToGT(Map<IRecipeInput, RecipeOutput> aIC2RecipeList, RecipeMap<?> aGTRecipeMap, + boolean aAddGTRecipe, boolean aRemoveIC2Recipe, boolean aExcludeGTIC2Items) { Map<ItemStack, ItemStack> aRecipesToRemove = new HashMap<>(); for (Entry<IRecipeInput, RecipeOutput> iRecipeInputRecipeOutputEntry : aIC2RecipeList.entrySet()) { if (iRecipeInputRecipeOutputEntry.getValue().items.isEmpty()) { @@ -773,7 +775,7 @@ public class GT_ModHandler { continue; } - if (aAddGTRecipe && (aGTRecipeMap.findRecipe(null, false, Long.MAX_VALUE, null, tStack) == null)) { + if (aAddGTRecipe) { try { if (aExcludeGTIC2Items && ((tStack.getUnlocalizedName() .contains("gt.metaitem.01") @@ -784,7 +786,7 @@ public class GT_ModHandler { || tStack.getUnlocalizedName() .contains("ic2.itemPurifiedCrushed")))) continue; - switch (aGTRecipeMap.mUnlocalizedName) { + switch (aGTRecipeMap.unlocalizedName) { case "gt.recipe.macerator", "gt.recipe.extractor", "gt.recipe.compressor" -> aGTRecipeMap .addRecipe( true, @@ -928,7 +930,7 @@ public class GT_ModHandler { .fluidInputs(GT_ModHandler.getWater(aWaterAmount)) .duration(25 * SECONDS) .eut(16) - .addTo(sOreWasherRecipes); + .addTo(oreWasherRecipes); RA.stdBuilder() .itemInputs(aInput) @@ -937,7 +939,7 @@ public class GT_ModHandler { .fluidInputs(GT_ModHandler.getDistilledWater(aWaterAmount / 5)) .duration(15 * SECONDS) .eut(16) - .addTo(sOreWasherRecipes); + .addTo(oreWasherRecipes); return true; } @@ -950,7 +952,7 @@ public class GT_ModHandler { .fluidInputs(GT_ModHandler.getWater(aWaterAmount)) .duration(25 * SECONDS) .eut(16) - .addTo(sOreWasherRecipes); + .addTo(oreWasherRecipes); RA.stdBuilder() .itemInputs(aInput) @@ -958,7 +960,7 @@ public class GT_ModHandler { .fluidInputs(GT_ModHandler.getDistilledWater(aWaterAmount / 5)) .duration(15 * SECONDS) .eut(16) - .addTo(sOreWasherRecipes); + .addTo(oreWasherRecipes); return true; } diff --git a/src/main/java/gregtech/api/util/GT_OverclockCalculator.java b/src/main/java/gregtech/api/util/GT_OverclockCalculator.java index 582b65e7ec..8e896fd8de 100644 --- a/src/main/java/gregtech/api/util/GT_OverclockCalculator.java +++ b/src/main/java/gregtech/api/util/GT_OverclockCalculator.java @@ -198,14 +198,6 @@ public class GT_OverclockCalculator { } /** - * Use {@link #setHeatOC(boolean)} - */ - @Deprecated - public GT_OverclockCalculator enableHeatOC() { - return setHeatOC(true); - } - - /** * Set if we should be calculating overclocking using EBF's perfectOC */ public GT_OverclockCalculator setHeatOC(boolean heatOC) { @@ -214,14 +206,6 @@ public class GT_OverclockCalculator { } /** - * Use {@link #setHeatDiscount(boolean)} - */ - @Deprecated - public GT_OverclockCalculator enableHeatDiscount() { - return setHeatDiscount(true); - } - - /** * Sets if we should add a heat discount at the end of calculating an overclock, just like the EBF */ public GT_OverclockCalculator setHeatDiscount(boolean heatDiscount) { @@ -238,14 +222,6 @@ public class GT_OverclockCalculator { } /** - * Use {@link #setMachineHeat(int)} - */ - @Deprecated - public GT_OverclockCalculator setMultiHeat(int machineHeat) { - return setMachineHeat(machineHeat); - } - - /** * Sets the heat of the coils on the machine */ public GT_OverclockCalculator setMachineHeat(int machineHeat) { @@ -313,14 +289,6 @@ public class GT_OverclockCalculator { } /** - * Use {@link #setOneTickDiscount(boolean)} - */ - @Deprecated - public GT_OverclockCalculator enableOneTickDiscount() { - return setOneTickDiscount(true); - } - - /** * Set One Tick Discount on EUt based on Duration Decrease Per Overclock. This functions the same as single * blocks. */ @@ -556,7 +524,7 @@ public class GT_OverclockCalculator { /** * Returns the EUt consumption one would get from overclocking under 1 tick * This Doesn't count as calculating - * + * * @param originalMaxParallel Parallels which are of the actual machine before the overclocking extra ones */ public long calculateEUtConsumptionUnderOneTick(int originalMaxParallel, int currentParallel) { diff --git a/src/main/java/gregtech/api/util/GT_ParallelHelper.java b/src/main/java/gregtech/api/util/GT_ParallelHelper.java index d3921b613d..8a5cd0b9f8 100644 --- a/src/main/java/gregtech/api/util/GT_ParallelHelper.java +++ b/src/main/java/gregtech/api/util/GT_ParallelHelper.java @@ -10,8 +10,8 @@ import net.minecraftforge.fluids.FluidStack; import gregtech.api.interfaces.tileentity.IRecipeLockable; import gregtech.api.interfaces.tileentity.IVoidable; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; import gregtech.api.objects.XSTR; +import gregtech.api.recipe.RecipeMap; import gregtech.api.recipe.check.CheckRecipeResult; import gregtech.api.recipe.check.CheckRecipeResultRegistry; import gregtech.api.recipe.check.SingleRecipeCheck; @@ -124,27 +124,6 @@ public class GT_ParallelHelper { public GT_ParallelHelper() {} /** - * Sets MetaTE controller, with current configuration for void protection mode. - * - * @deprecated Use {@link #setMachine(IVoidable)} - */ - @Deprecated - public GT_ParallelHelper setController(GT_MetaTileEntity_MultiBlockBase machineMeta) { - return setMachine(machineMeta, machineMeta.protectsExcessItem(), machineMeta.protectsExcessFluid()); - } - - /** - * Sets MetaTE controller, with void protection mode forcibly. - * - * @deprecated Use {@link #setMachine(IVoidable, boolean, boolean)} - */ - @Deprecated - public GT_ParallelHelper setController(GT_MetaTileEntity_MultiBlockBase machineMeta, boolean protectExcessItem, - boolean protectExcessFluid) { - return setMachine(machineMeta, protectExcessItem, protectExcessFluid); - } - - /** * Sets machine, with current configuration for void protection mode. */ public GT_ParallelHelper setMachine(IVoidable machine) { @@ -213,14 +192,6 @@ public class GT_ParallelHelper { } /** - * Use {@link #setConsumption(boolean)} - */ - @Deprecated - public GT_ParallelHelper enableConsumption() { - return setConsumption(true); - } - - /** * Set if we should consume inputs or not when trying for parallels * * @param consume Should we consume inputs @@ -249,14 +220,6 @@ public class GT_ParallelHelper { } /** - * Use {@link #setOutputCalculation(boolean)} - */ - @Deprecated - public GT_ParallelHelper enableOutputCalculation() { - return setOutputCalculation(true); - } - - /** * Sets if we should calculate outputs with the parallels we found or not * * @param calculateOutputs Should we calculate outputs with the helper or not @@ -339,14 +302,6 @@ public class GT_ParallelHelper { } /** - * @deprecated Use {@link #getDurationMultiplierDouble()} - */ - @Deprecated - public float getDurationMultiplier() { - return (float) getDurationMultiplierDouble(); - } - - /** * @return The ItemOutputs from the recipe */ @Nonnull @@ -382,23 +337,6 @@ public class GT_ParallelHelper { } /** - * @deprecated Use {@link #setMaxParallelCalculator} and {@link #setInputConsumer} - */ - @Deprecated - protected boolean tryConsumeRecipeInputs(GT_Recipe recipe, FluidStack[] fluids, ItemStack[] items) { - return false; - } - - /** - * @deprecated Use {@link #setMaxParallelCalculator} and {@link #setInputConsumer} - */ - @Deprecated - protected boolean tryConsumeRecipeInputs(GT_Recipe recipe, FluidStack[] fluids, ItemStack[] items, - int minParallel) { - return false; - } - - /** * Called by build(). Determines the parallels and everything else that needs to be done at build time */ protected void determineParallel() { @@ -446,7 +384,7 @@ public class GT_ParallelHelper { if (recipeCheck == null) { // Machine is configured to lock to a single recipe, but haven't built the recipe checker yet. // Build the checker on next successful recipe. - GT_Recipe.GT_Recipe_Map recipeMap = singleRecipeMachine.getRecipeMap(); + RecipeMap<?> recipeMap = singleRecipeMachine.getRecipeMap(); if (recipeMap != null) { tSingleRecipeCheckBuilder = SingleRecipeCheck.builder(recipeMap) .setBefore(itemInputs, fluidInputs); diff --git a/src/main/java/gregtech/api/util/GT_ProcessingArray_Manager.java b/src/main/java/gregtech/api/util/GT_ProcessingArray_Manager.java index 7ff37a927c..ead9393d0e 100644 --- a/src/main/java/gregtech/api/util/GT_ProcessingArray_Manager.java +++ b/src/main/java/gregtech/api/util/GT_ProcessingArray_Manager.java @@ -5,24 +5,24 @@ import java.util.HashMap; import net.minecraft.item.ItemStack; import gregtech.api.enums.SoundResource; -import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gregtech.api.recipe.RecipeMap; @Deprecated public class GT_ProcessingArray_Manager { - private static final HashMap<String, GT_Recipe_Map> mRecipeSaves = new HashMap<>(); + private static final HashMap<String, RecipeMap<?>> mRecipeSaves = new HashMap<>(); private static final HashMap<String, SoundResource> machineSounds = new HashMap<>(); // Adds recipe Maps to the PA using the machines unlocalized name. // Example: basicmachine.electrolyzer, with its recipe map will add the electrolyzer's recipe map to the PA - public static void addRecipeMapToPA(String aMachineName, GT_Recipe_Map aMap) { + public static void addRecipeMapToPA(String aMachineName, RecipeMap<?> aMap) { if (aMachineName != null) { mRecipeSaves.put(aMachineName, aMap); } } // Allows the PA to extract the recipe map for the machine inside it. - public static GT_Recipe_Map giveRecipeMap(String aMachineName) { + public static RecipeMap<?> giveRecipeMap(String aMachineName) { if (aMachineName != null) { return mRecipeSaves.get(aMachineName); } diff --git a/src/main/java/gregtech/api/util/GT_Recipe.java b/src/main/java/gregtech/api/util/GT_Recipe.java index 535da25934..a444a16ef2 100644 --- a/src/main/java/gregtech/api/util/GT_Recipe.java +++ b/src/main/java/gregtech/api/util/GT_Recipe.java @@ -1,148 +1,38 @@ package gregtech.api.util; -import static gregtech.api.enums.GT_Values.D1; import static gregtech.api.enums.GT_Values.D2; -import static gregtech.api.enums.GT_Values.E; -import static gregtech.api.enums.GT_Values.L; -import static gregtech.api.enums.GT_Values.W; -import static gregtech.api.enums.Mods.GTPlusPlus; -import static gregtech.api.enums.Mods.GregTech; -import static gregtech.api.enums.Mods.NEICustomDiagrams; -import static gregtech.api.enums.Mods.Railcraft; -import static gregtech.api.recipe.check.FindRecipeResult.EXPLODE; -import static gregtech.api.recipe.check.FindRecipeResult.NOT_FOUND; -import static gregtech.api.recipe.check.FindRecipeResult.ON_FIRE; -import static gregtech.api.recipe.check.FindRecipeResult.ofSuccess; -import static gregtech.api.util.GT_RecipeBuilder.handleRecipeCollision; -import static gregtech.api.util.GT_RecipeConstants.ADDITIVE_AMOUNT; -import static gregtech.api.util.GT_RecipeMapUtil.FIRST_FLUIDSTACK_INPUT; -import static gregtech.api.util.GT_RecipeMapUtil.FIRST_FLUIDSTACK_OUTPUT; -import static gregtech.api.util.GT_RecipeMapUtil.FIRST_FLUID_OUTPUT; -import static gregtech.api.util.GT_RecipeMapUtil.FIRST_ITEM_INPUT; -import static gregtech.api.util.GT_RecipeMapUtil.FIRST_ITEM_OR_FLUID_INPUT; -import static gregtech.api.util.GT_RecipeMapUtil.FIRST_ITEM_OR_FLUID_OUTPUT; -import static gregtech.api.util.GT_RecipeMapUtil.FIRST_ITEM_OUTPUT; -import static gregtech.api.util.GT_RecipeMapUtil.GT_RecipeTemplate; -import static gregtech.api.util.GT_RecipeMapUtil.SPECIAL_VALUE_ALIASES; -import static gregtech.api.util.GT_RecipeMapUtil.asTemplate; -import static gregtech.api.util.GT_RecipeMapUtil.buildOrEmpty; -import static gregtech.api.util.GT_Utility.formatNumbers; -import static gregtech.api.util.GT_Utility.isArrayEmptyOrNull; -import static gregtech.api.util.GT_Utility.isArrayOfLength; -import static net.minecraft.util.EnumChatFormatting.GRAY; -import static net.minecraft.util.StatCollector.translateToLocal; -import java.awt.Rectangle; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Optional; -import java.util.Set; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.function.Consumer; -import java.util.function.Function; -import java.util.function.Predicate; -import java.util.function.Supplier; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntityFurnace; -import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.IFluidContainerItem; -import org.apache.commons.lang3.ArrayUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.Contract; -import com.google.common.collect.Iterables; -import com.gtnewhorizons.modularui.api.GlStateManager; -import com.gtnewhorizons.modularui.api.ModularUITextures; -import com.gtnewhorizons.modularui.api.drawable.FallbackableUITexture; -import com.gtnewhorizons.modularui.api.drawable.IDrawable; -import com.gtnewhorizons.modularui.api.drawable.UITexture; -import com.gtnewhorizons.modularui.api.forge.IItemHandlerModifiable; -import com.gtnewhorizons.modularui.api.math.Alignment; -import com.gtnewhorizons.modularui.api.math.Pos2d; -import com.gtnewhorizons.modularui.api.math.Size; -import com.gtnewhorizons.modularui.api.screen.ModularWindow; -import com.gtnewhorizons.modularui.common.widget.DrawableWidget; -import com.gtnewhorizons.modularui.common.widget.ProgressBar; -import com.gtnewhorizons.modularui.common.widget.SlotWidget; - -import appeng.util.ReadableNumberConverter; -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.PositionedStack; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.ModContainer; -import gnu.trove.map.TByteObjectMap; -import gnu.trove.map.hash.TByteObjectHashMap; import gregtech.GT_Mod; import gregtech.api.GregTech_API; -import gregtech.api.enums.ConfigCategories; -import gregtech.api.enums.Dyes; -import gregtech.api.enums.Element; -import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.enums.SteamVariant; -import gregtech.api.enums.SubTag; -import gregtech.api.gui.GT_GUIColorOverride; -import gregtech.api.gui.modularui.FallbackableSteamTexture; -import gregtech.api.gui.modularui.GT_UITextures; -import gregtech.api.gui.modularui.SteamTexture; -import gregtech.api.interfaces.IGT_RecipeMap; -import gregtech.api.interfaces.tileentity.IHasWorldObjectAndCoords; import gregtech.api.objects.GT_ItemStack; -import gregtech.api.objects.ItemData; -import gregtech.api.objects.MaterialStack; -import gregtech.api.recipe.check.FindRecipeResult; +import gregtech.api.recipe.RecipeCategory; +import gregtech.api.recipe.RecipeMap; +import gregtech.api.recipe.RecipeMaps; +import gregtech.api.recipe.RecipeMetadataKey; +import gregtech.api.recipe.metadata.EmptyRecipeMetadataStorage; +import gregtech.api.recipe.metadata.IRecipeMetadataStorage; import gregtech.api.util.extensions.ArrayExt; |
