Fixed skin preview showing background ponies when given a broken skin

This commit is contained in:
Sollace 2021-05-16 16:20:02 +02:00
parent f646536849
commit 1423e6d7b0
3 changed files with 9 additions and 2 deletions

View file

@ -72,4 +72,6 @@ public interface IPonyManager {
static boolean isSlimSkin(UUID uuid) { static boolean isSlimSkin(UUID uuid) {
return (uuid.hashCode() & 1) == 1; return (uuid.hashCode() & 1) == 1;
} }
interface ForcedPony {}
} }

View file

@ -1,6 +1,7 @@
package com.minelittlepony.client.hdskins; package com.minelittlepony.client.hdskins;
import com.minelittlepony.api.model.ModelAttributes; import com.minelittlepony.api.model.ModelAttributes;
import com.minelittlepony.api.pony.IPonyManager;
import com.minelittlepony.client.IPreviewModel; import com.minelittlepony.client.IPreviewModel;
import com.minelittlepony.client.MineLittlePony; import com.minelittlepony.client.MineLittlePony;
import com.minelittlepony.client.model.entity.race.PlayerModels; import com.minelittlepony.client.model.entity.race.PlayerModels;
@ -10,7 +11,7 @@ import com.minelittlepony.hdskins.client.dummy.TextureProxy;
/** /**
* Dummy model used for the skin uploading screen. * Dummy model used for the skin uploading screen.
*/ */
class DummyPony extends DummyPlayer implements IPreviewModel, ModelAttributes.Swimmer { class DummyPony extends DummyPlayer implements IPreviewModel, ModelAttributes.Swimmer, IPonyManager.ForcedPony {
public DummyPony(TextureProxy textures) { public DummyPony(TextureProxy textures) {
super(textures); super(textures);
@ -31,7 +32,7 @@ class DummyPony extends DummyPlayer implements IPreviewModel, ModelAttributes.Sw
} }
return PlayerModels.forRace(MineLittlePony.getInstance().getManager() return PlayerModels.forRace(MineLittlePony.getInstance().getManager()
.getPony(this) .getPony(this)
.getRace(false)) .getRace(true))
.getId(super.getModel().contains("slim")); .getId(super.getModel().contains("slim"));
} }
} }

View file

@ -66,6 +66,10 @@ public class PonyManager implements IPonyManager, IdentifiableResourceReloadList
return getDefaultPony(uuid); return getDefaultPony(uuid);
} }
if (player instanceof IPonyManager.ForcedPony) {
return getPony(skin);
}
return getPony(skin, uuid); return getPony(skin, uuid);
} }