#Convert string to NBT?

9 messages · Page 1 of 1 (latest)

magic patrol
#

Is it possible? Something like NBT.fromString(someString)? I'm aware of NBT.toString() but not the other way around.

ocean ironBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

magic patrol
#

Would something like this potentially work?

let nbtString = block.getNbt().toString()
block.setNbt(JSON.parse(nbtString))
sick vortex
magic patrol
#

could be something wrong with my use case though

ruby hawk
#

nbt is auto parsed from a string, for example you can do something like this ```js
block.setNbt({ SomeTag:1b })

#

in this case { SomeTag:1b } is parsed by rhino as a compound tag

#

if you log this value and it follows that format then you can use it directly js let nbtString = block.getNbt().toString() console.log(nbtString)