Palette support 1
This commit is contained in:
@ -3,11 +3,10 @@ package packet
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"github.com/google/uuid"
|
||||
"io"
|
||||
"math"
|
||||
|
||||
"github.com/google/uuid"
|
||||
|
||||
"github.com/Tnze/go-mc/nbt"
|
||||
)
|
||||
|
||||
|
@ -78,6 +78,20 @@ func (a Ary) ReadFrom(r io.Reader) (n int64, err error) {
|
||||
return n, err
|
||||
}
|
||||
|
||||
// Array return an Ary but handled the previous Length field
|
||||
//
|
||||
// Warning: unstable API, may change in later version
|
||||
func Array(array interface{}) Field {
|
||||
length := VarInt(reflect.ValueOf(array).Len())
|
||||
return Tuple{
|
||||
&length,
|
||||
Ary{
|
||||
Len: &length,
|
||||
Ary: array,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
type Opt struct {
|
||||
Has interface{} // Pointer of bool, or `func() bool`
|
||||
Field interface{} // FieldEncoder, FieldDecoder or both (Field)
|
||||
|
Reference in New Issue
Block a user