Skip to content

Fix cross-dimension entity travel under parallel world ticking with post-tick handoff#666

Open
splatage wants to merge 1 commit into
Winds-Studio:ver/1.21.11from
splatage:feature/PWT_Entity_Teleport
Open

Fix cross-dimension entity travel under parallel world ticking with post-tick handoff#666
splatage wants to merge 1 commit into
Winds-Studio:ver/1.21.11from
splatage:feature/PWT_Entity_Teleport

Conversation

@splatage

Copy link
Copy Markdown

Summary

The PR succeeds the previously submitted one and should be considered in the place of

This PR fixes cross-dimension entity portal travel when parallel world ticking (PWT) is enabled.

The core issue was that entities could begin portal travel while ticking on one world thread, then immediately read or mutate destination-world state from the wrong thread. That caused hard thread-check failures and made cross-dimension travel unsafe under PWT.

This patch changes that flow so cross-dimension transfers are queued during world tick and then drained after all world tick tasks join, on the safe server-thread handoff phase. This keeps destination-world mutation out of source-world tick threads and preserves normal same-dimension behaviour.

Problem

Under PWT, portal handling could attempt cross-world work inline during entity ticking. That caused problems such as:

  • destination-world POI / portal lookup from the wrong world thread
  • cross-dimension teleport mutation happening during source-world tick
  • unsafe behaviour when entities changed dimension while still inside the parallel tick phase

This was reproducible with entities entering Nether portals while PWT was enabled.
What this PR changes

Entity portal handling

  • Detects Nether / End portal travel during entity portal processing
  • Prevents inline cross-dimension completion during parallel world ticking
  • Queues a pending dimension transfer instead

Server-side transfer handoff

  • Adds a pending transfer queue on the server
  • Drains queued transfers after world tick futures complete
  • Performs destination lookup and final teleport from the safe handoff phase

Transfer validation / safety

Before applying a queued transfer, the drain phase verifies that:

  • the entity still exists
  • the entity is still in the expected source world
  • the portal process still matches the queued transfer
  • plugin cancellation state is respected
  • normal isAllowedToEnterPortal(...) / canTeleport(...) checks still pass

Passenger handling

The latest patch in this PR also fixes entities with passengers so they no longer disappear during portal travel. Passenger-bearing travel now behaves correctly through the queued cross-dimension handoff path.

Scope

This PR is intentionally limited to:

  • portal-driven cross-dimension travel
  • PWT-safe handoff for those transfers
  • passenger-bearing entity travel fixes

It does not attempt to broadly solve every cross-world command or side-effect case under PWT. That remains separate work.

kyssta-exe pushed a commit to kyssta-exe/Lumora that referenced this pull request Jun 3, 2026
Upstream has released updates that appear to apply and compile correctly

