-
Notifications
You must be signed in to change notification settings - Fork 497
/
BCConfigElement.java
57 lines (48 loc) · 1.34 KB
/
BCConfigElement.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
package buildcraft.core.config;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import cpw.mods.fml.client.config.IConfigElement;
import net.minecraftforge.common.config.ConfigCategory;
import net.minecraftforge.common.config.ConfigElement;
import net.minecraftforge.common.config.Property;
public class BCConfigElement<T> extends ConfigElement<T> {
private ConfigCategory cat;
private boolean isProp;
public BCConfigElement(ConfigCategory ctgy) {
super(ctgy);
cat = ctgy;
isProp = false;
}
public BCConfigElement(Property prop) {
super(prop);
isProp = true;
}
@Override
public List<IConfigElement> getChildElements() {
if (!isProp) {
List<IConfigElement> elements = new ArrayList<IConfigElement>();
Iterator<ConfigCategory> ccI = cat.getChildren().iterator();
Iterator<Property> pI = cat.getOrderedValues().iterator();
while (ccI.hasNext()) {
ConfigCategory child = ccI.next();
if (!child.parent.getQualifiedName().equals(cat.getQualifiedName())) {
continue;
}
ConfigElement temp = new BCConfigElement(child);
if (temp.showInGui()) {
elements.add(temp);
}
}
while (pI.hasNext()) {
ConfigElement<?> temp = getTypedElement(pI.next());
if (temp.showInGui()) {
elements.add(temp);
}
}
return elements;
} else {
return null;
}
}
}