9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-28 11:39:07 +00:00

Oraxen Impl & Fixes

This commit is contained in:
Daniel Mills
2021-08-06 07:39:28 -04:00
parent 6f3813b685
commit 6f9c4f220e
11 changed files with 402 additions and 176 deletions

View File

@@ -51,9 +51,6 @@ public class IrisBlockData extends IrisRegistrant {
@Desc("Debug this block by printing it to the console when it's used. Must have debug turned on in settings.")
private boolean debug = false;
@Desc("The resource key. Typically Minecraft")
private String key = "minecraft";
@MinNumber(1)
@MaxNumber(1000)
@Desc("The weight is used when this block data is inside of a list of blockdata. A weight of two is just as if you placed two of the same block data values in the same list making it more common when randomly picked.")
@@ -115,7 +112,7 @@ public class IrisBlockData extends IrisRegistrant {
cdata.put(i, getData().get(i));
}
String sx = getKey() + ":" + st.split("\\Q:\\E")[1] + computeProperties(cdata);
String sx = keyify(st) + computeProperties(cdata);
if (debug) {
Iris.debug("Block Data used " + sx + " (CUSTOM)");
@@ -133,7 +130,7 @@ public class IrisBlockData extends IrisRegistrant {
}
}
String ss = getKey() + ":" + getBlock() + computeProperties();
String ss = keyify(getBlock()) + computeProperties();
b = B.get(ss);
if (debug) {
@@ -152,34 +149,37 @@ public class IrisBlockData extends IrisRegistrant {
});
}
private String keyify(String dat)
{
if(dat.contains(":"))
{
return dat;
}
return "minecraft:" + dat;
}
public static IrisBlockData from(String j) {
IrisBlockData b = new IrisBlockData();
String m = j.toLowerCase().trim();
String v = j.toLowerCase().trim();
if (m.contains(":")) {
b.setKey(m.split("\\Q:\\E")[0]);
String v = m.split("\\Q:\\E")[1];
if (v.contains("[")) {
KList<String> props = new KList<>();
String rp = v.split("\\Q[\\E")[1].replaceAll("\\Q]\\E", "");
b.setBlock(v.split("\\Q[\\E")[0]);
if (v.contains("[")) {
KList<String> props = new KList<>();
String rp = v.split("\\Q[\\E")[1].replaceAll("\\Q]\\E", "");
b.setBlock(v.split("\\Q[\\E")[0]);
if (rp.contains(",")) {
props.add(rp.split("\\Q,\\E"));
} else {
props.add(rp);
}
for (String i : props) {
Object kg = filter(i.split("\\Q=\\E")[1]);
b.data.put(i.split("\\Q=\\E")[0], kg);
}
if (rp.contains(",")) {
props.add(rp.split("\\Q,\\E"));
} else {
b.setBlock(v);
props.add(rp);
}
for (String i : props) {
Object kg = filter(i.split("\\Q=\\E")[1]);
b.data.put(i.split("\\Q=\\E")[0], kg);
}
} else {
b.setBlock(m);
b.setBlock(v);
}
return b;