Skip to content

fix: remove player.active assignment to avoid unexpected tile section sending#92

Open
ACaiCat wants to merge 1 commit into
mainfrom
fix/unexpexted-section-send
Open

fix: remove player.active assignment to avoid unexpected tile section sending#92
ACaiCat wants to merge 1 commit into
mainfrom
fix/unexpexted-section-send

Conversation

@ACaiCat

@ACaiCat ACaiCat commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

PE收到TileSection神秘闪退

  1. 处理ProcessPacket方法 处理UUID包的时候把Player.active设为了true
  2. Main.UpdateServer里的CheckSection(用来根据玩家坐标发送区块)提前给玩家发送了区块
  3. 手机没收到WorldInfo所以没初始化Tile数组,收到CheckSection发送的区块直接崩了

解决方法是把UUID包处理的serverPlayer.active = true删了,走原版逻辑,玩家发PlayerActive包再把active设为true

Summary by Sourcery

Bug Fixes:

  • Avoid PE client crashes by no longer marking players active on UUID packet handling, relying on PlayerActive packets for activation instead.

Copilot AI review requested due to automatic review settings July 6, 2026 15:11
@sourcery-ai

sourcery-ai Bot commented Jul 6, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR adjusts player activation timing by removing an early serverPlayer.active = true assignment during UUID packet processing, so tile sections are only sent after the client is properly initialized via the standard PlayerActive flow.

Sequence diagram for updated player activation and TileSection sending

sequenceDiagram
    actor Client_PE
    participant UnifiedServerCoordinator
    participant Main_UpdateServer

    Client_PE->>UnifiedServerCoordinator: UUIDPacket
    UnifiedServerCoordinator->>UnifiedServerCoordinator: ProcessPacket
    alt previous_behavior
        UnifiedServerCoordinator->>UnifiedServerCoordinator: serverPlayer_active
        Main_UpdateServer->>Client_PE: CheckSection
    else current_behavior
        Client_PE->>UnifiedServerCoordinator: PlayerActivePacket
        UnifiedServerCoordinator->>UnifiedServerCoordinator: ProcessPacket
        UnifiedServerCoordinator->>UnifiedServerCoordinator: serverPlayer_active
        Main_UpdateServer->>Client_PE: CheckSection
    end
Loading

File-Level Changes

Change Details Files
Adjust player activation flow to rely on the standard PlayerActive packet instead of activating on UUID processing.
  • Removed premature serverPlayer.active = true assignment in UUID packet handling within ProcessPacket.
  • Kept section reset and server selection logic intact while ensuring JoinServer event and title update run without changing player active state.
  • Ensured tile section sending logic now waits for the client to send PlayerActive before treating the player as active.
src/UnifierTSL/UnifiedServerCoordinator.cs

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • Consider adding a brief comment near the UUID handling / PlayerActive handling to document why serverPlayer.active must only be set in response to the PlayerActive packet, as this ordering constraint is non-obvious and ties directly to PE crash behavior.
  • It may be worth validating CheckSection’s preconditions (e.g., world info / tile array initialization) rather than relying solely on player.active, so future changes don’t accidentally reintroduce similar issues by toggling active earlier in the flow.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider adding a brief comment near the UUID handling / PlayerActive handling to document why `serverPlayer.active` must only be set in response to the PlayerActive packet, as this ordering constraint is non-obvious and ties directly to PE crash behavior.
- It may be worth validating `CheckSection`’s preconditions (e.g., world info / tile array initialization) rather than relying solely on `player.active`, so future changes don’t accidentally reintroduce similar issues by toggling `active` earlier in the flow.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a PE client crash during connection by preventing the server-side player from being marked active when handling the ClientUUID packet, so tile sections won’t be sent before the client has finished world initialization (waiting for the PlayerActive packet to activate the player).

Changes:

  • Removed serverPlayer.active = true; from MessageID.ClientUUID handling in ProcessPacket.
  • Keeps activation aligned with vanilla flow (activation happens on PlayerActive packet).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/UnifierTSL/UnifiedServerCoordinator.cs
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