Merge branch 'parity/hud' into parity-base

This commit is contained in:
Ludovic Marie
2026-10-12 16:43:50 +02:00
53 changed files with 6563 additions and 424 deletions
+21 -3
View File
@@ -1846,8 +1846,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");
}
@@ -1943,7 +1951,17 @@ impl Level {
map.remove(&JavaString::from(key));
}
}
let uuid = *self.player_uuid.get_or_insert_with(random_uuid);
// A new world's player has the offline profile id of its name
// (UUIDUtil.createOfflinePlayerUUID), as in an offline single-player game.
let uuid = *self.player_uuid.get_or_insert_with(|| {
let u = horizon_protocol::crypto::offline_uuid("Player");
[
(u >> 96) as u32 as i32,
(u >> 64) as u32 as i32,
(u >> 32) as u32 as i32,
u as u32 as i32,
]
});
// A new world's first spawn point is its world spawn.
if self.world_spawn.is_none() {
self.world_spawn = self.spawn.map(|s| {