nbtconv

package
v0.36.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

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

func ConvertToSNBT(v any, b *strings.Builder) error

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL