mirror of
https://github.com/GTNewHorizons/CraftTweaker.git
synced 2026-11-20 03:59:38 +00:00
- Added MFR support for 1.6.4
- Improved API for blocks - NBT compound tags with non-identifier keys should now be output properly
This commit is contained in:
1 parent
e644398505
commit
e2b4f50dfc
97 files changed
+5307
-216
No files matched your search
@@ -137,7 +137,13 @@ public class DataMap implements IData {
|
||||
} else {
|
||||
result.append(", ");
|
||||
}
|
||||
result.append(entry.getKey());
|
||||
|
||||
if (isValidIdentifier(entry.getKey())) {
|
||||
result.append(entry.getKey());
|
||||
} else {
|
||||
result.append("\"").append(entry.getKey()).append("\"");
|
||||
}
|
||||
|
||||
result.append(": ");
|
||||
result.append(entry.getValue().toString());
|
||||
}
|
||||
@@ -275,4 +281,16 @@ public class DataMap implements IData {
|
||||
public String toString() {
|
||||
return asString();
|
||||
}
|
||||
|
||||
private boolean isValidIdentifier(String str) {
|
||||
if (!Character.isJavaIdentifierStart(str.charAt(0)))
|
||||
return false;
|
||||
|
||||
for (int i = 1; i < str.length(); i++) {
|
||||
if (!Character.isJavaIdentifierPart(str.charAt(i)))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user