Introduction
Under specific circumstances (excluding server shutdown) it is possible for ender pearls to stop traveling due to the chunk ticket they register timing out before the pearl can tick again. This goes against the intent expressed in the article of the snapshot in which ender pearls were made capable of loading the chunks they’re in.
The process can be described in more discrete steps as follows:
The player throws a pearl;
the pearl gets accelerated to a very high degree by normal gameplay means (such as TNT);
the pearl starts travelling and arrives in a (potentially not generated) unloaded chunk, which is then synchronously loaded;
the pearl stops ticking and registers a new ticket;
the new ticket schedules an asynchronous task to start ticking the entities within its chunk;
the new ticket propagates to the surrounding chunks and schedules them to be asynchronously loaded;
the pearl starts ticking again and the cycle repeats (from step 3), until it is soon broken because of the following fact;
all the generation and ticket propagation tasks take precedence over the tasks that enable entities to tick;
the ticket the pearl registered times out before the completion of the task that would have enabled the pearl to tick;
all pending tasks for the pearl's chunk get cancelled;
the chunk and the pearl unload, and the cycle is broken.
Reproducible Practical Example
This example features a type of machine, typically built by players in survival mode, called an "ender pearl cannon". Its purpose is to accelerate ender pearls to high velocities in order to travel long distances. Videos of expected and observed behavior have been attached.
Note: This example is not reusable. You must restore the original save.
Prerequisites:
Download the attached world "Reproducible Practical Example.zip".
Position yourself at the cannon's platform. Use command
/execute in minecraft:overworld run tp @s 42.67 192.00 137.57 77.70 7.50
if necessary.Set your render and simulation distance to 12 chunks.
Steps:
Walk inside the spot for throwing pearls;
align yourself against the trapdoor and glass;
look straight up (pitch: -90);
throw the ender pearl;
wait for the pearl to arrive at its destination.
Expected behavior:
The pearl arrives at its destination, and teleports the player.
Observed behavior:
The pearl becomes and stays unloaded, unable to teleport the player.
Minimal Reproducible Example
This example uses command blocks to summon the TNT used to accelerate the summoned pearl, which is going to be assigned to the nearest player.
Note: This example is not reusable. You must restore the original save.
Prerequisites:
Download the attached world "Minimal Reproducible Example.zip".
Position yourself at the setup. Use command
/execute in minecraft:overworld run tp @s 993.50 56.00 1006.50 -135.00 0.00
if necessary.Set your render and simulation distance to 12 chunks.
Steps:
Enter flying mode to become immune to explosion knockback;
press the button on the floor;
wait for the pearl to arrive at its destination.
Expected behavior:
The pearl arrives at its destination, and teleports the player.
Observed behavior:
The pearl becomes and stays unloaded, unable to teleport the player.
Code Analysis and Proposed Solution
Note that the asynchronous nature of this issue and the wide scope of code paths it encompasses entails a lot of indirection. Therefore, a level of simplification by omission is warranted in the write-up of the analysis.
The write-up, featuring in-line images, is located in this GitHub gist: https://gist.github.com/VelizarBG/280e035b1a19f94770d332c0eab01fad
Explainer Video
The following is a video explaining this issue, and the general issue which causes it: https://www.youtube.com/watch?v=zyK0esiv-M8
Credits
Glotz (@theGlotzerify) - Reproducible Practical Example
Savva (@Savvvage_) - Minimal Reproducible Example and Explainer Video
enbyd (@enbyd) - Proofreading
Attachments
Comments 4
can confirm the issue in 1.21.5 and 25w19a.
i also tested the suggested fix, it fixes the issue correctly. As far as i can tell, the suggested fix doesnt break any of the archived/otherwise published redstone contraptions.
Just tested both world download examples in 1.21.5, following the provided instructions. The pearl did not teleport me in either example, even after multiple minutes of waiting for it to do so. Also, there were command blocks set up to record in chat the location of the pearl, and the chat output stopped soon after the pearl began traveling, indicating that the entity selector was unable to find the pearl at all due to it being unloaded.