[Bug - 1.21.11] Pearls get deleted when switching dimensions. #421

Open
opened 2025-12-27 11:45:00 +01:00 by coredex-source · 3 comments
coredex-source commented 2025-12-27 11:45:00 +01:00 (Migrated from github.com)

Expected behavior

Pearls should stay, for example, in a stasis chamber until a player dies if using the default gamerules.
Tested it on both Paper and Folia just to be sure.

Observed/Actual behavior

On PaperMC and vanilla Minecraft, the pearls do not get deleted when switching dimensions but on Folia 1.21.11 they do get deleted once the player leaves the dimension.

Steps/models to reproduce

Make a stasis chamber, put a pearl in the chamber and go through a portal to change dimensions.

Plugin and Datapack List

Tested with no additional plugins installed.

Folia version

1.21.11-6-ver/1.21.11@0795007

Other

No response

### Expected behavior Pearls should stay, for example, in a stasis chamber until a player dies if using the default gamerules. Tested it on both Paper and Folia just to be sure. ### Observed/Actual behavior On PaperMC and vanilla Minecraft, the pearls do not get deleted when switching dimensions but on Folia 1.21.11 they do get deleted once the player leaves the dimension. ### Steps/models to reproduce Make a stasis chamber, put a pearl in the chamber and go through a portal to change dimensions. ### Plugin and Datapack List Tested with no additional plugins installed. ### Folia version 1.21.11-6-ver/1.21.11@0795007 ### Other _No response_
SucIXR commented 2026-01-02 10:44:20 +01:00 (Migrated from github.com)

Actually, the reason is quite specific to how Folia handles player data compared to Vanilla/Paper.

  1. The Persistence Issue (Why they vanish on restart): In Vanilla and Paper, active Ender Pearls are stored inside the player's NBT data. However, because accessing ServerPlayer across threads is unsafe in Folia, the logic for saving and loading pearls via player NBT was completely removed. This is why pearls do not reappear when a player logs back in—the data is simply never saved.

  2. The Dimension/Region Issue (Why they vanish on teleport): Regarding your observation about pearls getting deleted when switching dimensions: This is because Folia performs extensive owner != null checks. Since Folia is multi-threaded, once the player leaves the pearl's current region (or dimension), the local entity lookup returns owner = null. Consequently, the pearl is immediately discarded/killed by the system.

The Solution: To fix this, we need to solve two problems:

How to safely store pearl data into the Player's NBT without triggering thread checks.

How to ensure the pearl keeps running/ticking even when the player is cross-region.

I have implemented a clever fix for these issues in my core. If you are interested, feel free to take a look.

Actually, the reason is quite specific to how Folia handles player data compared to Vanilla/Paper. 1. The Persistence Issue (Why they vanish on restart): In Vanilla and Paper, active Ender Pearls are stored inside the player's NBT data. However, because accessing ServerPlayer across threads is unsafe in Folia, the logic for saving and loading pearls via player NBT was completely removed. This is why pearls do not reappear when a player logs back in—the data is simply never saved. 2. The Dimension/Region Issue (Why they vanish on teleport): Regarding your observation about pearls getting deleted when switching dimensions: This is because Folia performs extensive owner != null checks. Since Folia is multi-threaded, once the player leaves the pearl's current region (or dimension), the local entity lookup returns owner = null. Consequently, the pearl is immediately discarded/killed by the system. The Solution: To fix this, we need to solve two problems: How to safely store pearl data into the Player's NBT without triggering thread checks. How to ensure the pearl keeps running/ticking even when the player is cross-region. I have implemented a clever fix for these issues in my core. If you are interested, feel free to take a look.
Dueris commented 2026-01-02 10:46:12 +01:00 (Migrated from github.com)

https://github.com/PaperMC/Folia/pull/423

This already fixes the issue. The dimension/region issue you described is incorrect, as its not owner != null checks, its if the owner is removed.

https://github.com/PaperMC/Folia/pull/423 This already fixes the issue. The dimension/region issue you described is incorrect, as its not owner != null checks, its if the owner is removed.
AnotherMaskedDev commented 2026-01-02 10:53:22 +01:00 (Migrated from github.com)

Yeah you may have overdone it in your core.
@SucIXR

Yeah you may have overdone it in your core. @SucIXR
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Minecraft/Folia#421
No description provided.