String jsonNbt = “”;
CompoundNBT compoundNBT = … load from jsonNbt
How can I get CompoundNBT from Json String (nbtstring) in sponge 8.0 ?
Please help me.
String jsonNbt = “”;
CompoundNBT compoundNBT = … load from jsonNbt
How can I get CompoundNBT from Json String (nbtstring) in sponge 8.0 ?
Please help me.
Perhaps this will help you.
Thank for you care! I love you plugins! It is useful for me!
but How can I load CompoundNBT from string ?
You’d better copy my code, or make a dependency on my plugin. I have implemented all necessary methods to work with NBT as in NMS.
It error. How can I fix it ? this is my code.
String nbtString = “something json nbt”;
CompoundNBT nbt = (CompoundNBT) DataFormats.JSON.get().read(nbtString);
This is an error.
com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 3 path $.
You cannot create a Json string by yourself. It must strictly match the one you can get from the item. One mismatch and you will get an error. I don’t recommend to edit Json strings of NBT tags manually, better use the class I gave you.
The class I provided will work equally well in both Vanilla and Forge.
Thank you so much!