fix: implement topBitSetTerminatedArray, fix nbt TAG_End, fix entity_equipment
- Implement topBitSetTerminatedArray decoder/encoder with MSB continuation - Fix nbt.Tag.Decode to handle TAG_End at root level (fixes 1.8 slot NBT) - Remove 228 now-passing decode failure tests, keep 10 still failing - EntityEquipment now works correctly across all versions
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// Code generated by strom. DO NOT EDIT.
|
||||
// source: minecraft-data/pc/1.21.8/protocol.json (sha256:930fbb4c69fd2ecadddcee3c38d3f02908adc23b54b707cb21112e7ab1e9dba1)
|
||||
// version: v0.6.6-0.20260805154326-fa70ea36c6f5+dirty (go1.26.2)
|
||||
// version: v0.6.6-0.20260805170503-1d8f70c7fdae+dirty (go1.26.2)
|
||||
package v1_21_8
|
||||
|
||||
import (
|
||||
@@ -15030,15 +15030,79 @@ func (ret *PlayToClientPacketEntityEffect) Encode(w io.Writer) (err error) {
|
||||
}
|
||||
|
||||
type PlayToClientPacketEntityEquipment struct {
|
||||
Val proto_base.ToDo
|
||||
EntityId int32
|
||||
Equipments []struct {
|
||||
Slot int8
|
||||
Item Slot
|
||||
}
|
||||
}
|
||||
|
||||
func (ret *PlayToClientPacketEntityEquipment) Decode(r io.ReadSeeker) (err error) {
|
||||
err = proto_base.ToDoError
|
||||
ret.EntityId, err = proto_base.DecodeVarInt(r)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
ret.Equipments = []struct {
|
||||
Slot int8
|
||||
Item Slot
|
||||
}{}
|
||||
for {
|
||||
var PlayToClientPacketEntityEquipmentEquipmentsHeader uint8
|
||||
err = binary.Read(r, binary.BigEndian, &PlayToClientPacketEntityEquipmentEquipmentsHeader)
|
||||
if err == io.EOF {
|
||||
err = nil
|
||||
break
|
||||
}
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
_, err = r.Seek(-1, io.SeekCurrent)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
PlayToClientPacketEntityEquipmentEquipmentsHasMore := PlayToClientPacketEntityEquipmentEquipmentsHeader&128 != 0
|
||||
var PlayToClientPacketEntityEquipmentEquipmentsElement struct {
|
||||
Slot int8
|
||||
Item Slot
|
||||
}
|
||||
err = binary.Read(r, binary.BigEndian, &PlayToClientPacketEntityEquipmentEquipmentsElement.Slot)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = PlayToClientPacketEntityEquipmentEquipmentsElement.Item.Decode(r)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
ret.Equipments = append(ret.Equipments, PlayToClientPacketEntityEquipmentEquipmentsElement)
|
||||
if !PlayToClientPacketEntityEquipmentEquipmentsHasMore {
|
||||
break
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
func (ret *PlayToClientPacketEntityEquipment) Encode(w io.Writer) (err error) {
|
||||
err = proto_base.ToDoError
|
||||
err = proto_base.EncodeVarInt(w, ret.EntityId)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
for iPlayToClientPacketEntityEquipmentEquipments, PlayToClientPacketEntityEquipmentEquipmentsElem := range ret.Equipments {
|
||||
if iPlayToClientPacketEntityEquipmentEquipments != len(ret.Equipments)-1 {
|
||||
err = binary.Write(w, binary.BigEndian, int8(uint8(PlayToClientPacketEntityEquipmentEquipmentsElem.Slot)|128))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
} else {
|
||||
err = binary.Write(w, binary.BigEndian, PlayToClientPacketEntityEquipmentEquipmentsElem.Slot)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
PlayToClientPacketEntityEquipmentEquipmentsItemEncTmp := PlayToClientPacketEntityEquipmentEquipmentsElem.Item
|
||||
err = PlayToClientPacketEntityEquipmentEquipmentsItemEncTmp.Encode(w)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user