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 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-25 14:31:41 +01:00
parent 0bc85843ce
commit fb1142cd71
3 changed files with 14 additions and 21 deletions
+1 -8
View File
@@ -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
+3 -2
View File
@@ -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/<sha1>`), 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;
+10 -11
View File
@@ -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
}