2019-11-23 22:19:13 +01:00
|
|
|
package com.minelittlepony.client.hdskins;
|
2019-05-28 14:47:21 +02:00
|
|
|
|
|
|
|
import net.minecraft.util.Identifier;
|
|
|
|
|
2019-07-08 04:47:13 +02:00
|
|
|
import com.minelittlepony.client.MineLittlePony;
|
2019-05-28 19:02:07 +02:00
|
|
|
import com.minelittlepony.hdskins.dummy.DummyPlayer;
|
|
|
|
import com.minelittlepony.hdskins.dummy.PlayerPreview;
|
2019-08-23 11:12:20 +02:00
|
|
|
import com.minelittlepony.hdskins.profile.SkinType;
|
2019-05-28 14:47:21 +02:00
|
|
|
import com.minelittlepony.pony.IPony;
|
|
|
|
import com.minelittlepony.pony.meta.Race;
|
|
|
|
|
2019-06-30 13:00:29 +02:00
|
|
|
class PonyPreview extends PlayerPreview {
|
2019-05-28 14:47:21 +02:00
|
|
|
|
2019-05-28 19:02:07 +02:00
|
|
|
public static final Identifier NO_SKIN_PONY = new Identifier("minelittlepony", "textures/mob/noskin.png");
|
|
|
|
public static final Identifier NO_SKIN_SEAPONY = new Identifier("minelittlepony", "textures/mob/noskin_seapony.png");
|
|
|
|
|
2019-05-29 12:23:33 +02:00
|
|
|
private final DummyPony localPony = new DummyPony(localTextures);
|
|
|
|
private final DummyPony remotePony = new DummyPony(remoteTextures);
|
2019-05-28 14:47:21 +02:00
|
|
|
|
|
|
|
public void setWet(boolean isWet) {
|
2019-05-29 12:23:33 +02:00
|
|
|
localPony.setWet(isWet);
|
|
|
|
remotePony.setWet(isWet);
|
2019-05-28 19:02:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-11-23 18:28:42 +01:00
|
|
|
public Identifier getBlankSteveSkin(SkinType type) {
|
2019-08-23 11:12:20 +02:00
|
|
|
if (type == SkinType.SKIN) {
|
2019-05-29 12:23:33 +02:00
|
|
|
// Initialization order means this method might be called before class members have been initialized.
|
|
|
|
// This is something that needs to be fixed in HDSkins
|
|
|
|
return localPony != null && localPony.wet ? NO_SKIN_SEAPONY : NO_SKIN_PONY;
|
2019-05-28 19:02:07 +02:00
|
|
|
}
|
2019-11-23 18:28:42 +01:00
|
|
|
return super.getBlankSteveSkin(type);
|
2019-05-28 14:47:21 +02:00
|
|
|
}
|
|
|
|
|
2019-05-28 19:02:07 +02:00
|
|
|
protected DummyPlayer ponify(DummyPlayer human, DummyPlayer pony) {
|
2019-08-23 11:12:20 +02:00
|
|
|
Identifier loc = human.getTextures().get(SkinType.SKIN).getId();
|
2019-05-28 19:02:07 +02:00
|
|
|
|
2019-07-14 01:12:19 +02:00
|
|
|
if (loc == null) {
|
2019-05-28 19:02:07 +02:00
|
|
|
return pony;
|
2019-05-28 14:47:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
IPony thePony = MineLittlePony.getInstance().getManager().getPony(loc);
|
|
|
|
|
2019-05-29 12:23:33 +02:00
|
|
|
Race race = thePony.getRace(true);
|
2019-05-28 14:47:21 +02:00
|
|
|
|
|
|
|
if (race.isHuman()) {
|
2019-05-28 19:02:07 +02:00
|
|
|
return human;
|
2019-05-28 14:47:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return pony;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-05-28 19:02:07 +02:00
|
|
|
public DummyPlayer getRemote() {
|
2019-05-29 12:23:33 +02:00
|
|
|
return ponify(super.getRemote(), remotePony);
|
2019-05-28 14:47:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
2019-05-28 19:02:07 +02:00
|
|
|
public DummyPlayer getLocal() {
|
2019-05-29 12:23:33 +02:00
|
|
|
return ponify(super.getLocal(), localPony);
|
2019-05-28 14:47:21 +02:00
|
|
|
}
|
|
|
|
}
|