gonbt

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2021 License: MIT Imports: 8 Imported by: 1

README

gonbt

A Minecraft NBT parser

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompactJson

func CompactJson(tag *Tag) string

func CompactStringify

func CompactStringify(tag *Tag) string

func Decode

func Decode(r io.Reader, tag *Tag) error

func Encode

func Encode(w io.Writer, tag *Tag) error

func Json

func Json(tag *Tag) string

func Parse

func Parse(bm *SnbtTokenBitmaps, tag *Tag) error

func PrettyJson

func PrettyJson(tag *Tag, space string, indent string) string

func PrettyStringify

func PrettyStringify(tag *Tag, space string, indent string) string

func Stringify

func Stringify(tag *Tag) string

Types

type ByteArrayPayload

type ByteArrayPayload []int8

Payload

func (*ByteArrayPayload) Decode

func (p *ByteArrayPayload) Decode(r io.Reader) error

func (*ByteArrayPayload) Encode

func (p *ByteArrayPayload) Encode(w io.Writer) error

func (*ByteArrayPayload) Json

func (p *ByteArrayPayload) Json(space string, indent string, depth int) string

func (*ByteArrayPayload) Parse

func (p *ByteArrayPayload) Parse(bm *SnbtTokenBitmaps) error

func (*ByteArrayPayload) Stringify

func (p *ByteArrayPayload) Stringify(space string, indent string, depth int) string

func (*ByteArrayPayload) TypeId

func (p *ByteArrayPayload) TypeId() TagType

type ByteArrayTag

type ByteArrayTag struct {
	TagName
	ByteArrayPayload
}

Tag

func (*ByteArrayTag) Decode

func (t *ByteArrayTag) Decode(r io.Reader) error

func (*ByteArrayTag) Encode

func (t *ByteArrayTag) Encode(w io.Writer) error

func (*ByteArrayTag) Json

func (t *ByteArrayTag) Json(space string, indent string, depth int) string

func (*ByteArrayTag) Parse

func (t *ByteArrayTag) Parse(bm *SnbtTokenBitmaps) error

func (*ByteArrayTag) Stringify

func (t *ByteArrayTag) Stringify(space string, indent string, depth int) string

func (*ByteArrayTag) TypeId

func (t *ByteArrayTag) TypeId() TagType

type BytePayload

type BytePayload int8

Payload

func BytePayloadPtr

func BytePayloadPtr(x BytePayload) *BytePayload

Payload

func (*BytePayload) Decode

func (p *BytePayload) Decode(r io.Reader) error

Payload

func (*BytePayload) Encode

func (p *BytePayload) Encode(w io.Writer) error

Payload

func (*BytePayload) Json

func (p *BytePayload) Json(space string, indent string, depth int) string

Payload

func (*BytePayload) Parse

func (p *BytePayload) Parse(bm *SnbtTokenBitmaps) error

Payload

func (*BytePayload) Stringify

func (p *BytePayload) Stringify(space string, indent string, depth int) string

Payload

func (*BytePayload) TypeId

func (p *BytePayload) TypeId() TagType

Payload

type ByteTag

type ByteTag struct {
	TagName
	BytePayload
}

Tag

func (*ByteTag) Decode

func (t *ByteTag) Decode(r io.Reader) error

func (*ByteTag) Encode

func (t *ByteTag) Encode(w io.Writer) error

func (*ByteTag) Json

func (t *ByteTag) Json(space string, indent string, depth int) string

func (*ByteTag) Parse

func (t *ByteTag) Parse(bm *SnbtTokenBitmaps) error

func (*ByteTag) Stringify

func (t *ByteTag) Stringify(space string, indent string, depth int) string

func (*ByteTag) TypeId

func (t *ByteTag) TypeId() TagType

type CompoundPayload

type CompoundPayload []Tag

Payload

func (*CompoundPayload) Decode

func (p *CompoundPayload) Decode(r io.Reader) error

func (*CompoundPayload) Encode

func (p *CompoundPayload) Encode(w io.Writer) error

func (*CompoundPayload) Json

func (p *CompoundPayload) Json(space string, indent string, depth int) string

func (*CompoundPayload) Parse

func (p *CompoundPayload) Parse(bm *SnbtTokenBitmaps) error

func (*CompoundPayload) Stringify

