Skip to content

Fix mounted minecarts not persisting across world reloads#979

Merged
rtm516 merged 2 commits intosmartcmd:mainfrom
ayushthoren:minecart-despawn-fix
Mar 13, 2026
Merged

Fix mounted minecarts not persisting across world reloads#979
rtm516 merged 2 commits intosmartcmd:mainfrom
ayushthoren:minecart-despawn-fix

Conversation

@ayushthoren
Copy link
Contributor

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:

  • OldChunkStorage::loadEntities
  • LevelChunk::load
  • ZonedChunkStorage::loadEntities

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

Signed-off-by: Ayush Thoren <ayushthoren@gmail.com>
Copy link
Collaborator

@rtm516 rtm516 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

patch.diff.txt

@ayushthoren
Copy link
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. :)

@rtm516
Copy link
Collaborator

rtm516 commented Mar 12, 2026

Odd its giving me errors when trying to push. Ill let you apply it then ill get this merged.

error: Authentication error: Authentication required: You must have push access to verify locks

@ayushthoren ayushthoren requested a review from rtm516 March 12, 2026 20:54
@rtm516 rtm516 merged commit d131a55 into smartcmd:main Mar 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Minecart With Mob Despawning Upon World Load.

2 participants