-
Notifications
You must be signed in to change notification settings - Fork 497
/
PipeManager.java
executable file
·76 lines (63 loc) · 2.41 KB
/
PipeManager.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
66
67
68
69
70
71
72
73
74
75
76
/**
* Copyright (c) 2011-2014, 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.pipes;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.minecraft.world.World;
import buildcraft.api.transport.IExtractionHandler;
public abstract class PipeManager {
public static List<IStripesHandler> stripesHandlers = new ArrayList<IStripesHandler>();
public static List<IExtractionHandler> extractionHandlers = new ArrayList<IExtractionHandler>();
public static ArrayList<Class<? extends IPipePluggable>> pipePluggables = new ArrayList<Class<? extends IPipePluggable>>();
private static Map<String, Class<? extends IPipePluggable>> pipePluggableNames =
new HashMap<String, Class<? extends IPipePluggable>>();
private static Map<Class<? extends IPipePluggable>, String> pipePluggableByNames =
new HashMap<Class<? extends IPipePluggable>, String>();
public static void registerExtractionHandler(IExtractionHandler handler) {
extractionHandlers.add(handler);
}
public static void registerStripesHandler(IStripesHandler handler) {
stripesHandlers.add(handler);
}
public static void registerPipePluggable(Class<? extends IPipePluggable> pluggable, String name) {
pipePluggables.add(pluggable);
pipePluggableNames.put(name, pluggable);
pipePluggableByNames.put(pluggable, name);
}
/**
* param extractor can be null
*/
public static boolean canExtractItems(Object extractor, World world, int i, int j, int k) {
for (IExtractionHandler handler : extractionHandlers) {
if (!handler.canExtractItems(extractor, world, i, j, k)) {
return false;
}
}
return true;
}
/**
* param extractor can be null
*/
public static boolean canExtractFluids(Object extractor, World world, int i, int j, int k) {
for (IExtractionHandler handler : extractionHandlers) {
if (!handler.canExtractFluids(extractor, world, i, j, k)) {
return false;
}
}
return true;
}
public static Class<?> getPluggableByName(String pluggableName) {
return pipePluggableNames.get(pluggableName);
}
public static String getPluggableName(Class<? extends IPipePluggable> aClass) {
return pipePluggableByNames.get(aClass);
}
}