From 0bc85843ce0d9672c6990345af6ffd4e4b180993 Mon Sep 17 00:00:00 2001 From: socksprox Date: Sun, 25 Oct 2026 00:19:47 +0200 Subject: [PATCH 1/2] Client: remote players keep their skins instead of falling back MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit skins::unpack discarded a profile's whole textures payload when any one entry lacked "url" or pointed outside the texture services' domains, so a player with e.g. an unusual cape lost their skin too; it now drops only the offending texture. The 32 skin atlas slots evicted past players back to defaults on busy servers — now 128. A dimension reset (join game or respawn onto another world) now also clears the entity-id→profile map so a re-used entity id can't pin the wrong skin or name to a player, and the nametag join falls back to the player-list entry's name. Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- crates/horizon-client/src/game/remote.rs | 12 +++++++++++- crates/horizon-client/src/hud.rs | 4 +++- crates/horizon-client/src/skins.rs | 21 +++++++++++---------- 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/crates/horizon-client/src/game/remote.rs b/crates/horizon-client/src/game/remote.rs index 5a71b13a8..36122d42a 100644 --- a/crates/horizon-client/src/game/remote.rs +++ b/crates/horizon-client/src/game/remote.rs @@ -1006,6 +1006,9 @@ impl Game<'_> { r.stepped.clear(); r.head_lerps.clear(); r.pending_items.clear(); + // The entity ids are the old world's; the new dimension's + // player entities re-map to their profiles on AddEntity. + r.level_players.clear(); // A new ClientLevel: a new chunk storage, centred on 0, 0. r.chunk_center = (0, 0); } @@ -5065,7 +5068,14 @@ impl Game<'_> { r.level_players .iter() .filter(|(_, uuid)| **uuid != r.profile) - .filter_map(|(id, uuid)| Some((*id as u32, r.players.get(uuid)?.clone()))) + .filter_map(|(id, uuid)| { + let name = r + .players + .get(uuid) + .cloned() + .or_else(|| r.tab_players.get(uuid).map(|t| t.name.clone()))?; + Some((*id as u32, name)) + }) .collect() } /// `ClientClockManager.tick`: the clock moves on by the game time that diff --git a/crates/horizon-client/src/hud.rs b/crates/horizon-client/src/hud.rs index 89d1b1c3c..90a8b346c 100644 --- a/crates/horizon-client/src/hud.rs +++ b/crates/horizon-client/src/hud.rs @@ -78,7 +78,9 @@ pub const MAP_SLOTS: usize = 256; /// The atlas slot the minimap extra draws into. pub const MINIMAP_SPRITE: &str = "horizon/minimap"; /// Atlas slots for downloaded player skins (`skins/`), 64x64 each. -pub const SKIN_SLOTS: usize = 32; +/// Vanilla registers a texture per skin; too few slots evict a busy +/// server's players back to their default skins. +pub const SKIN_SLOTS: usize = 128; /// Reused by the visible rows of the classic world selector. pub const WORLD_ICON_SLOTS: usize = 32; /// Atlas slots for the pack icons on the pack screen, one per icon drawn diff --git a/crates/horizon-client/src/skins.rs b/crates/horizon-client/src/skins.rs index 9014032c4..0cf9cc8a2 100644 --- a/crates/horizon-client/src/skins.rs +++ b/crates/horizon-client/src/skins.rs @@ -92,22 +92,23 @@ pub fn unpack(value: &str, signature: Signature, valid_uris: &[&str]) -> Texture ..empty.clone() }; for (kind, texture) in textures { - let Some(url) = texture.get("url").and_then(|u| u.as_str()) else { - return empty; - }; - let allowed = valid_uris - .iter() - .any(|u| url.starts_with(&u.replace("{textureId}", ""))); - if !allowed { - return empty; - } let slot = match kind.as_str() { "SKIN" => &mut out.skin, "CAPE" => &mut out.cape, "ELYTRA" => &mut out.elytra, _ => continue, }; - *slot = Some(url.to_owned()); + // One bad entry (no `url`, or a URL outside the texture services' + // domains) drops only that texture, not the whole payload. + let Some(url) = texture.get("url").and_then(|u| u.as_str()) else { + continue; + }; + let allowed = valid_uris + .iter() + .any(|u| url.starts_with(&u.replace("{textureId}", ""))); + if allowed { + *slot = Some(url.to_owned()); + } } out } From fb1142cd71dba47247f5f897c8ff487362431413 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Sun, 25 Oct 2026 14:31:41 +0100 Subject: [PATCH 2/2] Skins: keep vanilla's whole-payload rejection, drop the dead name fallback authlib 10.0.77 MinecraftServicesSessionService.unpackTextures returns MinecraftProfileTextures.EMPTY when any texture has no URL or a URL outside the allowed domains, so skins::unpack goes back to main's behaviour. remote_player_names: r.players and r.tab_players are filled from the same ADD_PLAYER entries and emptied by the same PlayerInfoRemove, so the tab-list fallback could never apply. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/game/remote.rs | 9 +-------- crates/horizon-client/src/hud.rs | 5 +++-- crates/horizon-client/src/skins.rs | 21 ++++++++++----------- 3 files changed, 14 insertions(+), 21 deletions(-) diff --git a/crates/horizon-client/src/game/remote.rs b/crates/horizon-client/src/game/remote.rs index 36122d42a..74850110b 100644 --- a/crates/horizon-client/src/game/remote.rs +++ b/crates/horizon-client/src/game/remote.rs @@ -5068,14 +5068,7 @@ impl Game<'_> { r.level_players .iter() .filter(|(_, uuid)| **uuid != r.profile) - .filter_map(|(id, uuid)| { - let name = r - .players - .get(uuid) - .cloned() - .or_else(|| r.tab_players.get(uuid).map(|t| t.name.clone()))?; - Some((*id as u32, name)) - }) + .filter_map(|(id, uuid)| Some((*id as u32, r.players.get(uuid)?.clone()))) .collect() } /// `ClientClockManager.tick`: the clock moves on by the game time that diff --git a/crates/horizon-client/src/hud.rs b/crates/horizon-client/src/hud.rs index 90a8b346c..617126c2e 100644 --- a/crates/horizon-client/src/hud.rs +++ b/crates/horizon-client/src/hud.rs @@ -78,8 +78,9 @@ pub const MAP_SLOTS: usize = 256; /// The atlas slot the minimap extra draws into. pub const MINIMAP_SPRITE: &str = "horizon/minimap"; /// Atlas slots for downloaded player skins (`skins/`), 64x64 each. -/// Vanilla registers a texture per skin; too few slots evict a busy -/// server's players back to their default skins. +/// Vanilla registers a texture per skin. Here a skin evicted from its slot +/// is not stored again, and its player falls back to the default skin, so +/// the slots must cover a busy server's player list. pub const SKIN_SLOTS: usize = 128; /// Reused by the visible rows of the classic world selector. pub const WORLD_ICON_SLOTS: usize = 32; diff --git a/crates/horizon-client/src/skins.rs b/crates/horizon-client/src/skins.rs index 0cf9cc8a2..9014032c4 100644 --- a/crates/horizon-client/src/skins.rs +++ b/crates/horizon-client/src/skins.rs @@ -92,23 +92,22 @@ pub fn unpack(value: &str, signature: Signature, valid_uris: &[&str]) -> Texture ..empty.clone() }; for (kind, texture) in textures { + let Some(url) = texture.get("url").and_then(|u| u.as_str()) else { + return empty; + }; + let allowed = valid_uris + .iter() + .any(|u| url.starts_with(&u.replace("{textureId}", ""))); + if !allowed { + return empty; + } let slot = match kind.as_str() { "SKIN" => &mut out.skin, "CAPE" => &mut out.cape, "ELYTRA" => &mut out.elytra, _ => continue, }; - // One bad entry (no `url`, or a URL outside the texture services' - // domains) drops only that texture, not the whole payload. - let Some(url) = texture.get("url").and_then(|u| u.as_str()) else { - continue; - }; - let allowed = valid_uris - .iter() - .any(|u| url.starts_with(&u.replace("{textureId}", ""))); - if allowed { - *slot = Some(url.to_owned()); - } + *slot = Some(url.to_owned()); } out }