Apply autofixes

This commit is contained in:
zontreck 2024-05-06 13:45:52 -07:00
parent 5357da3746
commit dd6ee1bf60
15 changed files with 36 additions and 30 deletions

View file

@ -15,8 +15,9 @@ class NbtUtils {
static bool readBoolean(CompoundTag tag, String name) {
if (tag.contains(name)) {
return tag.get(name)!.asByte() == 1 ? true : false;
} else
} else {
return false;
}
}
static void writeVector2d(CompoundTag tag, String name, Vector2d pos) {
@ -30,8 +31,9 @@ class NbtUtils {
if (tag.contains(name)) {
ListTag lst = tag.get(name)! as ListTag;
return Vector2d(X: lst.get(0).asDouble(), Z: lst.get(1).asDouble());
} else
} else {
return Vector2d.ZERO;
}
}
static void writeVector2i(CompoundTag tag, String name, Vector2i pos) {
@ -45,8 +47,9 @@ class NbtUtils {
if (tag.contains(name)) {
ListTag lst = tag.get(name)! as ListTag;
return Vector2i(X: lst.get(0).asInt(), Z: lst.get(1).asInt());
} else
} else {
return Vector2i.ZERO;
}
}
static void writeVector3d(CompoundTag tag, String name, Vector3d pos) {
@ -64,8 +67,9 @@ class NbtUtils {
X: lst.get(0).asDouble(),
Y: lst.get(1).asDouble(),
Z: lst.get(2).asDouble());
} else
} else {
return Vector3d.ZERO;
}
}
static void writeVector3i(CompoundTag tag, String name, Vector3i pos) {
@ -81,7 +85,8 @@ class NbtUtils {
ListTag lst = tag.get(name)! as ListTag;
return Vector3i(
X: lst.get(0).asInt(), Y: lst.get(1).asInt(), Z: lst.get(2).asInt());
} else
} else {
return Vector3i.ZERO;
}
}
}

View file

@ -279,10 +279,10 @@ class NBTAccountant {
static void leaveTag(Tag tag) {
if (tag is CompoundTag || tag is ListTag) {
if (tag is CompoundTag) {
CompoundTag ct = tag as CompoundTag;
CompoundTag ct = tag;
ct.endPrettyPrint(_prettyIndex);
} else if (tag is ListTag) {
ListTag lt = tag as ListTag;
ListTag lt = tag;
lt.endPrettyPrint(_prettyIndex);
}
}

View file

@ -39,11 +39,11 @@ class ByteArrayTag extends Tag {
void prettyPrint(int indent, bool recurse) {
String array = "";
for (int b in value) {
array += "${b}, ";
array += "$b, ";
}
array = array.substring(0, array.length - 2);
print(
"${"".padLeft(indent, '\t')}${Tag.getCanonicalName(getTagType())}: [${array}]");
"${"".padLeft(indent, '\t')}${Tag.getCanonicalName(getTagType())}: [$array]");
}
}

View file

@ -32,6 +32,6 @@ class ByteTag extends Tag {
@override
void prettyPrint(int indent, bool recurse) {
print(
"${"".padLeft(indent, '\t')}${Tag.getCanonicalName(getTagType())}: ${value}");
"${"".padLeft(indent, '\t')}${Tag.getCanonicalName(getTagType())}: $value");
}
}

View file

@ -32,6 +32,6 @@ class DoubleTag extends Tag {
@override
void prettyPrint(int indent, bool recurse) {
print(
"${"".padLeft(indent, '\t')}${Tag.getCanonicalName(getTagType())}: ${value}");
"${"".padLeft(indent, '\t')}${Tag.getCanonicalName(getTagType())}: $value");
}
}

View file

@ -31,6 +31,6 @@ class FloatTag extends Tag {
@override
void prettyPrint(int indent, bool recurse) {
print(
"${"".padLeft(indent, '\t')}${Tag.getCanonicalName(getTagType())}: ${value}");
"${"".padLeft(indent, '\t')}${Tag.getCanonicalName(getTagType())}: $value");
}
}

View file

@ -34,11 +34,11 @@ class IntArrayTag extends Tag {
void prettyPrint(int indent, bool recurse) {
String array = "";
for (int b in value) {
array += "${b}, ";
array += "$b, ";
}
array = array.substring(0, array.length - 2);
print(
"${"".padLeft(indent, '\t')}${Tag.getCanonicalName(getTagType())}: [${array}]");
"${"".padLeft(indent, '\t')}${Tag.getCanonicalName(getTagType())}: [$array]");
}
}

