-
Notifications
You must be signed in to change notification settings - Fork 497
/
GateExpansions.java
65 lines (52 loc) · 1.95 KB
/
GateExpansions.java
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
package buildcraft.api.gates;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import com.google.common.collect.HashBiMap;
import net.minecraft.item.ItemStack;
public final class GateExpansions {
private static final Map<String, IGateExpansion> expansions = new HashMap<String, IGateExpansion>();
private static final ArrayList<IGateExpansion> expansionIDs = new ArrayList<IGateExpansion>();
private static final Map<IGateExpansion, ItemStack> recipes = HashBiMap.create();
private GateExpansions() {
}
public static void registerExpansion(IGateExpansion expansion) {
registerExpansion(expansion.getUniqueIdentifier(), expansion);
}
public static void registerExpansion(String identifier, IGateExpansion expansion) {
expansions.put(identifier, expansion);
expansionIDs.add(expansion);
}
public static void registerExpansion(IGateExpansion expansion, ItemStack addedRecipe) {
registerExpansion(expansion.getUniqueIdentifier(), expansion);
recipes.put(expansion, addedRecipe);
}
public static IGateExpansion getExpansion(String identifier) {
return expansions.get(identifier);
}
public static Set<IGateExpansion> getExpansions() {
Set<IGateExpansion> set = new HashSet<IGateExpansion>();
set.addAll(expansionIDs);
return set;
}
public static Map<IGateExpansion, ItemStack> getRecipesForPostInit() {
return recipes;
}
// The code below is used by networking.
public static IGateExpansion getExpansionByID(int id) {
return expansionIDs.get(id);
}
public static int getExpansionID(IGateExpansion expansion) {
return expansionIDs.indexOf(expansion);
}
}