Documentation ¶
Index ¶
- func BinaryTagToJSON(tag *nbt.RawMessage) (json.RawMessage, error)
- func ConvertToSNBT(v any, b *strings.Builder) error
- func JsonToBinaryTag(j json.RawMessage) (nbt.RawMessage, error)
- func JsonToSNBT(j json.RawMessage) (string, error)
- func SnbtToBinaryTag(snbt string) (nbt.RawMessage, error)
- func SnbtToJSON(snbt string) (json.RawMessage, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BinaryTagToJSON ¶
func BinaryTagToJSON(tag *nbt.RawMessage) (json.RawMessage, error)
BinaryTagToJSON converts a binary tag to JSON.
func ConvertToSNBT ¶
ConvertToSNBT converts a map[string]any to stringified NBT by writing to a strings.Builder.
func JsonToBinaryTag ¶
func JsonToBinaryTag(j json.RawMessage) (nbt.RawMessage, error)
JsonToBinaryTag converts a JSON to binary tag.
Note that type information such as boolean is lost in the conversion, since SNBT uses 1 and 0 byte values for booleans which are not distinguishable from JSON numbers.
Example: {"a":1,"b":"hello","c":"world","d":true} -> {a:1,b:hello,c:"world",d:1}
func JsonToSNBT ¶
func JsonToSNBT(j json.RawMessage) (string, error)
JsonToSNBT converts a JSON to stringified NBT. Example: {"a":1,"b":"hello","c":"world","d":true} -> {a:1,b:"hello",c:"world",d:1}
func SnbtToBinaryTag ¶
func SnbtToBinaryTag(snbt string) (nbt.RawMessage, error)
SnbtToBinaryTag converts a stringified NBT to binary tag.
func SnbtToJSON ¶
func SnbtToJSON(snbt string) (json.RawMessage, error)
SnbtToJSON converts a stringified NBT to JSON. Example: {a:1,b:hello,c:"world",d:true} -> {"a":1,"b":"hello","c":"world","d":true}
Types ¶
This section is empty.