SNBT Serialization now implemented

This commit is contained in:
zontreck 2024-05-08 20:35:08 -07:00
parent 84b37f8b04
commit daf9cb7376
16 changed files with 54 additions and 28 deletions

View file

@ -85,7 +85,7 @@ abstract class Tag {
static void writeStringifiedNamedTag(
Tag tag, StringBuilder builder, int indents) {
if (tag.getType() != 0) {
if (builder != "") {
if (!builder.isEmpty) {
// Write name
if (tag.shouldQuoteName()) {
builder.append("${"".padLeft(indents, "\t")}\"${tag.getKey()}\": ");
@ -93,7 +93,7 @@ abstract class Tag {
builder.append("${"".padLeft(indents, '\t')}${tag.getKey()}: ");
}
tag.writeStringifiedValue(builder, indents + 1);
tag.writeStringifiedValue(builder, indents + 1, false);
}
}
@ -112,7 +112,7 @@ abstract class Tag {
}
}
void writeStringifiedValue(StringBuilder builder, int indent);
void writeStringifiedValue(StringBuilder builder, int indent, bool isList);
bool equals(dynamic object) {
if (object == null || object is! Tag) return false;