aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/util/GT_ProcessingArray_Manager.java
diff options
context:
space:
mode:
authorMartin Robertz <dream-master@gmx.net>2020-04-07 00:41:00 +0200
committerGitHub <noreply@github.com>2020-04-07 00:41:00 +0200
commitba6ae1dc68f78c7b066eacae7702e68c210b1116 (patch)
tree1b7f74fbe3eb8404c7c6cdc8651711a438205e2b /src/main/java/gregtech/api/util/GT_ProcessingArray_Manager.java
parent018903ff3d872a0a1a39d99cb4259fe3dc98bce3 (diff)
parent548eb09404186bd45acc2cd029d59e130175fbea (diff)
downloadGT5-Unofficial-ba6ae1dc68f78c7b066eacae7702e68c210b1116.tar.gz
GT5-Unofficial-ba6ae1dc68f78c7b066eacae7702e68c210b1116.tar.bz2
GT5-Unofficial-ba6ae1dc68f78c7b066eacae7702e68c210b1116.zip
Merge pull request #260 from GTNewHorizons/Processing-Array
Processing array
Diffstat (limited to 'src/main/java/gregtech/api/util/GT_ProcessingArray_Manager.java')
-rw-r--r--src/main/java/gregtech/api/util/GT_ProcessingArray_Manager.java31
1 files changed, 31 insertions, 0 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
new file mode 100644
index 0000000000..e25a0209d9
--- /dev/null
+++ b/src/main/java/gregtech/api/util/GT_ProcessingArray_Manager.java
@@ -0,0 +1,31 @@
+package gregtech.api.util;
+
+import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
+
+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);
+ }
+ return true;
+ }
+
+ public static GT_Recipe_Map getRecipeMapForMeta(int aMeta) {
+ return mRecipeCache.get(mMetaKeyMap.get(aMeta));
+ }
+
+} \ No newline at end of file