aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/util
diff options
context:
space:
mode:
authorBlueWeabo <76872108+BlueWeabo@users.noreply.github.com>2022-08-19 14:46:47 +0300
committerGitHub <noreply@github.com>2022-08-19 13:46:47 +0200
commit0b7b985b22ae016053b03c48895154316f5609a0 (patch)
tree02c4b9816d2343531cca6bac5f299dc4214e53e1 /src/main/java/gregtech/api/util
parentaa138f36cbd1ee319d8c1868a6e8223ae93480d7 (diff)
downloadGT5-Unofficial-0b7b985b22ae016053b03c48895154316f5609a0.tar.gz
GT5-Unofficial-0b7b985b22ae016053b03c48895154316f5609a0.tar.bz2
GT5-Unofficial-0b7b985b22ae016053b03c48895154316f5609a0.zip
Changes to the PA code (#1272)
Diffstat (limited to 'src/main/java/gregtech/api/util')
-rw-r--r--src/main/java/gregtech/api/util/GT_ProcessingArray_Manager.java31
1 files changed, 12 insertions, 19 deletions
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 853a493f4a..0005f20869 100644
--- a/src/main/java/gregtech/api/util/GT_ProcessingArray_Manager.java
+++ b/src/main/java/gregtech/api/util/GT_ProcessingArray_Manager.java
@@ -6,26 +6,19 @@ import java.util.HashMap;
public class GT_ProcessingArray_Manager {
- private static final HashMap<Integer, String> mMetaKeyMap = new HashMap<Integer, String>();
- private static final HashMap<String, GT_Recipe_Map> mRecipeCache = new HashMap<String, GT_Recipe_Map>();
-
- public static boolean registerRecipeMapForMeta(int aMeta, GT_Recipe_Map aMap) {
- if (aMeta < 0 || aMeta > Short.MAX_VALUE || aMap == null) {
- return false;
- }
- if (mMetaKeyMap.containsKey(aMeta)) {
- return false;
- }
- String aMapNameKey = aMap.mUnlocalizedName;
- mMetaKeyMap.put(aMeta, aMapNameKey);
- if (!mRecipeCache.containsKey(aMapNameKey)) {
- mRecipeCache.put(aMapNameKey, aMap);
+ private static final HashMap<String, GT_Recipe_Map> mRecipeSaves = new HashMap<String, GT_Recipe_Map>();
+ //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) {
+ if (aMachineName != null) {
+ mRecipeSaves.put(aMachineName, aMap);
}
- return true;
}
-
- public static GT_Recipe_Map getRecipeMapForMeta(int aMeta) {
- return mRecipeCache.get(mMetaKeyMap.get(aMeta));
+ //Allows the PA to extract the recipe map for the machine inside it.
+ public static GT_Recipe_Map giveRecipeMap(String aMachineName) {
+ if (aMachineName != null) {
+ return mRecipeSaves.get(aMachineName);
+ }
+ return null;
}
-
}