1.21.8 data
Some checks failed
CodeQL / Analyze (go) (push) Has been cancelled
Go / Test (1.22) (push) Has been cancelled
Go / Test (^1.22) (push) Has been cancelled

This commit is contained in:
2025-08-22 06:17:33 +08:00
parent 133e3fab4a
commit 0958972953
173 changed files with 13782 additions and 406 deletions

View File

@ -489,7 +489,7 @@ func NBT(v any) Field {
type NBTField struct {
V any
AllowUnknownFields bool
DisallowUnknownFields bool
}
func (n NBTField) WriteTo(w io.Writer) (int64, error) {
@ -511,7 +511,7 @@ func (n NBTField) ReadFrom(r io.Reader) (int64, error) {
cr := countingReader{r: r}
dec := nbt.NewDecoder(&cr)
dec.NetworkFormat(true)
if !n.AllowUnknownFields {
if n.DisallowUnknownFields {
dec.DisallowUnknownFields()
}
_, err := dec.Decode(n.V)

View File

@ -192,7 +192,7 @@ func TestNBTField_ReadFrom(t *testing.T) {
t.Errorf("disallow unknown field by default")
}
err = p.Scan(&pk.NBTField{V: &recv, AllowUnknownFields: true})
err = p.Scan(&pk.NBTField{V: &recv, DisallowUnknownFields: true})
if err != nil {
t.Errorf("should allow the unknown field here: %v", err)
}

View File

@ -253,7 +253,7 @@ type IDSet struct {
IDs []int32
}
func (i *IDSet) WriteTo(w io.Writer) (n int64, err error) {
func (i IDSet) WriteTo(w io.Writer) (n int64, err error) {
if i.TagName != "" {
n1, err := VarInt(0).WriteTo(w)
if err != nil {