diff --git a/lib/nbt/NbtIo.dart b/lib/nbt/NbtIo.dart index 5d64f6b..f7ffcdd 100644 --- a/lib/nbt/NbtIo.dart +++ b/lib/nbt/NbtIo.dart @@ -33,11 +33,15 @@ class NbtIo { return Tag.readNamedTag(_io) as CompoundTag; } - static Future write(String file) async { + static Future write(String file, CompoundTag tag) async { + _io = ByteLayer(); + Tag.writeNamedTag(tag, _io); await _io.writeToFile(file); } - static Future writeCompressed(String file) async { + static Future writeCompressed(String file, CompoundTag tag) async { + _io = ByteLayer(); + Tag.writeNamedTag(tag, _io); await _io.compress(); await _io.writeToFile(file); }