Skip to content

Fix early Fabric packet send during connection initialization - #65

Open
Miaoshroom wants to merge 1 commit into
LopyMine:masterfrom
Miaoshroom:fix/fabric-player-join-sync
Open

Miaoshroom wants to merge 1 commit into
LopyMine:masterfrom
Miaoshroom:fix/fabric-player-join-sync

Conversation

@Miaoshroom

Copy link
Copy Markdown

Summary

Use ServerPlayConnectionEvents.JOIN instead of INIT for PatPat's Fabric player login callback.

Problem

PatPat currently sends its initial hello packet from the Fabric INIT event. This event is triggered while a ServerGamePacketListenerImpl is being initialized and does not necessarily represent a fully joined player.

Mods such as ServerReplay create synthetic packet listeners for chunk recording. Sending PatPat's packet during their construction can call into the synthetic listener before its fields have been initialized, causing a NullPointerException and crashing the server.

The same lifecycle issue was also observed with Flashback-related compatibility.

Solution

Move the Fabric login callback from ServerPlayConnectionEvents.INIT to ServerPlayConnectionEvents.JOIN.

JOIN is invoked when the play listener is ready to send packets. Real players still receive exactly one PatPat hello packet after joining, while synthetic listeners that are only initialized do not receive it.

Testing

Automated builds and tests passed for both ends of PatPat's supported Fabric range:

  • bash gradlew :fabric-1.16.5:build --configure-on-demand
  • bash gradlew :fabric-26.1:build --configure-on-demand

Manual verification confirmed:

  • Normal PatPat multiplayer behavior still works
  • The initial synchronization is not duplicated
  • ServerReplay chunk recording starts without crashing
  • The reported Flashback conflict is also resolved

@LopyMine

LopyMine commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Hmm, interesting
I need to check it on my side too

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