fix: implement IDSet (registryEntryHolderSet) decoder/encoder

- Replace old broken RegistryEntryHolderSetDecoder with correct varint
  discriminator: id != 0 returns raw ID, id == 0 decodes string base
- Add RegistryEntryHolderSetEncoder using type switch (string/int32)
- Add NonErroringIndex to proto_base (zero-fallback index lookup)
- DeclareRecipes now fails with index not found (mapper) instead of to do
This commit is contained in:
OpenCode
2026-08-05 19:53:46 +02:00
parent 56ac8e154e
commit 53d366ae53
13 changed files with 776 additions and 70 deletions
+6
View File
@@ -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 {