aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/util/ProcessingArrayManager.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gregtech/api/util/ProcessingArrayManager.java')
-rw-r--r--src/main/java/gregtech/api/util/ProcessingArrayManager.java51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/main/java/gregtech/api/util/ProcessingArrayManager.java b/src/main/java/gregtech/api/util/ProcessingArrayManager.java
new file mode 100644
index 0000000000..adbb8f76b8
--- /dev/null
+++ b/src/main/java/gregtech/api/util/ProcessingArrayManager.java
@@ -0,0 +1,51 @@
+package gregtech.api.util;
+
+import java.util.HashMap;
+
+import net.minecraft.item.ItemStack;
+
+import gregtech.api.enums.SoundResource;
+import gregtech.api.recipe.RecipeMap;
+
+@Deprecated
+public class ProcessingArrayManager {
+
+ private static final HashMap<String, RecipeMap<?>> mRecipeSaves = new HashMap<>();
+ private static final HashMap<String, SoundResource> machineSounds = 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, RecipeMap<?> aMap) {
+ if (aMachineName != null) {
+ mRecipeSaves.put(aMachineName, aMap);
+ }
+ }
+
+ // Allows the PA to extract the recipe map for the machine inside it.
+ public static RecipeMap<?> giveRecipeMap(String aMachineName) {
+ if (aMachineName != null) {
+ return mRecipeSaves.get(aMachineName);
+ }
+ return null;
+ }
+
+ public static void addSoundResourceToPA(String machineName, SoundResource soundResource) {
+ if (machineName != null) {
+ machineSounds.put(machineName, soundResource);
+ }
+ }
+
+ public static SoundResource getSoundResource(String machineName) {
+ if (machineName != null) {
+ return machineSounds.get(machineName);
+ }
+ return null;
+ }
+
+ public static String getMachineName(ItemStack stack) {
+ int length = stack.getUnlocalizedName()
+ .length();
+ return stack.getUnlocalizedName()
+ .substring(17, length - 8); // trim "gt.blockmachines." and ".tier.xx"
+ }
+}