Skip to content

Use LeafPile and correct threading - #63

Merged
Cubicake merged 21 commits into
mainfrom
v2/optimise
Jul 4, 2026
Merged

Use LeafPile and correct threading#63
Cubicake merged 21 commits into
mainfrom
v2/optimise

Conversation

@Cubicake

@Cubicake Cubicake commented Jul 3, 2026

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings July 3, 2026 08:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 integrates the LeafPile submodule and updates the threading model around player/entity tracking so that more packet-state work is done on the Netty side, while the engine performs visibility checks using entity references rather than repeated UUID lookups.

Changes:

  • Add LeafPile as a submodule/module and wire it into Gradle builds + shading/relocation.
  • Rework player registration/disconnect flow to be driven by PacketEvents login/disconnect, and adjust Paper join handling accordingly.
  • Introduce new iteration APIs for entity/tile-entity visibility checks and swap in LeafPile concurrency primitives / thread guards.

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
settings.gradle Adds a version catalog sourced from leafpile and includes the new leafpile module.
platform-paper/src/main/resources/plugin.yml Bumps declared Paper API version.
platform-paper/src/main/java/games/cubi/raycastedantiesp/paper/EventListener.java Switches join handling to PlayerClientLoadedWorldEvent and changes behavior when packet state isn’t registered.
platform-paper/src/main/java/games/cubi/raycastedantiesp/paper/commands/RaycastedAntiESPCommand.java Enhances debug benchmark output (counts successful raycasts).
platform-paper/build.gradle.kts Updates Paper bundle version; adds LeafPile dependency; shades/relocates ca.spottedleaf and enables minimization.
packetevents/src/main/java/games/cubi/raycastedantiesp/packetevents/viewcontrollers/PacketEventsEntityViewController.java Registers/unregisters players via JOIN_GAME and UserDisconnectEvent; refactors login handling.
packetevents/src/main/java/games/cubi/raycastedantiesp/packetevents/viewcontrollers/PacketEventsBlockViewController.java Adjusts tile-entity transition processing safety checks.
packetevents/src/main/java/games/cubi/raycastedantiesp/packetevents/view/PacketEventsEntityView.java Replaces CHM/CLQ with LeafPile structures, adds single-thread guarding, and adds entity-reference iteration.
packetevents/build.gradle.kts Adds LeafPile as a compileOnly dependency.
core/src/main/java/games/cubi/raycastedantiesp/core/view/EntityView.java Adds entity-reference iteration API for recheck scanning.
core/src/main/java/games/cubi/raycastedantiesp/core/view/controller/PacketEntityViewController.java Moves player registration to play-phase login and centralizes disconnect handling.
core/src/main/java/games/cubi/raycastedantiesp/core/view/BlockView.java Adds VisibilityResolver + new tile-entity visibility update iteration API.
core/src/main/java/games/cubi/raycastedantiesp/core/view/AbstractBlockView.java Uses LeafPile queue and implements new tile-entity visibility update API.
core/src/main/java/games/cubi/raycastedantiesp/core/utils/SingleThreadedGuard.java Introduces a reusable single-thread enforcement helper.
core/src/main/java/games/cubi/raycastedantiesp/core/players/PlayerRegistry.java Refactors registration to include self-entity creation; changes disconnect cleanup semantics.
core/src/main/java/games/cubi/raycastedantiesp/core/players/PlayerData.java Adds connected/disconnected state and constructs NettyData with a required self-entity.
core/src/main/java/games/cubi/raycastedantiesp/core/players/NettyData.java Makes self-entity immutable post-construction and simplifies self-ID checks.
core/src/main/java/games/cubi/raycastedantiesp/core/locatables/NettyEntityLocatable.java Adds offset-location getter and strengthens cross-thread field visibility (volatile).
core/src/main/java/games/cubi/raycastedantiesp/core/locatables/EntityLocatable.java Adds getOffsetEntityLocation() to support engine-side raycast targets.
core/src/main/java/games/cubi/raycastedantiesp/core/engine/SimpleEngine.java Skips disconnected players; uses entity references + offset locations; updates tile-entity visibility flow.
core/build.gradle.kts Adds LeafPile compileOnly and bumps core version.
.gitmodules Adds the LeafPile submodule definition.

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

Comment on lines 253 to 257
private PacketEventsEntity getTrackedEntity(int entityID) {
guardThread();
UUID entityUUID = entityUUIDsByID.get(entityID);
return entityUUID == null ? null : entitiesByUUID.get(entityUUID);
}

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Pending broader refactor to fix this

@Cubicake
Cubicake merged commit 328de7f into main Jul 4, 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