snbt

package
v0.0.0-...-d0f2f64 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2022 License: MIT Imports: 5 Imported by: 0

README

SNBT

SNBT (Stringified Name Binary Tag) is a file format introduced by Minecraft to save its data. While there are some already exist good packages to decode those files, the server logs prints its stringified counterpart. This lightweight package is meant to decode a given SNBT to a Go struct.

Basic Usage

bytesToDecode := []byte(`{Base: 1.0d, Name: "minecraft:generic.attack_damage"}`)

bytesStruct := struct {
    Base float64
    Name string
}{}

snbt.Decode(bytesToDecode, &bytesStruct)

fmt.Printf("%+v", bytesStruct) // {Base:1 Name:minecraft:generic.attack_damage}

Resources

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrExhaustedAllTokens = errors.New("exhausted all tokens")

	ErrInvalidToken = errors.New("invalid token")
)
View Source
var (
	ErrIllegalChar = errors.New("illegal character")
)

Functions

func Decode

func Decode(r []byte, s interface{}) error

Decode parses SNBT data to the provided value of a pointer s.

Types

This section is empty.

Jump to

Keyboard shortcuts

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