Keep unsimulated entities' UUIDs across saves and save player equipment as vanilla

save_entities forgot the UUID and compound of entities Horizon keeps but
does not simulate, so the save on quit gave them new UUIDs. The player's
equipment is written as LivingEntity does: omitted when empty, where
PlayerEquipment.isEmpty also counts the selected hotbar item.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-12 13:26:18 +02:00
parent feb043fda6
commit e2b3f7b4e9
2 changed files with 11 additions and 2 deletions
@@ -815,6 +815,7 @@ impl Game<'_> {
.chain(self.armor_stands.iter().map(|e| e.id))
.chain(self.item_frames.iter().map(|e| e.id))
.chain(self.paintings.iter().map(|e| e.id))
.chain(self.others.iter().map(|e| e.id))
.collect();
self.persist.uuids.retain(|id, _| alive.contains(id));
self.persist.raw.retain(|id, _| alive.contains(id));