writeTag method

  1. @override
void writeTag(
  1. NbtWriter nbtWriter, {
  2. bool withName = true,
  3. bool withType = true,
})
override

Writes a NbtTag from fileReader. If the parent is a NbtList or NbtArray, withName should be set to false to avoid writing any names of this Tag.

Implementation

@override
void writeTag(NbtWriter nbtWriter,
    {bool withName = true, bool withType = true}) {
  if (withType) nbtWriter.writeByte(nbtTagType.index);
  if (withName) {
    nbtWriter.writeString(name);
  }
  nbtWriter.writeInt(children.length, signed: true);
  for (final val in children) {
    nbtWriter.writeLong(val, signed: true);
  }
}