diff --git a/crates/horizon-client/src/game/persist.rs b/crates/horizon-client/src/game/persist.rs index 5bc32a2e2..948039fcc 100644 --- a/crates/horizon-client/src/game/persist.rs +++ b/crates/horizon-client/src/game/persist.rs @@ -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)); diff --git a/crates/horizon-client/src/save.rs b/crates/horizon-client/src/save.rs index 5668bfde2..2029250fd 100644 --- a/crates/horizon-client/src/save.rs +++ b/crates/horizon-client/src/save.rs @@ -1837,8 +1837,16 @@ impl Level { }), ), ]; - // Vanilla writes `equipment` even when empty and omits an empty effect list. - entries.push(("equipment", Tag::compound(equipment))); + // LivingEntity.addAdditionalSaveData omits empty equipment and an empty + // effect list. PlayerEquipment.isEmpty also counts the selected hotbar + // item, which the codec never writes: holding one saves `equipment: {}`. + let holding = self + .inventory + .iter() + .any(|(slot, _, count, _)| i32::from(*slot) == self.selected_slot && *count > 0); + if holding || !equipment.is_empty() { + entries.push(("equipment", Tag::compound(equipment))); + } if self.active_effects.is_empty() { entries.retain(|(key, _)| *key != "active_effects"); }