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/GT_RecipeMapUtil.java | |
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/GT_RecipeMapUtil.java')
-rw-r--r-- | src/main/java/gregtech/api/util/GT_RecipeMapUtil.java | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/main/java/gregtech/api/util/GT_RecipeMapUtil.java b/src/main/java/gregtech/api/util/GT_RecipeMapUtil.java index 577f91a170..3e97b56f84 100644 --- a/src/main/java/gregtech/api/util/GT_RecipeMapUtil.java +++ b/src/main/java/gregtech/api/util/GT_RecipeMapUtil.java @@ -26,12 +26,12 @@ import com.google.common.collect.Multimap; import cpw.mods.fml.common.Loader; import gnu.trove.list.TIntList; import gnu.trove.list.array.TIntArrayList; -import gregtech.api.interfaces.IGT_RecipeMap; +import gregtech.api.interfaces.IRecipeMap; +import gregtech.api.recipe.RecipeMetadataKey; /** * Define helpers useful in the creation of recipe maps. */ -// Do not place arbitrary stuff here! These are all statically imported in GT_Recipe.java file. public class GT_RecipeMapUtil { public static final Function<GT_Recipe, GT_Recipe> ALL_FAKE_RECIPE = r -> { @@ -65,10 +65,13 @@ public class GT_RecipeMapUtil { : r.mFluidOutputs[0].getFluid() .getName() : getStackConfigName(r.mOutputs[0]); - private static final Map<String, IGT_RecipeMap> addonRecipeMaps = new HashMap<>(); - private static final Multimap<String, Consumer<IGT_RecipeMap>> delayedActions = ArrayListMultimap.create(); + private static final Map<String, IRecipeMap> addonRecipeMaps = new HashMap<>(); + private static final Multimap<String, Consumer<IRecipeMap>> delayedActions = ArrayListMultimap.create(); - public static final Set<GT_RecipeBuilder.MetadataIdentifier<Integer>> SPECIAL_VALUE_ALIASES = new HashSet<>(); + /** + * Set of metadata that work as alias for special values. + */ + public static final Set<RecipeMetadataKey<Integer>> SPECIAL_VALUE_ALIASES = new HashSet<>(); public static <T> T[] appendArray(T[] arr, T val) { T[] newArr = Arrays.copyOf(arr, arr.length + 1); @@ -143,8 +146,7 @@ public class GT_RecipeMapUtil { * Currently unused, but you are advised to fill them, so that when The Day (tm) comes we don't * end up with a bunch of weird concurrency bugs. */ - public static void registerRecipeMap(String identifier, IGT_RecipeMap recipeMap, - RecipeMapDependency... dependencies) { + public static void registerRecipeMap(String identifier, IRecipeMap recipeMap, RecipeMapDependency... dependencies) { String modId = Loader.instance() .activeModContainer() .getModId(); @@ -152,7 +154,7 @@ public class GT_RecipeMapUtil { "do not register recipe map under the name of gregtech! do it in your own preinit!"); String id = modId + "@" + identifier; addonRecipeMaps.put(id, recipeMap); - for (Consumer<IGT_RecipeMap> action : delayedActions.get(id)) { + for (Consumer<IRecipeMap> action : delayedActions.get(id)) { action.accept(recipeMap); } } @@ -167,9 +169,9 @@ public class GT_RecipeMapUtil { * @param registerAction DO NOT ADD RECIPES TO MAPS OTHER THAN THE ONE PASSED TO YOU. DO NOT DO ANYTHING OTHER THAN * ADDING RECIPES TO THIS R */ - public static void registerRecipesFor(String modid, String identifier, Consumer<IGT_RecipeMap> registerAction) { + public static void registerRecipesFor(String modid, String identifier, Consumer<IRecipeMap> registerAction) { String id = modid + "@" + identifier; - IGT_RecipeMap map = addonRecipeMaps.get(id); + IRecipeMap map = addonRecipeMaps.get(id); if (map == null) delayedActions.put(id, registerAction); else registerAction.accept(map); } @@ -205,10 +207,10 @@ public class GT_RecipeMapUtil { public static final class RecipeMapDependency { - private final IGT_RecipeMap obj; + private final IRecipeMap obj; private final String id; - public RecipeMapDependency(IGT_RecipeMap obj, String id) { + public RecipeMapDependency(IRecipeMap obj, String id) { this.obj = obj; this.id = id; } @@ -217,7 +219,7 @@ public class GT_RecipeMapUtil { return new RecipeMapDependency(null, id); } - public static RecipeMapDependency create(IGT_RecipeMap obj) { + public static RecipeMapDependency create(IRecipeMap obj) { return new RecipeMapDependency(obj, null); } } |