diff --git a/cmd/strom/print_replay/testdata/3360_008b70fc9694e956_test.go b/cmd/strom/print_replay/testdata/3360_008b70fc9694e956_test.go index 9fc8932..bab62d4 100644 --- a/cmd/strom/print_replay/testdata/3360_008b70fc9694e956_test.go +++ b/cmd/strom/print_replay/testdata/3360_008b70fc9694e956_test.go @@ -7,7 +7,7 @@ import ( generated "github.com/admin-else/strom/mc/proto_generated/v26_2" ) -// Error: to do +// Error: index not found func TestFailedPacket008B70FC9694E956(t *testing.T) { p := &generated.PlayToClientPacketDeclareRecipes{} b := bytes.NewReader([]byte{0x7, 0x1d, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x62, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x66, 0x75, 0x72, 0x6e, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x3e, 0x62, 0x5e, 0xc2, 0x7, 0x67, 0x66, 0x65, 0x64, 0xe2, 0x7, 0xe0, 0x7, 0xde, 0x7, 0xb1, 0x7, 0xba, 0x7, 0xeb, 0x7, 0xdc, 0x7, 0xdb, 0x7, 0x5f, 0xbc, 0x7, 0xa3, 0x7, 0x6b, 0x5d, 0x6c, 0xbf, 0x7, 0xa7, 0x7, 0xd5, 0xa, 0xd8, 0xa, 0x87, 0xa, 0xe1, 0x7, 0xdf, 0x7, 0x60, 0xb4, 0x7, 0xe5, 0x7, 0xc3, 0x7, 0xda, 0x7, 0xed, 0x7, 0x85, 0xa, 0xb1, 0xa, 0x6a, 0x69, 0x61, 0xbd, 0x7, 0xb2, 0x7, 0x63, 0xb0, 0x7, 0xc0, 0x7, 0xa5, 0x7, 0xec, 0x7, 0x68, 0x5c, 0xdd, 0x7, 0xd4, 0xa, 0xe3, 0x7, 0x5b, 0xea, 0x7, 0xe4, 0x7, 0xc1, 0x7, 0xbe, 0x7, 0xbb, 0x7, 0xb2, 0xa, 0xb3, 0x7, 0x86, 0xa, 0x6d, 0xb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x83, 0x1, 0x1, 0x0, 0x0, 0x2, 0x78, 0x5, 0xde, 0xb, 0x4, 0x0, 0x0, 0x2, 0x78, 0x5, 0x8b, 0x1, 0x4, 0x0, 0x0, 0x2, 0x78, 0x5, 0x9b, 0x1, 0x8, 0x0, 0x0, 0x2, 0x8b, 0x1, 0x5, 0x9b, 0x1, 0x2, 0x0, 0x0, 0x2, 0x78, 0x5, 0x93, 0x1, 0x4, 0x0, 0x0, 0x2, 0x8b, 0x1, 0x5, 0x93, 0x1, 0x1, 0x0, 0x0}) diff --git a/mc/proto_base/base_types.go b/mc/proto_base/base_types.go index c14d688..a058e25 100644 --- a/mc/proto_base/base_types.go +++ b/mc/proto_base/base_types.go @@ -262,6 +262,12 @@ func ErroringIndex[K comparable, V any, M map[K]V](m M, i K) (v V, err error) { return } +// NonErroringIndex looks up key k in map m and returns the zero value without error if not found. +func NonErroringIndex[K comparable, V any, M map[K]V](m M, i K) (v V, err error) { + v, _ = m[i] + return +} + // EncodeDecodeAble is implemented by types that can be encoded and decoded for // Minecraft protocol packets. type EncodeDecodeAble interface { diff --git a/mc/proto_generated/v1_12_2/proto.go b/mc/proto_generated/v1_12_2/proto.go index 9d230ef..4635d72 100644 --- a/mc/proto_generated/v1_12_2/proto.go +++ b/mc/proto_generated/v1_12_2/proto.go @@ -1,6 +1,6 @@ // Code generated by strom. DO NOT EDIT. // source: minecraft-data/pc/1.12.2/protocol.json (sha256:21c57208db654a5e14a34cb696570080df179c5c642e53b16120399eee9232be) -// version: v0.6.6-0.20260805170503-1d8f70c7fdae+dirty (go1.26.2) +// version: v0.6.6-0.20260805173638-56ac8e154ea1+dirty (go1.26.2) package v1_12_2 import ( diff --git a/mc/proto_generated/v1_14_4/proto.go b/mc/proto_generated/v1_14_4/proto.go index 29347c9..92d4d9c 100644 --- a/mc/proto_generated/v1_14_4/proto.go +++ b/mc/proto_generated/v1_14_4/proto.go @@ -1,6 +1,6 @@ // Code generated by strom. DO NOT EDIT. // source: minecraft-data/pc/1.14.4/protocol.json (sha256:b6edff5abaaf234037b5019024d749e27e746250a23253bb4ad77d8f76e93167) -// version: v0.6.6-0.20260805170503-1d8f70c7fdae+dirty (go1.26.2) +// version: v0.6.6-0.20260805173638-56ac8e154ea1+dirty (go1.26.2) package v1_14_4 import ( diff --git a/mc/proto_generated/v1_16_5/proto.go b/mc/proto_generated/v1_16_5/proto.go index 176f9ba..9f1fdfe 100644 --- a/mc/proto_generated/v1_16_5/proto.go +++ b/mc/proto_generated/v1_16_5/proto.go @@ -1,6 +1,6 @@ // Code generated by strom. DO NOT EDIT. // source: minecraft-data/pc/1.16.2/protocol.json (sha256:d96a3c5a7a7ddf2105e23990c2471b3aeafe4a6975e0c9d7d7943b599af9dfb3) -// version: v0.6.6-0.20260805170503-1d8f70c7fdae+dirty (go1.26.2) +// version: v0.6.6-0.20260805173638-56ac8e154ea1+dirty (go1.26.2) package v1_16_5 import ( diff --git a/mc/proto_generated/v1_21_11/proto.go b/mc/proto_generated/v1_21_11/proto.go index 5ac74ca..33f0926 100644 --- a/mc/proto_generated/v1_21_11/proto.go +++ b/mc/proto_generated/v1_21_11/proto.go @@ -1,6 +1,6 @@ // Code generated by strom. DO NOT EDIT. // source: minecraft-data/pc/1.21.11/protocol.json (sha256:97d2726cce3a39cc967a954f27f4ebf029ec3f0f655bb21942aab8745d13cdab) -// version: v0.6.6-0.20260805170503-1d8f70c7fdae+dirty (go1.26.2) +// version: v0.6.6-0.20260805173638-56ac8e154ea1+dirty (go1.26.2) package v1_21_11 import ( @@ -901,11 +901,42 @@ type IDSet struct { } func (ret *IDSet) Decode(r io.ReadSeeker) (err error) { - err = proto_base.ToDoError + var IDSetId int32 + IDSetId, err = proto_base.DecodeVarInt(r) + if err != nil { + return + } + if IDSetId != 0 { + ret.Val = IDSetId + } else { + var IDSetResult string + IDSetResult, err = proto_base.DecodeString(r) + if err != nil { + return + } + ret.Val = IDSetResult + } return } func (ret *IDSet) Encode(w io.Writer) (err error) { - err = proto_base.ToDoError + switch IDSetKnownType := ret.Val.(type) { + case string: + err = proto_base.EncodeVarInt(w, 0) + if err != nil { + return + } + err = proto_base.EncodeString(w, IDSetKnownType) + if err != nil { + return + } + case int32: + err = proto_base.EncodeVarInt(w, IDSetKnownType) + if err != nil { + return + } + default: + err = proto_base.BadTypeError + } return } @@ -965,11 +996,115 @@ type ItemBlockPredicate struct { } func (ret *ItemBlockPredicate) Decode(r io.ReadSeeker) (err error) { - err = proto_base.ToDoError + var ItemBlockPredicateBlockSetPresent bool + err = binary.Read(r, binary.BigEndian, &ItemBlockPredicateBlockSetPresent) + if err != nil { + return + } + if ItemBlockPredicateBlockSetPresent { + var ItemBlockPredicateBlockSetPresentValue any + var ItemBlockPredicateBlockSetId int32 + ItemBlockPredicateBlockSetId, err = proto_base.DecodeVarInt(r) + if err != nil { + return + } + if ItemBlockPredicateBlockSetId != 0 { + ItemBlockPredicateBlockSetPresentValue = ItemBlockPredicateBlockSetId + } else { + var ItemBlockPredicateBlockSetResult string + ItemBlockPredicateBlockSetResult, err = proto_base.DecodeString(r) + if err != nil { + return + } + ItemBlockPredicateBlockSetPresentValue = ItemBlockPredicateBlockSetResult + } + ret.BlockSet = &ItemBlockPredicateBlockSetPresentValue + } + var ItemBlockPredicatePropertiesPresent bool + err = binary.Read(r, binary.BigEndian, &ItemBlockPredicatePropertiesPresent) + if err != nil { + return + } + if ItemBlockPredicatePropertiesPresent { + var ItemBlockPredicatePropertiesPresentValue []ItemBlockProperty + var lItemBlockPredicateProperties int32 + lItemBlockPredicateProperties, err = proto_base.DecodeVarInt(r) + if err != nil { + return + } + ItemBlockPredicatePropertiesPresentValue = []ItemBlockProperty{} + for range lItemBlockPredicateProperties { + var ItemBlockPredicatePropertiesElement ItemBlockProperty + err = ItemBlockPredicatePropertiesElement.Decode(r) + if err != nil { + return + } + ItemBlockPredicatePropertiesPresentValue = append(ItemBlockPredicatePropertiesPresentValue, ItemBlockPredicatePropertiesElement) + } + ret.Properties = &ItemBlockPredicatePropertiesPresentValue + } + err = ret.Nbt.Decode(r) + if err != nil { + return + } + err = ret.Components.Decode(r) + if err != nil { + return + } return } func (ret *ItemBlockPredicate) Encode(w io.Writer) (err error) { - err = proto_base.ToDoError + err = binary.Write(w, binary.BigEndian, ret.BlockSet != nil) + if err != nil { + return + } + if ret.BlockSet != nil { + switch ItemBlockPredicateBlockSetKnownType := (*ret.BlockSet).(type) { + case string: + err = proto_base.EncodeVarInt(w, 0) + if err != nil { + return + } + err = proto_base.EncodeString(w, ItemBlockPredicateBlockSetKnownType) + if err != nil { + return + } + case int32: + err = proto_base.EncodeVarInt(w, ItemBlockPredicateBlockSetKnownType) + if err != nil { + return + } + default: + err = proto_base.BadTypeError + } + } + err = binary.Write(w, binary.BigEndian, ret.Properties != nil) + if err != nil { + return + } + if ret.Properties != nil { + err = proto_base.EncodeVarInt(w, int32(len(*ret.Properties))) + if err != nil { + return + } + for iItemBlockPredicateProperties := range len(*ret.Properties) { + ItemBlockPredicatePropertiesInnerEncTmp := (*ret.Properties)[iItemBlockPredicateProperties] + err = ItemBlockPredicatePropertiesInnerEncTmp.Encode(w) + if err != nil { + return + } + } + } + ItemBlockPredicateNbtEncTmp := ret.Nbt + err = ItemBlockPredicateNbtEncTmp.Encode(w) + if err != nil { + return + } + ItemBlockPredicateComponentsEncTmp := ret.Components + err = ItemBlockPredicateComponentsEncTmp.Encode(w) + if err != nil { + return + } return } diff --git a/mc/proto_generated/v1_21_8/proto.go b/mc/proto_generated/v1_21_8/proto.go index 54f5548..4139620 100644 --- a/mc/proto_generated/v1_21_8/proto.go +++ b/mc/proto_generated/v1_21_8/proto.go @@ -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.20260805170503-1d8f70c7fdae+dirty (go1.26.2) +// version: v0.6.6-0.20260805173638-56ac8e154ea1+dirty (go1.26.2) package v1_21_8 import ( @@ -525,11 +525,42 @@ type IDSet struct { } func (ret *IDSet) Decode(r io.ReadSeeker) (err error) { - err = proto_base.ToDoError + var IDSetId int32 + IDSetId, err = proto_base.DecodeVarInt(r) + if err != nil { + return + } + if IDSetId != 0 { + ret.Val = IDSetId + } else { + var IDSetResult string + IDSetResult, err = proto_base.DecodeString(r) + if err != nil { + return + } + ret.Val = IDSetResult + } return } func (ret *IDSet) Encode(w io.Writer) (err error) { - err = proto_base.ToDoError + switch IDSetKnownType := ret.Val.(type) { + case string: + err = proto_base.EncodeVarInt(w, 0) + if err != nil { + return + } + err = proto_base.EncodeString(w, IDSetKnownType) + if err != nil { + return + } + case int32: + err = proto_base.EncodeVarInt(w, IDSetKnownType) + if err != nil { + return + } + default: + err = proto_base.BadTypeError + } return } @@ -589,11 +620,115 @@ type ItemBlockPredicate struct { } func (ret *ItemBlockPredicate) Decode(r io.ReadSeeker) (err error) { - err = proto_base.ToDoError + var ItemBlockPredicateBlockSetPresent bool + err = binary.Read(r, binary.BigEndian, &ItemBlockPredicateBlockSetPresent) + if err != nil { + return + } + if ItemBlockPredicateBlockSetPresent { + var ItemBlockPredicateBlockSetPresentValue any + var ItemBlockPredicateBlockSetId int32 + ItemBlockPredicateBlockSetId, err = proto_base.DecodeVarInt(r) + if err != nil { + return + } + if ItemBlockPredicateBlockSetId != 0 { + ItemBlockPredicateBlockSetPresentValue = ItemBlockPredicateBlockSetId + } else { + var ItemBlockPredicateBlockSetResult string + ItemBlockPredicateBlockSetResult, err = proto_base.DecodeString(r) + if err != nil { + return + } + ItemBlockPredicateBlockSetPresentValue = ItemBlockPredicateBlockSetResult + } + ret.BlockSet = &ItemBlockPredicateBlockSetPresentValue + } + var ItemBlockPredicatePropertiesPresent bool + err = binary.Read(r, binary.BigEndian, &ItemBlockPredicatePropertiesPresent) + if err != nil { + return + } + if ItemBlockPredicatePropertiesPresent { + var ItemBlockPredicatePropertiesPresentValue []ItemBlockProperty + var lItemBlockPredicateProperties int32 + lItemBlockPredicateProperties, err = proto_base.DecodeVarInt(r) + if err != nil { + return + } + ItemBlockPredicatePropertiesPresentValue = []ItemBlockProperty{} + for range lItemBlockPredicateProperties { + var ItemBlockPredicatePropertiesElement ItemBlockProperty + err = ItemBlockPredicatePropertiesElement.Decode(r) + if err != nil { + return + } + ItemBlockPredicatePropertiesPresentValue = append(ItemBlockPredicatePropertiesPresentValue, ItemBlockPredicatePropertiesElement) + } + ret.Properties = &ItemBlockPredicatePropertiesPresentValue + } + err = ret.Nbt.Decode(r) + if err != nil { + return + } + err = ret.Components.Decode(r) + if err != nil { + return + } return } func (ret *ItemBlockPredicate) Encode(w io.Writer) (err error) { - err = proto_base.ToDoError + err = binary.Write(w, binary.BigEndian, ret.BlockSet != nil) + if err != nil { + return + } + if ret.BlockSet != nil { + switch ItemBlockPredicateBlockSetKnownType := (*ret.BlockSet).(type) { + case string: + err = proto_base.EncodeVarInt(w, 0) + if err != nil { + return + } + err = proto_base.EncodeString(w, ItemBlockPredicateBlockSetKnownType) + if err != nil { + return + } + case int32: + err = proto_base.EncodeVarInt(w, ItemBlockPredicateBlockSetKnownType) + if err != nil { + return + } + default: + err = proto_base.BadTypeError + } + } + err = binary.Write(w, binary.BigEndian, ret.Properties != nil) + if err != nil { + return + } + if ret.Properties != nil { + err = proto_base.EncodeVarInt(w, int32(len(*ret.Properties))) + if err != nil { + return + } + for iItemBlockPredicateProperties := range len(*ret.Properties) { + ItemBlockPredicatePropertiesInnerEncTmp := (*ret.Properties)[iItemBlockPredicateProperties] + err = ItemBlockPredicatePropertiesInnerEncTmp.Encode(w) + if err != nil { + return + } + } + } + ItemBlockPredicateNbtEncTmp := ret.Nbt + err = ItemBlockPredicateNbtEncTmp.Encode(w) + if err != nil { + return + } + ItemBlockPredicateComponentsEncTmp := ret.Components + err = ItemBlockPredicateComponentsEncTmp.Encode(w) + if err != nil { + return + } return } diff --git a/mc/proto_generated/v1_21_9/proto.go b/mc/proto_generated/v1_21_9/proto.go index 6bc9208..c892d76 100644 --- a/mc/proto_generated/v1_21_9/proto.go +++ b/mc/proto_generated/v1_21_9/proto.go @@ -1,6 +1,6 @@ // Code generated by strom. DO NOT EDIT. // source: minecraft-data/pc/1.21.9/protocol.json (sha256:9861cee397931c678c3b1837dcdf82e3fc885442c6bd0e4a60522fbf26653e59) -// version: v0.6.6-0.20260805170503-1d8f70c7fdae+dirty (go1.26.2) +// version: v0.6.6-0.20260805173638-56ac8e154ea1+dirty (go1.26.2) package v1_21_9 import ( @@ -807,11 +807,42 @@ type IDSet struct { } func (ret *IDSet) Decode(r io.ReadSeeker) (err error) { - err = proto_base.ToDoError + var IDSetId int32 + IDSetId, err = proto_base.DecodeVarInt(r) + if err != nil { + return + } + if IDSetId != 0 { + ret.Val = IDSetId + } else { + var IDSetResult string + IDSetResult, err = proto_base.DecodeString(r) + if err != nil { + return + } + ret.Val = IDSetResult + } return } func (ret *IDSet) Encode(w io.Writer) (err error) { - err = proto_base.ToDoError + switch IDSetKnownType := ret.Val.(type) { + case string: + err = proto_base.EncodeVarInt(w, 0) + if err != nil { + return + } + err = proto_base.EncodeString(w, IDSetKnownType) + if err != nil { + return + } + case int32: + err = proto_base.EncodeVarInt(w, IDSetKnownType) + if err != nil { + return + } + default: + err = proto_base.BadTypeError + } return } @@ -871,11 +902,115 @@ type ItemBlockPredicate struct { } func (ret *ItemBlockPredicate) Decode(r io.ReadSeeker) (err error) { - err = proto_base.ToDoError + var ItemBlockPredicateBlockSetPresent bool + err = binary.Read(r, binary.BigEndian, &ItemBlockPredicateBlockSetPresent) + if err != nil { + return + } + if ItemBlockPredicateBlockSetPresent { + var ItemBlockPredicateBlockSetPresentValue any + var ItemBlockPredicateBlockSetId int32 + ItemBlockPredicateBlockSetId, err = proto_base.DecodeVarInt(r) + if err != nil { + return + } + if ItemBlockPredicateBlockSetId != 0 { + ItemBlockPredicateBlockSetPresentValue = ItemBlockPredicateBlockSetId + } else { + var ItemBlockPredicateBlockSetResult string + ItemBlockPredicateBlockSetResult, err = proto_base.DecodeString(r) + if err != nil { + return + } + ItemBlockPredicateBlockSetPresentValue = ItemBlockPredicateBlockSetResult + } + ret.BlockSet = &ItemBlockPredicateBlockSetPresentValue + } + var ItemBlockPredicatePropertiesPresent bool + err = binary.Read(r, binary.BigEndian, &ItemBlockPredicatePropertiesPresent) + if err != nil { + return + } + if ItemBlockPredicatePropertiesPresent { + var ItemBlockPredicatePropertiesPresentValue []ItemBlockProperty + var lItemBlockPredicateProperties int32 + lItemBlockPredicateProperties, err = proto_base.DecodeVarInt(r) + if err != nil { + return + } + ItemBlockPredicatePropertiesPresentValue = []ItemBlockProperty{} + for range lItemBlockPredicateProperties { + var ItemBlockPredicatePropertiesElement ItemBlockProperty + err = ItemBlockPredicatePropertiesElement.Decode(r) + if err != nil { + return + } + ItemBlockPredicatePropertiesPresentValue = append(ItemBlockPredicatePropertiesPresentValue, ItemBlockPredicatePropertiesElement) + } + ret.Properties = &ItemBlockPredicatePropertiesPresentValue + } + err = ret.Nbt.Decode(r) + if err != nil { + return + } + err = ret.Components.Decode(r) + if err != nil { + return + } return } func (ret *ItemBlockPredicate) Encode(w io.Writer) (err error) { - err = proto_base.ToDoError + err = binary.Write(w, binary.BigEndian, ret.BlockSet != nil) + if err != nil { + return + } + if ret.BlockSet != nil { + switch ItemBlockPredicateBlockSetKnownType := (*ret.BlockSet).(type) { + case string: + err = proto_base.EncodeVarInt(w, 0) + if err != nil { + return + } + err = proto_base.EncodeString(w, ItemBlockPredicateBlockSetKnownType) + if err != nil { + return + } + case int32: + err = proto_base.EncodeVarInt(w, ItemBlockPredicateBlockSetKnownType) + if err != nil { + return + } + default: + err = proto_base.BadTypeError + } + } + err = binary.Write(w, binary.BigEndian, ret.Properties != nil) + if err != nil { + return + } + if ret.Properties != nil { + err = proto_base.EncodeVarInt(w, int32(len(*ret.Properties))) + if err != nil { + return + } + for iItemBlockPredicateProperties := range len(*ret.Properties) { + ItemBlockPredicatePropertiesInnerEncTmp := (*ret.Properties)[iItemBlockPredicateProperties] + err = ItemBlockPredicatePropertiesInnerEncTmp.Encode(w) + if err != nil { + return + } + } + } + ItemBlockPredicateNbtEncTmp := ret.Nbt + err = ItemBlockPredicateNbtEncTmp.Encode(w) + if err != nil { + return + } + ItemBlockPredicateComponentsEncTmp := ret.Components + err = ItemBlockPredicateComponentsEncTmp.Encode(w) + if err != nil { + return + } return } diff --git a/mc/proto_generated/v1_8/proto.go b/mc/proto_generated/v1_8/proto.go index d08ab6a..cf60063 100644 --- a/mc/proto_generated/v1_8/proto.go +++ b/mc/proto_generated/v1_8/proto.go @@ -1,6 +1,6 @@ // Code generated by strom. DO NOT EDIT. // source: minecraft-data/pc/1.8/protocol.json (sha256:79fe774bfc255dd281899c004fbb9c7adc40fb107de9353da1dd0371ea4b53af) -// version: v0.6.6-0.20260805170503-1d8f70c7fdae+dirty (go1.26.2) +// version: v0.6.6-0.20260805173638-56ac8e154ea1+dirty (go1.26.2) package v1_8 import ( diff --git a/mc/proto_generated/v26_1/proto.go b/mc/proto_generated/v26_1/proto.go index 861d1c4..1361f27 100644 --- a/mc/proto_generated/v26_1/proto.go +++ b/mc/proto_generated/v26_1/proto.go @@ -1,6 +1,6 @@ // Code generated by strom. DO NOT EDIT. // source: minecraft-data/pc/26.1/protocol.json (sha256:dfb6318886cd3ceab617f75ac05e24f9836a64501d60551071289b904ebfc389) -// version: v0.6.6-0.20260805170503-1d8f70c7fdae+dirty (go1.26.2) +// version: v0.6.6-0.20260805173638-56ac8e154ea1+dirty (go1.26.2) package v26_1 import ( @@ -901,11 +901,42 @@ type IDSet struct { } func (ret *IDSet) Decode(r io.ReadSeeker) (err error) { - err = proto_base.ToDoError + var IDSetId int32 + IDSetId, err = proto_base.DecodeVarInt(r) + if err != nil { + return + } + if IDSetId != 0 { + ret.Val = IDSetId + } else { + var IDSetResult string + IDSetResult, err = proto_base.DecodeString(r) + if err != nil { + return + } + ret.Val = IDSetResult + } return } func (ret *IDSet) Encode(w io.Writer) (err error) { - err = proto_base.ToDoError + switch IDSetKnownType := ret.Val.(type) { + case string: + err = proto_base.EncodeVarInt(w, 0) + if err != nil { + return + } + err = proto_base.EncodeString(w, IDSetKnownType) + if err != nil { + return + } + case int32: + err = proto_base.EncodeVarInt(w, IDSetKnownType) + if err != nil { + return + } + default: + err = proto_base.BadTypeError + } return } @@ -965,11 +996,115 @@ type ItemBlockPredicate struct { } func (ret *ItemBlockPredicate) Decode(r io.ReadSeeker) (err error) { - err = proto_base.ToDoError + var ItemBlockPredicateBlockSetPresent bool + err = binary.Read(r, binary.BigEndian, &ItemBlockPredicateBlockSetPresent) + if err != nil { + return + } + if ItemBlockPredicateBlockSetPresent { + var ItemBlockPredicateBlockSetPresentValue any + var ItemBlockPredicateBlockSetId int32 + ItemBlockPredicateBlockSetId, err = proto_base.DecodeVarInt(r) + if err != nil { + return + } + if ItemBlockPredicateBlockSetId != 0 { + ItemBlockPredicateBlockSetPresentValue = ItemBlockPredicateBlockSetId + } else { + var ItemBlockPredicateBlockSetResult string + ItemBlockPredicateBlockSetResult, err = proto_base.DecodeString(r) + if err != nil { + return + } + ItemBlockPredicateBlockSetPresentValue = ItemBlockPredicateBlockSetResult + } + ret.BlockSet = &ItemBlockPredicateBlockSetPresentValue + } + var ItemBlockPredicatePropertiesPresent bool + err = binary.Read(r, binary.BigEndian, &ItemBlockPredicatePropertiesPresent) + if err != nil { + return + } + if ItemBlockPredicatePropertiesPresent { + var ItemBlockPredicatePropertiesPresentValue []ItemBlockProperty + var lItemBlockPredicateProperties int32 + lItemBlockPredicateProperties, err = proto_base.DecodeVarInt(r) + if err != nil { + return + } + ItemBlockPredicatePropertiesPresentValue = []ItemBlockProperty{} + for range lItemBlockPredicateProperties { + var ItemBlockPredicatePropertiesElement ItemBlockProperty + err = ItemBlockPredicatePropertiesElement.Decode(r) + if err != nil { + return + } + ItemBlockPredicatePropertiesPresentValue = append(ItemBlockPredicatePropertiesPresentValue, ItemBlockPredicatePropertiesElement) + } + ret.Properties = &ItemBlockPredicatePropertiesPresentValue + } + err = ret.Nbt.Decode(r) + if err != nil { + return + } + err = ret.Components.Decode(r) + if err != nil { + return + } return } func (ret *ItemBlockPredicate) Encode(w io.Writer) (err error) { - err = proto_base.ToDoError + err = binary.Write(w, binary.BigEndian, ret.BlockSet != nil) + if err != nil { + return + } + if ret.BlockSet != nil { + switch ItemBlockPredicateBlockSetKnownType := (*ret.BlockSet).(type) { + case string: + err = proto_base.EncodeVarInt(w, 0) + if err != nil { + return + } + err = proto_base.EncodeString(w, ItemBlockPredicateBlockSetKnownType) + if err != nil { + return + } + case int32: + err = proto_base.EncodeVarInt(w, ItemBlockPredicateBlockSetKnownType) + if err != nil { + return + } + default: + err = proto_base.BadTypeError + } + } + err = binary.Write(w, binary.BigEndian, ret.Properties != nil) + if err != nil { + return + } + if ret.Properties != nil { + err = proto_base.EncodeVarInt(w, int32(len(*ret.Properties))) + if err != nil { + return + } + for iItemBlockPredicateProperties := range len(*ret.Properties) { + ItemBlockPredicatePropertiesInnerEncTmp := (*ret.Properties)[iItemBlockPredicateProperties] + err = ItemBlockPredicatePropertiesInnerEncTmp.Encode(w) + if err != nil { + return + } + } + } + ItemBlockPredicateNbtEncTmp := ret.Nbt + err = ItemBlockPredicateNbtEncTmp.Encode(w) + if err != nil { + return + } + ItemBlockPredicateComponentsEncTmp := ret.Components + err = ItemBlockPredicateComponentsEncTmp.Encode(w) + if err != nil { + return + } return } diff --git a/mc/proto_generated/v26_2/proto.go b/mc/proto_generated/v26_2/proto.go index bfe05a2..ea17ad0 100644 --- a/mc/proto_generated/v26_2/proto.go +++ b/mc/proto_generated/v26_2/proto.go @@ -1,6 +1,6 @@ // Code generated by strom. DO NOT EDIT. // source: minecraft-data/pc/26.2/protocol.json (sha256:7ba66411adcc68a668f38211e1b00eeb386a345d5eb16fadd6dc1c7f94bb175f) -// version: v0.6.6-0.20260805170503-1d8f70c7fdae+dirty (go1.26.2) +// version: v0.6.6-0.20260805173638-56ac8e154ea1+dirty (go1.26.2) package v26_2 import ( @@ -901,11 +901,42 @@ type IDSet struct { } func (ret *IDSet) Decode(r io.ReadSeeker) (err error) { - err = proto_base.ToDoError + var IDSetId int32 + IDSetId, err = proto_base.DecodeVarInt(r) + if err != nil { + return + } + if IDSetId != 0 { + ret.Val = IDSetId + } else { + var IDSetResult string + IDSetResult, err = proto_base.DecodeString(r) + if err != nil { + return + } + ret.Val = IDSetResult + } return } func (ret *IDSet) Encode(w io.Writer) (err error) { - err = proto_base.ToDoError + switch IDSetKnownType := ret.Val.(type) { + case string: + err = proto_base.EncodeVarInt(w, 0) + if err != nil { + return + } + err = proto_base.EncodeString(w, IDSetKnownType) + if err != nil { + return + } + case int32: + err = proto_base.EncodeVarInt(w, IDSetKnownType) + if err != nil { + return + } + default: + err = proto_base.BadTypeError + } return } @@ -965,11 +996,115 @@ type ItemBlockPredicate struct { } func (ret *ItemBlockPredicate) Decode(r io.ReadSeeker) (err error) { - err = proto_base.ToDoError + var ItemBlockPredicateBlockSetPresent bool + err = binary.Read(r, binary.BigEndian, &ItemBlockPredicateBlockSetPresent) + if err != nil { + return + } + if ItemBlockPredicateBlockSetPresent { + var ItemBlockPredicateBlockSetPresentValue any + var ItemBlockPredicateBlockSetId int32 + ItemBlockPredicateBlockSetId, err = proto_base.DecodeVarInt(r) + if err != nil { + return + } + if ItemBlockPredicateBlockSetId != 0 { + ItemBlockPredicateBlockSetPresentValue = ItemBlockPredicateBlockSetId + } else { + var ItemBlockPredicateBlockSetResult string + ItemBlockPredicateBlockSetResult, err = proto_base.DecodeString(r) + if err != nil { + return + } + ItemBlockPredicateBlockSetPresentValue = ItemBlockPredicateBlockSetResult + } + ret.BlockSet = &ItemBlockPredicateBlockSetPresentValue + } + var ItemBlockPredicatePropertiesPresent bool + err = binary.Read(r, binary.BigEndian, &ItemBlockPredicatePropertiesPresent) + if err != nil { + return + } + if ItemBlockPredicatePropertiesPresent { + var ItemBlockPredicatePropertiesPresentValue []ItemBlockProperty + var lItemBlockPredicateProperties int32 + lItemBlockPredicateProperties, err = proto_base.DecodeVarInt(r) + if err != nil { + return + } + ItemBlockPredicatePropertiesPresentValue = []ItemBlockProperty{} + for range lItemBlockPredicateProperties { + var ItemBlockPredicatePropertiesElement ItemBlockProperty + err = ItemBlockPredicatePropertiesElement.Decode(r) + if err != nil { + return + } + ItemBlockPredicatePropertiesPresentValue = append(ItemBlockPredicatePropertiesPresentValue, ItemBlockPredicatePropertiesElement) + } + ret.Properties = &ItemBlockPredicatePropertiesPresentValue + } + err = ret.Nbt.Decode(r) + if err != nil { + return + } + err = ret.Components.Decode(r) + if err != nil { + return + } return } func (ret *ItemBlockPredicate) Encode(w io.Writer) (err error) { - err = proto_base.ToDoError + err = binary.Write(w, binary.BigEndian, ret.BlockSet != nil) + if err != nil { + return + } + if ret.BlockSet != nil { + switch ItemBlockPredicateBlockSetKnownType := (*ret.BlockSet).(type) { + case string: + err = proto_base.EncodeVarInt(w, 0) + if err != nil { + return + } + err = proto_base.EncodeString(w, ItemBlockPredicateBlockSetKnownType) + if err != nil { + return + } + case int32: + err = proto_base.EncodeVarInt(w, ItemBlockPredicateBlockSetKnownType) + if err != nil { + return + } + default: + err = proto_base.BadTypeError + } + } + err = binary.Write(w, binary.BigEndian, ret.Properties != nil) + if err != nil { + return + } + if ret.Properties != nil { + err = proto_base.EncodeVarInt(w, int32(len(*ret.Properties))) + if err != nil { + return + } + for iItemBlockPredicateProperties := range len(*ret.Properties) { + ItemBlockPredicatePropertiesInnerEncTmp := (*ret.Properties)[iItemBlockPredicateProperties] + err = ItemBlockPredicatePropertiesInnerEncTmp.Encode(w) + if err != nil { + return + } + } + } + ItemBlockPredicateNbtEncTmp := ret.Nbt + err = ItemBlockPredicateNbtEncTmp.Encode(w) + if err != nil { + return + } + ItemBlockPredicateComponentsEncTmp := ret.Components + err = ItemBlockPredicateComponentsEncTmp.Encode(w) + if err != nil { + return + } return } diff --git a/mc/proto_generator/native_decoder.go b/mc/proto_generator/native_decoder.go index c0f0dff..aa3d54c 100644 --- a/mc/proto_generator/native_decoder.go +++ b/mc/proto_generator/native_decoder.go @@ -456,56 +456,38 @@ func RegistryEntryHolderSetDecoder(g *Generator, varToSet ast.Expr, dataRaw any, if err != nil { return } - var countType ast.Expr - countType, err = g.VisitType("varint") + idName := name + "Id" + varIntType, err := g.VisitNameAndData("varint", nil) if err != nil { return } + IdVar := VarStmt(idName, varIntType) + idDecodeStatements, err := g.VisitDecoder(Ident(idName), "varint", name) + if err != nil { + return + } + baseType, err := g.VisitType(data.Base.Type) if err != nil { return } - otherwiseArrayType, err := g.VisitNameAndData("array", map[string]any{"type": data.Otherwise.Type}) + resName := name + "Result" + var basePath []ast.Stmt + basePath = append(basePath, VarStmt(resName, baseType)) + baseDecodeStatements, err := g.VisitDecoder(Ident(resName), data.Base.Type, name+"Base") if err != nil { return } - otherwiseType, err := g.VisitType(data.Otherwise.Type) - if err != nil { - return - } - lName := "l" + util2.CamelCase(name) - s1 := VarStmt(lName, countType) - s2, err := g.VisitDecoder(Ident(lName), "varint", name) - if err != nil { - return - } - s3 := Assign121(Ident(lName), Sub(Ident(lName), NumLit(1))) - resultName := name + "Result" - b1s1 := VarStmt(resultName, baseType) - b1s2, err := g.VisitDecoder(Ident(resultName), data.Base.Type, resultName) - b1s3 := Assign121(varToSet, Ident(resultName)) - b1s4 := Return() - var b1 []ast.Stmt - b1 = append(b1, b1s1) - b1 = append(b1, b1s2...) - b1 = append(b1, b1s3) - b1 = append(b1, b1s4) + basePath = append(basePath, baseDecodeStatements...) + basePath = append(basePath, Assign121(varToSet, Ident(resName))) - tName := name + "Element" - rangeStatements := Stmts(VarStmt(tName, otherwiseType)) - rangeStatementsDecode, err := g.VisitDecoder(Ident(tName), data.Otherwise.Type, tName) - rangeStatements = append(rangeStatements, rangeStatementsDecode...) - rangeStatements = append(rangeStatements, Assign121(Ident(resultName), Call(Ident("append"), Ident(resultName), Ident(tName)))) + idPath := IfElse(NotEquals(Ident(idName), NumLit(0)), + NewBlockEllipsis(Assign121(varToSet, Ident(idName))), + NewBlock(basePath)) - s5 := If(Equals(Ident(lName), NumLit(-1)), NewBlock(b1)) - s6 := VarStmt(resultName, otherwiseArrayType) - s7 := ForRange(nil, Ident(lName), NewBlock(rangeStatements)) - s = append(s, s1) - s = append(s, s2...) - s = append(s, s3) - s = append(s, s5) - s = append(s, s6) - s = append(s, s7) + s = Stmts(IdVar) + s = append(s, idDecodeStatements...) + s = append(s, idPath) return } @@ -705,7 +687,7 @@ func (g *Generator) RegisterDecoderNatives() { "bool": SimpleTypeDecoder, "registryEntryHolder": RegistryEntryHolderDecoder, - "registryEntryHolderSet": ToDoDecoder, // RegistryEntryHolderSetDecoder + "registryEntryHolderSet": RegistryEntryHolderSetDecoder, "entityMetadataLoop": EntityMetadataLoopDecoder, "topBitSetTerminatedArray": TopBitSetTerminatedArrayDecoder, "todo": ToDoDecoder, diff --git a/mc/proto_generator/native_encoder.go b/mc/proto_generator/native_encoder.go index 48adf38..1d99e0a 100644 --- a/mc/proto_generator/native_encoder.go +++ b/mc/proto_generator/native_encoder.go @@ -490,6 +490,49 @@ func TopBitSetTerminatedArrayEncoder(g *Generator, varToSet ast.Expr, dataRaw an return } +func RegistryEntryHolderSetEncoder(g *Generator, varToSet ast.Expr, dataRaw any, name string) (s []ast.Stmt, err error) { + var data protodef.RegistryEntryHolderSet + err = mapstructure.Decode(dataRaw, &data) + if err != nil { + return + } + + baseType, err := g.VisitType(data.Base.Type) + if err != nil { + return + } + otherwiseType, err := g.VisitType(data.Otherwise.Type) + if err != nil { + return + } + + knownTypeName := name + "KnownType" + + zeroEncode, err := g.VisitEncoder(NumLit(0), "varint", name+"Zero") + if err != nil { + return + } + + baseEncodeStatements, err := g.VisitEncoder(Ident(knownTypeName), data.Base.Type, name+"Base") + if err != nil { + return + } + baseEncodeStatements = append(zeroEncode, baseEncodeStatements...) + + otherwiseEncodeStatements, err := g.VisitEncoder(Ident(knownTypeName), data.Otherwise.Type, name+"Otherwise") + if err != nil { + return + } + + statements := Stmts() + statements = append(statements, Case(Exprs(baseType), baseEncodeStatements)) + statements = append(statements, Case(Exprs(otherwiseType), otherwiseEncodeStatements)) + statements = append(statements, Case(nil, Stmts(Assign121(Ident("err"), Selector("proto_base", "BadTypeError"))))) + + s = Stmts(TypeSwitch(Define121(Ident(knownTypeName), TypeAssert(varToSet, Ident("type"))), NewBlock(statements))) + return +} + func (g *Generator) RegisterEncoderNatives() { g.EncoderNatives = map[string]FunctionGeneratorFunc{ "container": ContainerEncoder, @@ -526,7 +569,7 @@ func (g *Generator) RegisterEncoderNatives() { "bool": SimpleTypeEncoder, "registryEntryHolder": RegistryEntryHolderEncoder, - "registryEntryHolderSet": ToDoEncoder, + "registryEntryHolderSet": RegistryEntryHolderSetEncoder, "entityMetadataLoop": EntityMetadataLoopEncoder, "topBitSetTerminatedArray": TopBitSetTerminatedArrayEncoder, "todo": ToDoEncoder,