Skip to content

Add 26.3-pre-2 protocol support - #876

Open
electronicboy wants to merge 1 commit into
masterfrom
waterfall-spec-26-2-26-3
Open

Add 26.3-pre-2 protocol support#876
electronicboy wants to merge 1 commit into
masterfrom
waterfall-spec-26-2-26-3

Conversation

@electronicboy

Copy link
Copy Markdown
Member

Adds 26.3-pre-2 support behind the existing net.md_5.bungee.protocol.snapshot flag, as a single temporary patch to be dropped once upstream lands its own 26.3 support.

MINECRAFT_26_3 holds the snapshot protocol number (0x40000000 | 334), matching what upstream does during a pre-release cycle before flipping it to the release number.

Packet id remaps

26.3-pre-2 inserts post_effects into both the configuration and game clientbound tables, and swing_animation into the game clientbound table, shifting everything after them. That is 7 configuration and 19 game clientbound packets we register.

Serverbound is unaffected for us: the punch/swing shuffle sits in the 0x2E-0x3F window we do not register in, and CustomClickAction at 0x44 is above it.

Every id — including the ones deliberately left alone, such as KeepAlive 0x2C, Login 0x31 and PlayerListItemRemove/Update 0x45/0x46 — was derived from the registration order in GameProtocols and ConfigurationProtocols rather than from a protocol summary, and the resulting table sizes (143 game clientbound, 69 game serverbound, 21 configuration clientbound, 10 configuration serverbound) match the release.

CommonPlayerSpawnInfo

The one packet payload change, affecting both Login and Respawn, which embed it:

  • gameType: byte -> var int
  • previousGameType: byte with a -1 sentinel -> vanilla's OPTIONAL_VAR_INT, where zero means absent and any other value is the id plus one

Both fields are only ever round-tripped by the proxy, never synthesised, so no call site needed to change. This one is easy to miss: a protocol summary renders it as commonPlayerSpawnInfo: CommonPlayerSpawnInfo [STREAM_CODEC], which looks like a pure refactor.

Everything else we parse really is a FriendlyByteBuf to StreamCodec refactor with an identical wire format — including PlayerListItemUpdate, whose new Action id is enum-internal and not serialised, and Team, whose Collection<String> to List<String> change is the same length-prefixed string list as before.

Command argument types

The argument type registry grew from 57 to 62 entries: context_float_provider, context_int_provider and slot_source after loot_modifier, then feature and swing_animation after dialog, which also shifts dialog and uuid. All five are singleton argument types with no payload, so IDS_26_3 adds them as VOID.

Without this, decoding Commands from a 26.3 backend throws:

io.netty.handler.codec.DecoderException: java.lang.ArrayIndexOutOfBoundsException: Index 59 out of bounds for length 57
	at net.md_5.bungee.protocol.packet.Commands$ArgumentRegistry.read(Commands.java:1006)

26.3 likewise adds a post_effects suggestion provider. Those are keyed by name rather than index and SuggestionRegistry.getProvider rejects unknown names outright, so it is registered as a dummy for every version.

Testing

Builds and passes the test suite. Tested against a 26.3-pre-2 client and backend: connecting, moving between servers, and the command tree all work.

Adds MINECRAFT_26_3 behind the existing net.md_5.bungee.protocol.snapshot
flag, using the snapshot protocol number (0x40000000 | 334) as upstream does
during a pre-release cycle, and remaps the packets whose ids moved.

26.3-pre-2 inserts post_effects into both the configuration and game
clientbound tables, and swing_animation into the game clientbound table,
shifting everything after them: 7 configuration and 19 game packets we
register. Serverbound is unaffected for us, as the punch/swing shuffle sits
in the 0x2E-0x3F window we do not register in, and CustomClickAction at 0x44
is above it. Every id was checked against the registration order in
GameProtocols and ConfigurationProtocols rather than the protocol summary.

CommonPlayerSpawnInfo, which Login and Respawn both embed, is the one packet
payload change. gameType moved from a byte to a var int, and previousGameType
from a byte with a -1 sentinel to vanilla's OPTIONAL_VAR_INT, where zero means
absent and any other value is the id plus one. Both fields are only ever
round-tripped by the proxy, so no call site needs to change. Everything else
we parse is a FriendlyByteBuf to StreamCodec refactor that leaves the wire
format identical, including PlayerListItemUpdate, whose new Action id is
enum-internal and not serialised.

The command argument type registry also grew: context_float_provider,
context_int_provider and slot_source after loot_modifier, then feature and
swing_animation after dialog, taking it from 57 to 62 entries and shifting
dialog and uuid. All five are singleton argument types with no payload, so
IDS_26_3 adds them as VOID. Without this, decoding Commands from a 26.3
backend throws ArrayIndexOutOfBoundsException. 26.3 likewise adds a
post_effects suggestion provider; those are keyed by name rather than index
and unknown names are rejected outright, so it is registered as a dummy for
every version.

This is temporary and should be dropped once upstream adds 26.3 support.
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.

1 participant