Attempt to fix web viewer being unable to load NBT

This commit is contained in:
zontreck 2025-05-25 13:33:27 -07:00
parent 4a8d515f4d
commit b1063f5057
4 changed files with 16 additions and 7 deletions

View file

@ -264,6 +264,7 @@ class SessionData {
Map<String, dynamic> payload = {
"cmd": "create",
"type": "nbt",
"data": base64Encoder.encode(nbtData),
};
@ -444,6 +445,7 @@ class SessionData {
if (cType == "application/json") {
return LoadData(reply.data as Map<String, dynamic>);
} else if (cType == "application/nbt") {
print("Data is in NBT Format");
Uint8List lst = base64Encoder.decode(reply.data as String);
// Convert this to a CompoundTag
CompoundTag ct = await NbtIo.readFromStream(lst) as CompoundTag;
@ -451,7 +453,11 @@ class SessionData {
return true;
} else
return false;
} catch (E) {
} catch (E, stack) {
print(E);
print(stack);
return false;
}
}