mirror of
https://github.com/GTNewHorizons/CodeChickenCore.git
synced 2026-11-17 19:15:18 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
86fdd43e45 | ||
|
|
549f769747 | ||
|
|
f37238357b | ||
|
|
cba2e0f642 |
No files matched your search
Vendored
BIN
Binary file not shown.
@@ -55,7 +55,7 @@
|
|||||||
# Darwin, MinGW, and NonStop.
|
# Darwin, MinGW, and NonStop.
|
||||||
#
|
#
|
||||||
# (3) This script is generated from the Groovy template
|
# (3) This script is generated from the Groovy template
|
||||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
# within the Gradle project.
|
# within the Gradle project.
|
||||||
#
|
#
|
||||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
|||||||
@@ -6,8 +6,10 @@ import java.io.PrintWriter;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
public abstract class ConfigTagParent {
|
public abstract class ConfigTagParent {
|
||||||
@@ -21,25 +23,30 @@ public abstract class ConfigTagParent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int compare(ConfigTag o1, ConfigTag o2) {
|
public int compare(ConfigTag o1, ConfigTag o2) {
|
||||||
if (o1.position != o2.position) return compareInt(o1.position, o2.position);
|
if (o1.position != o2.position) return Integer.compare(o1.position, o2.position);
|
||||||
if (o1.brace != o2.brace) return o1.brace ? 1 : -1; // braced one goes after
|
if (o1.brace != o2.brace) return o1.brace ? 1 : -1; // braced one goes after
|
||||||
switch (sortMode) {
|
|
||||||
case 1:
|
if (sortMode == 1) {
|
||||||
if (o1.value == o2.value) return 0;
|
if (Objects.equals(o1.value, o2.value)) return 0;
|
||||||
if (o1.value == null) return 1;
|
if (o1.value == null) return 1;
|
||||||
if (o2.value == null) return -1;
|
if (o2.value == null) return -1;
|
||||||
return o1.value.compareTo(o2.value);
|
return o1.value.compareTo(o2.value);
|
||||||
default:
|
} else {
|
||||||
return o1.name.compareTo(o2.name);
|
return o1.name.compareTo(o2.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int compareInt(int a, int b) {
|
|
||||||
return a == b ? 0 : a < b ? -1 : 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private TreeMap<String, ConfigTag> childtags = new TreeMap<String, ConfigTag>();
|
/**
|
||||||
|
* The immediate child tags of this tag
|
||||||
|
*/
|
||||||
|
private final TreeMap<String, ConfigTag> childtags = new TreeMap<>();
|
||||||
|
/**
|
||||||
|
* A map of all tags in the tree, meaning all tags in this tag and all tags in child tags (recursively). Allows for
|
||||||
|
* quick access to any tag in the tree, without the need to traverse the tree part by part.
|
||||||
|
*/
|
||||||
|
private final Map<String, ConfigTag> allTagsInTree = new HashMap<>();
|
||||||
public String comment;
|
public String comment;
|
||||||
/**
|
/**
|
||||||
* 0 = name, 1 = value
|
* 0 = name, 1 = value
|
||||||
@@ -88,7 +95,7 @@ public abstract class ConfigTagParent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean containsTag(String tagname) {
|
public boolean containsTag(String tagname) {
|
||||||
return getTag(tagname, false) != null;
|
return allTagsInTree.get(tagname) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConfigTag getNewTag(String tagname) {
|
public ConfigTag getNewTag(String tagname) {
|
||||||
@@ -96,6 +103,12 @@ public abstract class ConfigTagParent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ConfigTag getTag(String tagname, boolean create) {
|
public ConfigTag getTag(String tagname, boolean create) {
|
||||||
|
ConfigTag tag = allTagsInTree.get(tagname);
|
||||||
|
if (tag == null && create) return getTagRecursive(tagname, create);
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConfigTag getTagRecursive(String tagname, boolean create) {
|
||||||
int dotpos = tagname.indexOf(".");
|
int dotpos = tagname.indexOf(".");
|
||||||
String basetagname = dotpos == -1 ? tagname : tagname.substring(0, dotpos);
|
String basetagname = dotpos == -1 ? tagname : tagname.substring(0, dotpos);
|
||||||
ConfigTag basetag = childtags.get(basetagname);
|
ConfigTag basetag = childtags.get(basetagname);
|
||||||
@@ -115,6 +128,8 @@ public abstract class ConfigTagParent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean removeTag(String tagname) {
|
public boolean removeTag(String tagname) {
|
||||||
|
removeChildFromFlatMap(tagname);
|
||||||
|
|
||||||
ConfigTag tag = getTag(tagname, false);
|
ConfigTag tag = getTag(tagname, false);
|
||||||
if (tag == null) return false;
|
if (tag == null) return false;
|
||||||
|
|
||||||
@@ -131,6 +146,22 @@ public abstract class ConfigTagParent {
|
|||||||
|
|
||||||
public void addChild(ConfigTag tag) {
|
public void addChild(ConfigTag tag) {
|
||||||
childtags.put(tag.name, tag);
|
childtags.put(tag.name, tag);
|
||||||
|
|
||||||
|
addChildToFlatMap(tag.name, tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addChildToFlatMap(String path, ConfigTag tag) {
|
||||||
|
allTagsInTree.put(path, tag);
|
||||||
|
|
||||||
|
// Stupid cast but these two garbage classes are interlinked anyway
|
||||||
|
if ((this instanceof ConfigTag t) && t.parent != null) t.parent.addChildToFlatMap(t.name + "." + path, tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void removeChildFromFlatMap(String path) {
|
||||||
|
allTagsInTree.remove(path);
|
||||||
|
|
||||||
|
// Stupid cast but these two garbage classes are interlinked anyway
|
||||||
|
if ((this instanceof ConfigTag t) && t.parent != null) t.parent.removeChildFromFlatMap(t.name + "." + path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends ConfigTag> ArrayList<T> getSortedTagList() {
|
public <T extends ConfigTag> ArrayList<T> getSortedTagList() {
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ public class CCRenderState {
|
|||||||
/**
|
/**
|
||||||
* Management class for a vertex attrute such as colour, normal etc This class should handle the loading of the
|
* Management class for a vertex attrute such as colour, normal etc This class should handle the loading of the
|
||||||
* attrute from an array provided by IVertexSource.getAttributes or the computation of this attrute from others
|
* attrute from an array provided by IVertexSource.getAttributes or the computation of this attrute from others
|
||||||
*
|
*
|
||||||
* @param <T> The array type for this attrute eg. int[], Vector3[]
|
* @param <T> The array type for this attrute eg. int[], Vector3[]
|
||||||
*/
|
*/
|
||||||
public abstract static class VertexAttribute<T> implements IVertexOperation {
|
public abstract static class VertexAttribute<T> implements IVertexOperation {
|
||||||
@@ -146,7 +146,7 @@ public class CCRenderState {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets an array of vertex attrutes
|
* Gets an array of vertex attrutes
|
||||||
*
|
*
|
||||||
* @param attr The vertex attrute to get
|
* @param attr The vertex attrute to get
|
||||||
* @param <T> The attrute array type
|
* @param <T> The attrute array type
|
||||||
* @return An array, or null if not computed
|
* @return An array, or null if not computed
|
||||||
@@ -503,7 +503,7 @@ public class CCRenderState {
|
|||||||
instance().setBrightnessInstance(world, x, y, z);
|
instance().setBrightnessInstance(world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void pullLightMap() {
|
public static void pullLightmap() {
|
||||||
instance().pullLightmapInstance();
|
instance().pullLightmapInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user