mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 16:24: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) {
|
public Identifier getSkinTexture(GameProfile profile) {
|
||||||
PlayerSkinProvider skins = MinecraftClient.getInstance().getSkinProvider();
|
PlayerSkinProvider skins = MinecraftClient.getInstance().getSkinProvider();
|
||||||
|
|
||||||
|
@Nullable
|
||||||
MinecraftProfileTexture texture = skins.getTextures(profile).get(MinecraftProfileTexture.Type.SKIN);
|
MinecraftProfileTexture texture = skins.getTextures(profile).get(MinecraftProfileTexture.Type.SKIN);
|
||||||
|
|
||||||
|
if (texture == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return skins.loadSkin(texture, MinecraftProfileTexture.Type.SKIN);
|
return skins.loadSkin(texture, MinecraftProfileTexture.Type.SKIN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,9 +12,11 @@ class HDSkinsProxy extends SkinsProxy {
|
||||||
public Identifier getSkinTexture(GameProfile profile) {
|
public Identifier getSkinTexture(GameProfile profile) {
|
||||||
|
|
||||||
Identifier skin = HDSkins.getInstance().getTextures(profile).get(MinecraftProfileTexture.Type.SKIN);
|
Identifier skin = HDSkins.getInstance().getTextures(profile).get(MinecraftProfileTexture.Type.SKIN);
|
||||||
|
|
||||||
if (skin != null) {
|
if (skin != null) {
|
||||||
return skin;
|
return skin;
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.getSkinTexture(profile);
|
return super.getSkinTexture(profile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,11 +37,12 @@ public class PlayerSkullRenderer extends PonySkull {
|
||||||
deadMau5.setVisible(profile != null && "deadmau5".equals(profile.getName()));
|
deadMau5.setVisible(profile != null && "deadmau5".equals(profile.getName()));
|
||||||
|
|
||||||
if (profile != null) {
|
if (profile != null) {
|
||||||
|
|
||||||
Identifier skin = SkinsProxy.instance.getSkinTexture(profile);
|
Identifier skin = SkinsProxy.instance.getSkinTexture(profile);
|
||||||
|
|
||||||
if (skin != null) {
|
if (skin != null) {
|
||||||
return skin;
|
return skin;
|
||||||
}
|
}
|
||||||
|
|
||||||
return DefaultSkinHelper.getTexture(PlayerEntity.getUuidFromProfile(profile));
|
return DefaultSkinHelper.getTexture(PlayerEntity.getUuidFromProfile(profile));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue