Skip to content

Compiled mapper: write a raw integer not in the mappings through - #183

Merged
u9g merged 1 commit into
ProtoDef-io:masterfrom
u9g:compiled-mapper-raw-int
Oct 9, 2026
Merged

u9g merged 1 commit into
ProtoDef-io:masterfrom
u9g:compiled-mapper-raw-int

Conversation

@u9g

@u9g u9g commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #176, addressing #176 (comment).

The compiled read returns the raw id when a value isn't in the mappings, so anything that re-encodes what it reads (e.g. bedrock-protocol Relay proxying a packet with an out-of-range enum value) has to be able to write that integer back. #176 made the compiled write/sizeOf throw on it.

Now a raw number not in the mappings is passed through to the underlying type. Unmapped names and undefined still throw, so the original bug (an unknown packet name serializing as 0x00) stays fixed. Covered by a new round-trip test.

The compiled read returns the raw id for a value not in the mappings, so a
proxy that re-encodes what it reads (e.g. bedrock-protocol Relay) has to be
able to write that integer back. Since ProtoDef-io#176 the write threw on it. Pass raw
integers through to the underlying type; unmapped names and undefined still
throw.
@extremeheat

Copy link
Copy Markdown
Contributor

LGTM

@u9g
u9g merged commit 7d3956d into ProtoDef-io:master Oct 9, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants