Fix mounted minecarts not persisting across world reloads#979
Merged
rtm516 merged 2 commits intosmartcmd:mainfrom Mar 13, 2026
Merged
Fix mounted minecarts not persisting across world reloads#979rtm516 merged 2 commits intosmartcmd:mainfrom
rtm516 merged 2 commits intosmartcmd:mainfrom
Conversation
Signed-off-by: Ayush Thoren <ayushthoren@gmail.com>
2 tasks
rtm516
requested changes
Mar 12, 2026
Collaborator
rtm516
left a comment
There was a problem hiding this comment.
Can we get addRidingEntities defined in LevelChunk? I've attached a patch to do this, or you can tick the box on the right to allow maintainers access to push to the PR
Contributor
Author
|
I have already given maintainers edit access, but I can apply the patch when I have time unless you get to it before me. :) |
Collaborator
|
Odd its giving me errors when trying to push. Ill let you apply it then ill get this merged.
|
rtm516
approved these changes
Mar 13, 2026
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.
Description
This PR fixes an issue where minecarts with riders would not spawn in properly upon loading a world.
Changes
Previous Behavior
If an entity was riding a minecart when the world was saved, reopening the world could leave the rider unmounted and the minecart missing. Minecarts without riders persisted normally.
Root Cause
Mounted minecarts were saved through the rider’s NBT data, but chunk entity loading only restored top-level entities and did not rebuild that chain.
New Behavior
When a world is reloaded, entities saved with mounts correctly restore their full riding chain, so ridden minecarts are present and still mounted.
Fix Implementation
Added riding chain reconstruction during chunk entity load in all relevant paths:
Each loader now goes through
Entity::RIDING_TAG, loads each mount entity, adds it to the chunk, and links them properly.AI Use Disclosure
I used AI as a tool to search for the chunk entity loading logic, then implemented the fix myself.
Related Issues