Documentation ¶
Index ¶
- Constants
- Variables
- func Json2Nbt(b []byte) ([]byte, error)
- func Nbt2Json(b []byte, comment string) ([]byte, error)
- func Nbt2Yaml(b []byte, comment string) ([]byte, error)
- func ReadNbt2Json(r *bytes.Reader, comment string, tagCount int) ([]byte, error)
- func ReadNbt2Yaml(r *bytes.Reader, comment string, tagCount int) ([]byte, error)
- func UseBedrockEncoding()
- func UseJavaEncoding()
- func UseLongAsString()
- func UseLongAsUint32Pair()
- func Yaml2Nbt(b []byte) ([]byte, error)
- type JsonParseError
- type NbtJson
- type NbtLong
- type NbtParseError
- type NbtTag
- type NbtTagList
Constants ¶
const Nbt2JsonUrl = "https://github.com/midnightfreddie/nbt2json"
Nbt2JsonUrl is inserted in the json document as nbt2JsonUrl
const Version = "0.4.0"
Version is the json document's nbt2JsonVersion:
Variables ¶
var Name = "Named Binary Tag to JSON"
Name is the json document's name:
Functions ¶
func ReadNbt2Json ¶
ReadNbt2Json reads the given count of top level NBT tags from r and converts it to JSON byte array
func ReadNbt2Yaml ¶
ReadNbt2Yaml reads the given count of top level NBT tags from r and converts it to YAML byte array
func UseBedrockEncoding ¶
func UseBedrockEncoding()
UseBedrockEncoding sets the module to decode/encode from/to little endian NBT for Minecraft Bedrock Edition
func UseJavaEncoding ¶
func UseJavaEncoding()
UseJavaEncoding sets the module to decode/encode from/to big endian NBT for Minecraft Java Edition
func UseLongAsString ¶
func UseLongAsString()
UseLongAsString will make nbt long values as string numbers in the json/yaml
func UseLongAsUint32Pair ¶
func UseLongAsUint32Pair()
UseLongAsUint32Pair will make nbt long values as valueLeast/valueMost uint32 pairs in the json
Types ¶
type JsonParseError ¶
type JsonParseError struct {
// contains filtered or unexported fields
}
JsonParseError is when the json data does not match an expected pattern. Pass it message string and downstream error
func (JsonParseError) Error ¶
func (e JsonParseError) Error() string
type NbtJson ¶
type NbtJson struct { Name string `json:"name"` Version string `json:"version"` Nbt2JsonUrl string `json:"nbt2JsonUrl"` ConversionTime string `json:"conversionTime,omitempty"` Comment string `json:"comment,omitempty"` Nbt []*json.RawMessage `json:"nbt"` }
NbtJson is the top-level JSON document; it is exported for reflect, and client code shouldn't use it
type NbtLong ¶
NbtLong stores a 64-bit int into two 32-bit values for json portability. ValueMost are the high 32 bits and ValueLeast are the low 32 bits.
using uint32s to avoid Go trying to outsmart us on "negative" int32s
type NbtParseError ¶
type NbtParseError struct {
// contains filtered or unexported fields
}
NbtParseError is when the nbt data does not match an expected pattern. Pass it message string and downstream error
func (NbtParseError) Error ¶
func (e NbtParseError) Error() string
type NbtTag ¶
type NbtTag struct { TagType byte `json:"tagType"` Name string `json:"name"` Value interface{} `json:"value,omitempty"` }
NbtTag represents one NBT tag for each struct; it is exported for reflect, and client code shouldn't use it
type NbtTagList ¶
type NbtTagList struct { TagListType byte `json:"tagListType"` List []interface{} `json:"list"` }
NbtTagList represents an NBT tag list; it is exported for reflect, and client code shouldn't use it