It is possible that when the reference count is retrieved that
the ticket updates have not yet been processed, which means
that the region section at the queued position may not exist or may
become nonexistant while or after the task is being added.
This restructures the reference counting code to now refer to
both a reference counter and a flag indicating whether ticket
updates are processed.
Fixes https://github.com/PaperMC/Folia/issues/262
This issue shows the race condition where the region becomes
nonexistant.
If we cannot find a spawn pos in the spawn radius,
use the same fallback logic as when the world type or player's
gamemode does not support spawn selection. This adjusts the spawn
position to not be inside a wall or on water.
The spawn selection may actually be farther than 32 blocks,
so we need a larger load radius to prevent a deadlock on startup.
Additionally, re-insert thread checks for sync loads that were
previously in 1.20.
If a player moves away before the raid is created, then we would
possibly trigger the raid cross-region.
Considering Vanilla doesn't trigger the raid cross-dimension, this
doesn't seem like an important behavior to break.
Fixes https://github.com/PaperMC/Folia/issues/264
CraftEntity properly tracks the underlying entity handle
when the entity teleports. This resolves a race condition
where if an enderpearl was ticked while its owner was teleporting,
the owner reference would be lost.
Fixes https://github.com/PaperMC/Folia/issues/279
This field is covered by the entity tracker optimisations in Paper,
but currently was not properly maintained - resulting in memory leaks.
Fixes https://github.com/PaperMC/Folia/issues/283
Most significant changes are to portal/teleport logic, there may
be some bugs there. Not really concerned about the passenger
teleport, as Folia had already added support for that.
Not sure how the spark changes are going to work.