func (p *CompoundPayload) Stringify(space string, indent string, depth int) string

func (*CompoundPayload) TypeId

func (p *CompoundPayload) TypeId() TagType

type CompoundTag

type CompoundTag struct {
	TagName
	CompoundPayload
}

Tag

func (*CompoundTag) Decode

func (t *CompoundTag) Decode(r io.Reader) error

func (*CompoundTag) Encode

func (t *CompoundTag) Encode(w io.Writer) error

func (*CompoundTag) Json

func (t *CompoundTag) Json(space string, indent string, depth int) string

func (*CompoundTag) Parse

func (t *CompoundTag) Parse(bm *SnbtTokenBitmaps) error

func (*CompoundTag) Stringify

func (t *CompoundTag) Stringify(space string, indent string, depth int) string

func (*CompoundTag) TypeId

func (t *CompoundTag) TypeId() TagType

type DoublePayload

type DoublePayload float64

Payload

func DoublePayloadPtr

func DoublePayloadPtr(x DoublePayload) *DoublePayload

func (*DoublePayload) Decode

func (p *DoublePayload) Decode(r io.Reader) error

func (*DoublePayload) Encode

func (p *DoublePayload) Encode(w io.Writer) error

func (*DoublePayload) Json

func (p *DoublePayload) Json(space string, indent string, depth int) string

func (*DoublePayload) Parse

func (p *DoublePayload) Parse(bm *SnbtTokenBitmaps) error

func (*DoublePayload) Stringify

func (p *DoublePayload) Stringify(space string, indent string, depth int) string

func (*DoublePayload) TypeId

func (p *DoublePayload) TypeId() TagType

type DoubleTag

type DoubleTag struct {
	TagName
	DoublePayload
}

Tag

func (*DoubleTag) Decode

func (t *DoubleTag) Decode(r io.Reader) error

func (*DoubleTag) Encode

func (t *DoubleTag) Encode(w io.Writer) error

func (*DoubleTag) Json

func (t *DoubleTag) Json(space string, indent string, depth int) string

func (*DoubleTag) Parse

func (t *DoubleTag) Parse(bm *SnbtTokenBitmaps) error

func (*DoubleTag) Stringify

func (t *DoubleTag) Stringify(space string, indent string, depth int) string

func (*DoubleTag) TypeId

func (t *DoubleTag) TypeId() TagType

type EndTag

type EndTag struct {
}

Tag

func (*EndTag) Decode

func (t *EndTag) Decode(r io.Reader) error

Tag

func (*EndTag) Encode

func (t *EndTag) Encode(w io.Writer) error

Tag

func (*EndTag) Json

func (t *EndTag) Json(space string, indent string, depth int) string

Tag

func (*EndTag) Parse

func (t *EndTag) Parse(bm *SnbtTokenBitmaps) error

Tag

func (*EndTag) Stringify

func (t *EndTag) Stringify(space string, indent string, depth int) string

Tag

func (*EndTag) TypeId

func (t *EndTag) TypeId() TagType

Tag

type FloatPayload

type FloatPayload float32

Payload

func FloatPayloadPtr

func FloatPayloadPtr(x FloatPayload) *FloatPayload

func (*FloatPayload) Decode

func (p *FloatPayload) Decode(r io.Reader) error

func (*FloatPayload) Encode

func (p *FloatPayload) Encode(w io.Writer) error

func (*FloatPayload) Json

func (p *FloatPayload) Json(space string, indent string, depth int) string

func (*FloatPayload) Parse

func (p *FloatPayload) Parse(bm *SnbtTokenBitmaps) error

func (*FloatPayload) Stringify

func (p *FloatPayload) Stringify(space string, indent string, depth int) string

func (*FloatPayload) TypeId

func (p *FloatPayload) TypeId() TagType

type FloatTag

type FloatTag struct {
	TagName
	FloatPayload
}

Tag

func (*FloatTag) Decode

func (t *FloatTag) Decode(r io.Reader) error

func (*FloatTag) Encode

func (t *FloatTag) Encode(w io.Writer) error

func (*FloatTag) Json

func (t *FloatTag) Json(space string, indent string, depth int) string

func (*FloatTag) Parse

func (t *FloatTag) Parse(bm *SnbtTokenBitmaps) error

