aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/util/GT_ProcessingArray_Manager.java
blob: 50014afdd1bd59dd89a74192c16eb8df6243e64f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package gregtech.api.util;

import java.util.HashMap;

import gregtech.api.enums.SoundResource;
import gregtech.api.util.GT_Recipe.GT_Recipe_Map;

public class GT_ProcessingArray_Manager {

    private static final HashMap<String, GT_Recipe_Map> mRecipeSaves = new HashMap<String, GT_Recipe_Map>();
    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, GT_Recipe_Map aMap) {
        if (aMachineName != null) {
            mRecipeSaves.put(aMachineName, aMap);
        }
    }

    // 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;
    }

    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;
    }
}