Leaves Changes:
LeavesMC/Leaves@08bfa446 Lithium Sleeping Block Entity(Winds-Studio#618) (Winds-Studio#630)
LeavesMC/Leaves@610eee60 fix: fix bot resume CME (Winds-Studio#635)
LeavesMC/Leaves@04dac366 Fix vanilla display name (Winds-Studio#638)
LeavesMC/Leaves@e5aba7eb feat: hopper counter unlimited speed(Winds-Studio#625) (Winds-Studio#639)
LeavesMC/Leaves@e44e469a fix: fix SleepingBlockEntity crash when /tick freeze (Winds-Studio#640)
LeavesMC/Leaves@5d653e31 fix: fix faster chunk serialization patch (Winds-Studio#641)
LeavesMC/Leaves@cb6cd658 [ci/skip] chore: fix patch header
LeavesMC/Leaves@8d9a5b2f [ci/skip]chore: rename hopper counter enable config (Winds-Studio#644)
LeavesMC/Leaves@cc019e8f [ci/skip] feat: add Bukkit.getFeatureManager api (Winds-Studio#645)
LeavesMC/Leaves@81da0c5e [ci/skip] Bring back LivingEntity effect CME (Winds-Studio#648)
LeavesMC/Leaves@ea91106a fix: fix hopper counter config (Winds-Studio#646)
LeavesMC/Leaves@230e0987 feat: mount action(Winds-Studio#619) (Winds-Studio#649)
LeavesMC/Leaves@d9f7afc4 fix: fix sleeping block entity(Winds-Studio#654) (Winds-Studio#655)
LeavesMC/Leaves@12f665c0 Refactor actions (Winds-Studio#650)
LeavesMC/Leaves@c29ff9a8 feat: swap action (Winds-Studio#657)
LeavesMC/Leaves@3c09044e fix: fix grindstone curse book overstacking(Winds-Studio#658) (Winds-Studio#659)
LeavesMC/Leaves@e05f3f7c Update paper, revert Winds-Studio#632 (Winds-Studio#662)
LeavesMC/Leaves@0c866281 Bot Improvements (Winds-Studio#661)
LeavesMC/Leaves@956f0227 feat: add skipTripwireHookPlacementValidation to mc-technical-mode, and format config (Winds-Studio#664)
LeavesMC/Leaves@e047327c fix: fix bot use raytrace (Winds-Studio#669)
LeavesMC/Leaves@29327349 Fix Winds-Studio#667 (Winds-Studio#668)
LeavesMC/Leaves@08f53c97 Fix bot cant get entity tracker (Winds-Studio#670)
LeavesMC/Leaves@e0d62b4e fix photographer bugs (Winds-Studio#666)
LeavesMC/Leaves@d094bdad fix: fix raid(Winds-Studio#626) (Winds-Studio#671)
LeavesMC/Leaves@678d4e20 Revert "Fix bot cant get entity tracker (Winds-Studio#670)"
LeavesMC/Leaves@e298d097 [ci/skip] fix: fix patch name (Winds-Studio#672)
LeavesMC/Leaves@099be5b8 [ci/skip] fix: fix push to api fail when commit contains double quotation marks (Winds-Studio#677)
LeavesMC/Leaves@ba8993d3 Fix fakeplayer cant get entity tracker correctly (Winds-Studio#676)
LeavesMC/Leaves@d93e9766  feat: merge old raid config, fix bugs (Winds-Studio#680)
LeavesMC/Leaves@bf55b2a4 fix: fix sleeping block entity bug (Winds-Studio#682)
LeavesMC/Leaves@5366b382 Fix creative no clip with projectile (Winds-Studio#683)
LeavesMC/Leaves@e55edbf8 Resolves Winds-Studio#685  (Winds-Studio#687)
LeavesMC/Leaves@a591ec57 Do not tick Arrow life regardless (Winds-Studio#688)
LeavesMC/Leaves@3623aea8 fix: stupid me (Winds-Studio#689)
LeavesMC/Leaves@73e63912 feat: update leavesclip to 3.0.7 (Winds-Studio#681)
LeavesMC/Leaves@bb5a1dff [ci/skip] fix: fix comment (Winds-Studio#692)
LeavesMC/Leaves@d87bc544 Fix Winds-Studio#690 (Winds-Studio#691)
LeavesMC/Leaves@79d9ef74 Update paper (Winds-Studio#693)
LeavesMC/Leaves@71790286 Fix optimize noise generation
LeavesMC/Leaves@3ffbde0b Optimize config transfer and remove
LeavesMC/Leaves@62e62242 feat: add logger for internal plugin, and format api code (Winds-Studio#696)
LeavesMC/Leaves@f37e9d37 Fix fakeplayer break action
LeavesMC/Leaves@aeb8e07d Fix fakeplayer break action * 2
LeavesMC/Leaves@40af0399 Fix StackableShulker config validator
LeavesMC/Leaves@122c7365 Fix fakeplayer use action
LeavesMC/Leaves@0ee80784 fix: fix photographer bugs (Winds-Studio#699)
LeavesMC/Leaves@a30c9abb Remove, and opt config and config command
LeavesMC/Leaves@4b21a968 New shears wrench (Winds-Studio#700)
LeavesMC/Leaves@0f40159c Enhance update suppression (Winds-Studio#701)
LeavesMC/Leaves@374605cd Fix bot (Winds-Studio#705)
LeavesMC/Leaves@ff563baf Fix creative no clip can attract xp-orb (Winds-Studio#706)
LeavesMC/Leaves@f0de3ecd refactor: use client side judgement instead of special judgement (Winds-Studio#708)
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