func (*FloatTag) Stringify

func (t *FloatTag) Stringify(space string, indent string, depth int) string

func (*FloatTag) TypeId

func (t *FloatTag) TypeId() TagType

type IntArrayPayload

type IntArrayPayload []int32

Payload

func (*IntArrayPayload) Decode

func (p *IntArrayPayload) Decode(r io.Reader) error

func (*IntArrayPayload) Encode

func (p *IntArrayPayload) Encode(w io.Writer) error

func (*IntArrayPayload) Json

func (p *IntArrayPayload) Json(space string, indent string, depth int) string

func (*IntArrayPayload) Parse

func (p *IntArrayPayload) Parse(bm *SnbtTokenBitmaps) error

func (*IntArrayPayload) Stringify

func (p *IntArrayPayload) Stringify(space string, indent string, depth int) string

func (*IntArrayPayload) TypeId

func (p *IntArrayPayload) TypeId() TagType

type IntArrayTag

type IntArrayTag struct {
	TagName
	IntArrayPayload
}

Tag

func (*IntArrayTag) Decode

func (t *IntArrayTag) Decode(r io.Reader) error

func (*IntArrayTag) Encode

func (t *IntArrayTag) Encode(w io.Writer) error

func (*IntArrayTag) Json

func (t *IntArrayTag) Json(space string, indent string, depth int) string

func (*IntArrayTag) Parse

func (t *IntArrayTag) Parse(bm *SnbtTokenBitmaps) error

func (*IntArrayTag) Stringify

func (t *IntArrayTag) Stringify(space string, indent string, depth int) string

func (*IntArrayTag) TypeId

func (t *IntArrayTag) TypeId() TagType

type IntPayload

type IntPayload int32

Payload

func IntPayloadPtr

func IntPayloadPtr(x IntPayload) *IntPayload

func (*IntPayload) Decode

func (p *IntPayload) Decode(r io.Reader) error

func (*IntPayload) Encode

func (p *IntPayload) Encode(w io.Writer) error

func (*IntPayload) Json

func (p *IntPayload) Json(space string, indent string, depth int) string

func (*IntPayload) Parse

func (p *IntPayload) Parse(bm *SnbtTokenBitmaps) error

func (*IntPayload) Stringify

func (p *IntPayload) Stringify(space string, indent string, depth int) string

func (*IntPayload) TypeId

func (p *IntPayload) TypeId() TagType

type IntTag

type IntTag struct {
	TagName
	IntPayload
}

Tag

func (*IntTag) Decode

func (t *IntTag) Decode(r io.Reader) error

func (*IntTag) Encode

func (t *IntTag) Encode(w io.Writer) error

func (*IntTag) Json

func (t *IntTag) Json(space string, indent string, depth int) string

func (*IntTag) Parse

func (t *IntTag) Parse(bm *SnbtTokenBitmaps) error

func (*IntTag) Stringify

func (t *IntTag) Stringify(space string, indent string, depth int) string

func (*IntTag) TypeId

func (t *IntTag) TypeId() TagType

type ListPayload

type ListPayload []Payload

Payload

func (*ListPayload) Decode

func (p *ListPayload) Decode(r io.Reader) error

func (*ListPayload) Encode

func (p *ListPayload) Encode(w io.Writer) error

func (*ListPayload) Json

func (p *ListPayload) Json(space string, indent string, depth int) string

func (*ListPayload) Parse

func (p *ListPayload) Parse(bm *SnbtTokenBitmaps) error

func (*ListPayload) Stringify

func (p *ListPayload) Stringify(space string, indent string, depth int) string

func (*ListPayload) TypeId

func (p *ListPayload) TypeId() TagType

type ListTag

type ListTag struct {
	TagName
	ListPayload
}

Tag

func (*ListTag) Decode

func (t *ListTag) Decode(r io.Reader) error

func (*ListTag) Encode

func (t *ListTag) Encode(w io.Writer) error

func (*ListTag) Json

func (t *ListTag) Json(space string, indent string, depth int) string

func (*ListTag) Parse

func (t *ListTag) Parse(bm *SnbtTokenBitmaps) error

func (*ListTag) Stringify

func (t *ListTag) Stringify(space string, indent string, depth int) string

func (*ListTag) TypeId

func (t *ListTag) TypeId() TagType

