can parse TAG_String

This commit is contained in:
JunDao
2019-05-18 01:08:32 +08:00
parent 94fb6502db
commit 9cdab82ea3
4 changed files with 189 additions and 0 deletions

44
nbt/nbt.go Normal file
View File

@ -0,0 +1,44 @@
package nbt
import (
"bufio"
"io"
)
//Tag type IDs
const (
TagEnd byte = iota
TagByte
TagShort
TagInt
TagLong
TagFloat
TagDouble
TagByteArray
TagString
TagList
TagCompound
TagIntArray
TagLongArray
)
type Decoder struct {
r interface {
io.ByteReader
io.Reader
}
nameless bool
}
func NewDecoder(r io.Reader) *Decoder {
d := new(Decoder)
if br, ok := r.(interface {
io.ByteReader
io.Reader
}); ok {
d.r = br
} else {
d.r = bufio.NewReader(r)
}
return d
}