Add support to be able to open SNBT using the Open Menu option

This commit is contained in:
zontreck 2025-01-24 08:22:45 -07:00
parent c53b060739
commit fc6a268792
3 changed files with 9 additions and 4 deletions

View file

@ -1 +1 @@
const VERSION = "1.1.012325+1215";
const VERSION = "1.1.012425+0821";

View file

@ -109,7 +109,8 @@ class EditorState extends State<Editor> {
ListTile(
title: const Text("O P E N"),
leading: const Icon(Icons.folder),
subtitle: const Text("Open an existing NBT Document for editing"),
subtitle:
const Text("Open an existing NBT/SNBT Document for editing"),
onTap: () async {
if (await needsPermissionsPage()) {
Navigator.pushNamed(context, "/perms");
@ -130,7 +131,11 @@ class EditorState extends State<Editor> {
return;
} else {
// String!!
CompoundTag ct = await NbtIo.read(filePath);
CompoundTag ct = CompoundTag();
if (filePath.endsWith(".txt") || filePath.endsWith(".snbt")) {
ct = await SnbtIo.readFromFile(filePath) as CompoundTag;
} else
CompoundTag ct = await NbtIo.read(filePath);
SessionData.ROOT_TAG = ct;
}

View file

@ -1,7 +1,7 @@
name: nbteditor
description: A Minecraft NBT Editor written in Flutter
publish_to: "none"
version: 1.1.012325+1215
version: 1.1.012425+0821
environment:
sdk: ^3.6.1