type LongArrayPayload

type LongArrayPayload []int64

Payload

func (*LongArrayPayload) Decode

func (p *LongArrayPayload) Decode(r io.Reader) error

func (*LongArrayPayload) Encode

func (p *LongArrayPayload) Encode(w io.Writer) error

func (*LongArrayPayload) Json

func (p *LongArrayPayload) Json(space string, indent string, depth int) string

func (*LongArrayPayload) Parse

func (p *LongArrayPayload) Parse(bm *SnbtTokenBitmaps) error

func (*LongArrayPayload) Stringify

func (p *LongArrayPayload) Stringify(space string, indent string, depth int) string

func (*LongArrayPayload) TypeId

func (p *LongArrayPayload) TypeId() TagType

type LongArrayTag

type LongArrayTag struct {
	TagName
	LongArrayPayload
}

Tag

func (*LongArrayTag) Decode

func (t *LongArrayTag) Decode(r io.Reader) error

func (*LongArrayTag) Encode

func (t *LongArrayTag) Encode(w io.Writer) error

func (*LongArrayTag) Json

func (t *LongArrayTag) Json(space string, indent string, depth int) string

func (*LongArrayTag) Parse

func (t *LongArrayTag) Parse(bm *SnbtTokenBitmaps) error

func (*LongArrayTag) Stringify

func (t *LongArrayTag) Stringify(space string, indent string, depth int) string

func (*LongArrayTag) TypeId

func (t *LongArrayTag) TypeId() TagType

type LongPayload

type LongPayload int64

Payload

func LongPayloadPtr

func LongPayloadPtr(x LongPayload) *LongPayload

func (*LongPayload) Decode

func (p *LongPayload) Decode(r io.Reader) error

func (*LongPayload) Encode

func (p *LongPayload) Encode(w io.Writer) error

func (*LongPayload) Json

func (p *LongPayload) Json(space string, indent string, depth int) string

func (*LongPayload) Parse

func (p *LongPayload) Parse(bm *SnbtTokenBitmaps) error

func (*LongPayload) Stringify

func (p *LongPayload) Stringify(space string, indent string, depth int) string

func (*LongPayload) TypeId

func (p *LongPayload) TypeId() TagType

type LongTag

type LongTag struct {
	TagName
	LongPayload
}

Tag

func (*LongTag) Decode

func (t *LongTag) Decode(r io.Reader) error

func (*LongTag) Encode

func (t *LongTag) Encode(w io.Writer) error

func (*LongTag) Json

func (t *LongTag) Json(space string, indent string, depth int) string

func (*LongTag) Parse

func (t *LongTag) Parse(bm *SnbtTokenBitmaps) error

func (*LongTag) Stringify

func (t *LongTag) Stringify(space string, indent string, depth int) string

func (*LongTag) TypeId

func (t *LongTag) TypeId() TagType

type Payload

type Payload interface {
	TypeId() TagType
	Decode(r io.Reader) error
	Encode(w io.Writer) error
	Stringify(string, string, int) string
	Parse(*SnbtTokenBitmaps) error
	Json(string, string, int) string
}

Payload

func NewPayload

func NewPayload(typ TagType) (Payload, error)

func NewPayloadFromSnbt

func NewPayloadFromSnbt(bm *SnbtTokenBitmaps) (Payload, error)

type ShortPayload

type ShortPayload int16

Payload

func ShortPayloadPtr

func ShortPayloadPtr(x ShortPayload) *ShortPayload

func (*ShortPayload) Decode

func (p *ShortPayload) Decode(r io.Reader) error

func (*ShortPayload) Encode

func (p *ShortPayload) Encode(w io.Writer) error

func (*ShortPayload) Json

func (p *ShortPayload) Json(space string, indent string, depth int) string

func (*ShortPayload) Parse

func (p *ShortPayload) Parse(bm *SnbtTokenBitmaps) error

func (*ShortPayload) Stringify

func (p *ShortPayload) Stringify(space string, indent string, depth int) string

func (*ShortPayload) TypeId

func (p *ShortPayload) TypeId() TagType

type ShortTag

type ShortTag struct {
	TagName
	ShortPayload
}

Tag

func (*ShortTag) Decode

func (t *ShortTag) Decode(r io.Reader) error