View file

@ -31,6 +31,6 @@ class IntTag extends Tag {
@override
void prettyPrint(int indent, bool recurse) {
print(
"${"".padLeft(indent, '\t')}${Tag.getCanonicalName(getTagType())}: ${value}");
"${"".padLeft(indent, '\t')}${Tag.getCanonicalName(getTagType())}: $value");
}
}

View file

@ -45,10 +45,11 @@ class ListTag extends Tag {
}
Tag get(int index) {
if (size() > index)
if (size() > index) {
return value[index];
else
} else {
return EndTag();
}
}
void remove(Tag tag) {

View file

@ -42,11 +42,11 @@ class LongArrayTag extends Tag {
void prettyPrint(int indent, bool recurse) {
String array = "";
for (int b in value) {
array += "${b}, ";
array += "$b, ";
}
array = array.substring(0, array.length - 2);
print(
"${"".padLeft(indent, '\t')}${Tag.getCanonicalName(getTagType())}: [${array}]");
"${"".padLeft(indent, '\t')}${Tag.getCanonicalName(getTagType())}: [$array]");
}
}

View file

@ -31,6 +31,6 @@ class LongTag extends Tag {
@override
void prettyPrint(int indent, bool recurse) {
print(
"${"".padLeft(indent, '\t')}${Tag.getCanonicalName(getTagType())}: ${value}");
"${"".padLeft(indent, '\t')}${Tag.getCanonicalName(getTagType())}: $value");
}
}

View file

@ -31,6 +31,6 @@ class ShortTag extends Tag {
@override
void prettyPrint(int indent, bool recurse) {
print(
"${"".padLeft(indent, '\t')}${Tag.getCanonicalName(getTagType())}: ${value}");
"${"".padLeft(indent, '\t')}${Tag.getCanonicalName(getTagType())}: $value");
}
}

View file

@ -31,6 +31,6 @@ class StringTag extends Tag {
@override
void prettyPrint(int indent, bool recurse) {
print(
"${"".padLeft(indent, '\t')}${Tag.getCanonicalName(getTagType())}: ${value}");
"${"".padLeft(indent, '\t')}${Tag.getCanonicalName(getTagType())}: $value");
}
}

View file

@ -8,7 +8,7 @@ class Vector2d {
@override
bool operator ==(Object otherz) {
if (otherz is Vector2d) {
Vector2d other = otherz as Vector2d;
Vector2d other = otherz;
return X == other.X && Z == other.Z;
}
return false;
@ -60,7 +60,7 @@ class Vector2d {
@override
String toString() {
return "<${X}, ${Z}>";
return "<$X, $Z>";
}
bool inside(Vector2d min, Vector2d max) {
@ -84,7 +84,7 @@ class Vector2i {
@override
bool operator ==(Object otherz) {
if (otherz is Vector2i) {
Vector2i other = otherz as Vector2i;
Vector2i other = otherz;
return X == other.X && Z == other.Z;
}
return false;
@ -136,7 +136,7 @@ class Vector2i {
@override
String toString() {
return "<${X}, ${Z}>";
return "<$X, $Z>";
}
bool inside(Vector2i min, Vector2i max) {

View file

@ -9,7 +9,7 @@ class Vector3d {
@override
bool operator ==(Object otherz) {
if (otherz is Vector3d) {
Vector3d other = otherz as Vector3d;
Vector3d other = otherz;
return X == other.X && Y == other.Y && Z == other.Z;
}
return false;
@ -65,7 +65,7 @@ class Vector3d {
@override
String toString() {
return "<${X}, ${Y}, ${Z}>";
return "<$X, $Y, $Z>";
}
bool inside(Vector3d min, Vector3d max) {
@ -92,7 +92,7 @@ class Vector3i {
@override
bool operator ==(Object otherz) {
if (otherz is Vector3i) {
Vector3i other = otherz as Vector3i;
Vector3i other = otherz;
return X == other.X && Y == other.Y && Z == other.Z;
}
return false;
@ -148,7 +148,7 @@ class Vector3i {
@override
String toString() {
return "<${X}, ${Y}, ${Z}>";
return "<$X, $Y, $Z>";
}
bool inside(Vector3i min, Vector3i max) {