From 0b7b985b22ae016053b03c48895154316f5609a0 Mon Sep 17 00:00:00 2001 From: BlueWeabo <76872108+BlueWeabo@users.noreply.github.com> Date: Fri, 19 Aug 2022 14:46:47 +0300 Subject: Changes to the PA code (#1272) --- .../api/util/GT_ProcessingArray_Manager.java | 31 +++++++++------------- 1 file changed, 12 insertions(+), 19 deletions(-) (limited to 'src/main/java/gregtech/api/util') 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 mMetaKeyMap = new HashMap(); - private static final HashMap mRecipeCache = new HashMap(); - - 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 mRecipeSaves = 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) { + 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; } - } -- cgit