func (*ShortTag) Encode

func (t *ShortTag) Encode(w io.Writer) error

func (*ShortTag) Json

func (t *ShortTag) Json(space string, indent string, depth int) string

func (*ShortTag) Parse

func (t *ShortTag) Parse(bm *SnbtTokenBitmaps) error

func (*ShortTag) Stringify

func (t *ShortTag) Stringify(space string, indent string, depth int) string

func (*ShortTag) TypeId

func (t *ShortTag) TypeId() TagType

type SnbtTokenBitmaps

type SnbtTokenBitmaps struct {
	Raw              []byte
	StringMaskBitmap []uint64
	ValueMaskBitmap  []uint64
	TokenBitmaps     map[rune][]uint64
	PrevToken        Token
	CurrToken        Token
}

func NewSnbtTokenBitmaps

func NewSnbtTokenBitmaps(snbt string) SnbtTokenBitmaps

func NewSnbtTokenBitmapsWithCapacity

func NewSnbtTokenBitmapsWithCapacity(snbtLen int) SnbtTokenBitmaps

func (*SnbtTokenBitmaps) Compact

func (bm *SnbtTokenBitmaps) Compact() SnbtTokenBitmaps

func (*SnbtTokenBitmaps) NextToken

func (bm *SnbtTokenBitmaps) NextToken(allow, deny string) error

func (*SnbtTokenBitmaps) SetMaskBitmaps

func (bm *SnbtTokenBitmaps) SetMaskBitmaps()

func (*SnbtTokenBitmaps) SetTokenBitmaps

func (bm *SnbtTokenBitmaps) SetTokenBitmaps()

type StringPayload

type StringPayload string

Payload

func StringPayloadPtr

func StringPayloadPtr(x StringPayload) *StringPayload

func (*StringPayload) Decode

func (p *StringPayload) Decode(r io.Reader) error

func (*StringPayload) Encode

func (p *StringPayload) Encode(w io.Writer) error

func (*StringPayload) Json

func (p *StringPayload) Json(space string, indent string, depth int) string

func (*StringPayload) Parse

func (p *StringPayload) Parse(bm *SnbtTokenBitmaps) error

func (*StringPayload) Stringify

func (p *StringPayload) Stringify(space string, indent string, depth int) string

func (*StringPayload) TypeId

func (p *StringPayload) TypeId() TagType

type StringTag

type StringTag struct {
	TagName
	StringPayload
}

Tag

func (*StringTag) Decode

func (t *StringTag) Decode(r io.Reader) error

func (*StringTag) Encode

func (t *StringTag) Encode(w io.Writer) error

func (*StringTag) Json

func (t *StringTag) Json(space string, indent string, depth int) string

func (*StringTag) Parse

func (t *StringTag) Parse(bm *SnbtTokenBitmaps) error

func (*StringTag) Stringify

func (t *StringTag) Stringify(space string, indent string, depth int) string

func (*StringTag) TypeId

func (t *StringTag) TypeId() TagType

type Tag

type Tag interface {
	TypeId() TagType
	Decode(r io.Reader) error
	Encode(w io.Writer) error
	Stringify(string, string, int) string
	Parse(*SnbtTokenBitmaps) error
	Json(string, string, int) string
}

Tag

func NewTag

func NewTag(typ TagType) (Tag, error)

func NewTagFromSnbt

func NewTagFromSnbt(bm *SnbtTokenBitmaps) (Tag, error)

type TagName

type TagName string

Tag Name

func TagNamePtr

func TagNamePtr(x TagName) *TagName

Tag Name

func (*TagName) Decode

func (n *TagName) Decode(r io.Reader) error

Tag Name

func (*TagName) Encode

func (n *TagName) Encode(w io.Writer) error

Tag Name

func (*TagName) Json

func (t *TagName) Json() string

Tag Name

func (*TagName) Stringify

func (t *TagName) Stringify() string

Tag Name

type TagType

type TagType byte
const (
	TagEnd TagType = iota
	TagByte
	TagShort
	TagInt
	TagLong
	TagFloat
	TagDouble
	TagByteArray
	TagString
	TagList
	TagCompound
	TagIntArray
	TagLongArray
)

type Token

type Token struct {
	Char  rune
	Index int
}

Jump to

Keyboard shortcuts

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