diff options
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.java | 31 |
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 |