-
-
Notifications
You must be signed in to change notification settings - Fork 340
Description
Is there any way to convert between NBTTagCompounds (maybe DataContainers in SpongeAPI) and Strings losslessly? For example, in forge mods we can use net.minecraft.nbt.JsonToNBT#getTagFromJson and net.minecraft.nbt.NBTTagCompound#toString to complete the conversion between those two types, but in SpongeAPI I could not find methods which look like they could do these things.
I have considered converting an NBT to JSON, HOCON, or something else, but both JSON and HOCON only have six types (String, Number, Boolean, Null, Array, and Object) while the number of NBT types is much greater (for example, there are six number types for NBT: Byte, Short, Int, Long, Float, and Double, so I cannot recognize what the type is when I try to deserialize a number in a JSON). What I need is lossless conversion by using SpongeAPI.