Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #104
Problem
With
use_async_chunks_on_login_v2=true, the async login path callsPlayerManager#loadPlayerDatabefore the normal player join.PlayerManager#onPlayerConnectlater callsloadPlayerDataagain on thesame
ServerPlayerEntity.This is unsafe for mod-owned player data that is not designed to be
deserialized twice. Cardinal Components API is one affected case. An
equipped Traveler's Backpack can be loaded during the VMP preload and then
cleared during the normal join load. The next player save persists the empty
component, which makes the item loss permanent.
This reproduces issue #104.
Change
The async preload no longer applies complete player data to the
ServerPlayerEntity.It reads only the saved values needed to choose the chunk to preload:
Dimension;Pos,For the integrated-server host, the lookup uses a copy of the cached player
NBT. For other players, it reads the saved
.dator.dat_olddata andapplies the normal player data fixer.
The resulting
ReadViewis used only for the dimension and position lookup.The full player data is still deserialized once by the normal
PlayerManager#onPlayerConnectpath.This keeps async chunk loading enabled without running arbitrary mod player
deserialization twice.
Testing
Tested on Minecraft 1.21.8 with:
0.2.0+beta.7.208;10.8.4;7.0.0-beta.1;use_async_chunks_on_login_v2=true,gradlew.bat clean buildcompletes successfully.The original failure reproduces on
0.2.0+beta.7.207: an equipped backpackdisappears after leaving and re-entering the world, and its saved wearable
component becomes empty.
With this patch, the backpack and its contents survive repeated save/rejoin
cycles while equipped, in the normal inventory, and after being dropped and
picked up.
The same test also passes with C2ME installed.