support block state & nbt improvement

This commit is contained in:
Tnze
2022-03-09 16:12:47 +08:00
parent 86592931c6
commit aa8e611644
915 changed files with 6566 additions and 8605 deletions

View File

@ -21,12 +21,12 @@ func (m RawMessage) TagType() byte {
return m.Type
}
func (m RawMessage) Encode(w io.Writer) error {
func (m RawMessage) MarshalNBT(w io.Writer) error {
_, err := w.Write(m.Data)
return err
}
func (m *RawMessage) Decode(tagType byte, r DecoderReader) error {
func (m *RawMessage) UnmarshalNBT(tagType byte, r DecoderReader) error {
if tagType == TagEnd {
return ErrEND
}
@ -66,7 +66,7 @@ func (m RawMessage) Unmarshal(v interface{}) error {
d := NewDecoder(bytes.NewReader(m.Data))
val := reflect.ValueOf(v)
if val.Kind() != reflect.Ptr {
return errors.New("nbt: non-pointer passed to Decode")
return errors.New("nbt: non-pointer passed to UnmarshalNBT")
}
return d.unmarshal(val, m.Type)
}