mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 08:14:23 +01:00
Fixed crash when rendering player skulls for a player without a loaded skin
This commit is contained in:
parent
cba4fac039
commit
74a09d7b0c
3 changed files with 10 additions and 1 deletions
|
@ -16,7 +16,13 @@ public class SkinsProxy {
|
|||
public Identifier getSkinTexture(GameProfile profile) {
|
||||
PlayerSkinProvider skins = MinecraftClient.getInstance().getSkinProvider();
|
||||
|
||||
@Nullable
|
||||
MinecraftProfileTexture texture = skins.getTextures(profile).get(MinecraftProfileTexture.Type.SKIN);
|
||||
|
||||
if (texture == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return skins.loadSkin(texture, MinecraftProfileTexture.Type.SKIN);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,9 +12,11 @@ class HDSkinsProxy extends SkinsProxy {
|
|||
public Identifier getSkinTexture(GameProfile profile) {
|
||||
|
||||
Identifier skin = HDSkins.getInstance().getTextures(profile).get(MinecraftProfileTexture.Type.SKIN);
|
||||
|
||||
if (skin != null) {
|
||||
return skin;
|
||||
}
|
||||
|
||||
return super.getSkinTexture(profile);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,11 +37,12 @@ public class PlayerSkullRenderer extends PonySkull {
|
|||
deadMau5.setVisible(profile != null && "deadmau5".equals(profile.getName()));
|
||||
|
||||
if (profile != null) {
|
||||
|
||||
Identifier skin = SkinsProxy.instance.getSkinTexture(profile);
|
||||
|
||||
if (skin != null) {
|
||||
return skin;
|
||||
}
|
||||
|
||||
return DefaultSkinHelper.getTexture(PlayerEntity.getUuidFromProfile(profile));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue