Fix POI update scheduling #419
No reviewers
Labels
No labels
documentation
good first issue
help wanted
resolution: duplicate
resolution: invalid
resolution: won't fix
status: needs triage
type: bug
type: feature
type: performance
type: question
version: 1.19.4
version: 1.20
version: 1.20.1
version: 1.20.2
version: 1.20.4
version: 1.20.6
version: 1.21.11
version: 1.21.4
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Minecraft/Folia!419
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "CraftCanvasMC/fix/poi-scheduling"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
While POI update scheduling works fine on Folia, it has a major flaw with how it works. In the region threading base patch, Folia replaces the method call
BlockableEventLoop#executewithRegionizedTaskQueue#queueChunkTask. While this works fine in general gameplay, it does cause all POI updates to be scheduled to the next tick, which technically breaks vanilla behavior and also breaks a few things(videos and images bellow).The
BlockableEventLoop#executemethod is as such:Essentially, it checks if it is the "main thread" or not(which no longer exists in Folia, but for this case we will assume the "main thread" is the region owning the
BlockPoswe are updating at), and if it is the "main thread", it will run the task immediately, otherwise, it will schedule for the next tick.Folia breaks this logic, as it always schedules for the next tick. While in normal gameplay, this is fine, but in some occurrences this does cause issues, like bellow:

https://github.com/user-attachments/assets/0d484092-1798-4e32-be6c-3e6d77a652a7
The image and video were linked to me in DMs, and I did followup testing in a local Folia instance. This is replicatable by creating a nether portal, either in the overworld or nether, with no exit portal currently generated. Then, if you spam entities through the portal, it will spam create portals on the other end, due to the POI update being scheduled for the next tick. While this probably is unlikely to happen in survival or something, other issues may be present that haven't been caught yet, and it is probably best to restore the Vanilla functionality of POI updating.
The fix I propose in this PR just swaps scheduling for the next tick with the Consumer bellow:
The consumer provided above fixes the functionality difference between Folia and Vanilla, while also fixing the issue shown above with the nether exit portal.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.