mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 08:14:23 +01:00
Pony models should now work a little btter in the skins gui. Also name changes, because sanity.
RenderPonyModel -> RenderDummyPony EntityPonyModel -> DummyPony
This commit is contained in:
parent
b80f2da500
commit
517dc368a3
6 changed files with 80 additions and 78 deletions
|
@ -4,8 +4,8 @@ import java.util.Map;
|
|||
import java.util.function.Function;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.minelittlepony.client.gui.hdskins.EntityPonyModel;
|
||||
import com.minelittlepony.client.gui.hdskins.RenderPonyModel;
|
||||
import com.minelittlepony.client.gui.hdskins.DummyPony;
|
||||
import com.minelittlepony.client.gui.hdskins.RenderDummyPony;
|
||||
import com.minelittlepony.client.mixin.MixinRenderManager;
|
||||
import com.minelittlepony.client.model.races.PlayerModels;
|
||||
import com.minelittlepony.client.render.LevitatingItemRenderer;
|
||||
|
@ -49,7 +49,7 @@ public class PonyRenderManager {
|
|||
*/
|
||||
public void initialiseRenderers(EntityRenderDispatcher manager) {
|
||||
// Preview on the select skin gui
|
||||
MineLPClient.getInstance().getModUtilities().addRenderer(EntityPonyModel.class, RenderPonyModel::new);
|
||||
MineLPClient.getInstance().getModUtilities().addRenderer(DummyPony.class, RenderDummyPony::new);
|
||||
|
||||
PlayerModels[] models = PlayerModels.values();
|
||||
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package com.minelittlepony.client.gui.hdskins;
|
||||
|
||||
import com.minelittlepony.hdskins.dummy.DummyPlayer;
|
||||
import com.minelittlepony.hdskins.dummy.TextureProxy;
|
||||
import com.minelittlepony.hdskins.resources.LocalTexture;
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
||||
|
||||
/**
|
||||
* Dummy model used for the skin uploading screen.
|
||||
*/
|
||||
public class DummyPony extends DummyPlayer {
|
||||
|
||||
public boolean wet = false;
|
||||
|
||||
public DummyPony(TextureProxy textures) {
|
||||
super(textures);
|
||||
}
|
||||
|
||||
public void setWet(boolean wet) {
|
||||
this.wet = wet;
|
||||
|
||||
LocalTexture skin = getTextures().get(Type.SKIN);
|
||||
|
||||
if (wet && skin.getId() == PonyPreview.NO_SKIN_PONY) {
|
||||
skin.reset();
|
||||
}
|
||||
|
||||
if (!wet && skin.getId() == PonyPreview.NO_SKIN_SEAPONY) {
|
||||
skin.reset();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
package com.minelittlepony.client.gui.hdskins;
|
||||
|
||||
import com.minelittlepony.hdskins.gui.EntityPlayerModel;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
||||
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
/**
|
||||
* Dummy model used for the skin uploading screen.
|
||||
*/
|
||||
public class EntityPonyModel extends EntityPlayerModel {
|
||||
|
||||
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");
|
||||
|
||||
public boolean wet = false;
|
||||
|
||||
public EntityPonyModel(GameProfile profile) {
|
||||
super(profile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier getBlankSkin(Type type) {
|
||||
if (type == Type.SKIN) {
|
||||
return wet ? NO_SKIN_SEAPONY : NO_SKIN_PONY;
|
||||
}
|
||||
return super.getBlankSkin(type);
|
||||
}
|
||||
|
||||
public void setWet(boolean wet) {
|
||||
this.wet = wet;
|
||||
|
||||
if (wet && skin.getTexture() == NO_SKIN_PONY) {
|
||||
skin.reset();
|
||||
}
|
||||
|
||||
if (!wet && skin.getTexture() == NO_SKIN_SEAPONY) {
|
||||
skin.reset();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,8 +3,8 @@ package com.minelittlepony.client.gui.hdskins;
|
|||
import com.minelittlepony.MineLittlePony;
|
||||
import com.minelittlepony.common.client.gui.element.IconicToggle;
|
||||
import com.minelittlepony.common.client.gui.style.Style;
|
||||
import com.minelittlepony.hdskins.dummy.PlayerPreview;
|
||||
import com.minelittlepony.hdskins.gui.GuiSkins;
|
||||
import com.minelittlepony.hdskins.gui.PlayerPreview;
|
||||
import com.minelittlepony.hdskins.net.SkinServer;
|
||||
import com.minelittlepony.pony.IPonyManager;
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||
|
@ -66,7 +66,7 @@ public class GuiSkinsMineLP extends GuiSkins {
|
|||
|
||||
isWet = wet == 1;
|
||||
|
||||
previewer.getLocal().releaseTextures();
|
||||
previewer.getLocal().getTextures().release();;
|
||||
|
||||
if (previewer instanceof PonyPreview) {
|
||||
((PonyPreview)previewer).setWet(isWet);
|
||||
|
@ -80,7 +80,7 @@ public class GuiSkinsMineLP extends GuiSkins {
|
|||
|
||||
MineLittlePony.logger.debug("Invalidating old local skin, checking updated local skin");
|
||||
if (type == Type.SKIN) {
|
||||
ponyManager.removePony(previewer.getLocal().getTexture(Type.SKIN).getTexture());
|
||||
ponyManager.removePony(previewer.getLocal().getTextures().get(Type.SKIN).getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,26 +4,38 @@ import net.minecraft.util.Identifier;
|
|||
|
||||
import com.minelittlepony.MineLittlePony;
|
||||
import com.minelittlepony.client.pony.Pony;
|
||||
import com.minelittlepony.hdskins.gui.EntityPlayerModel;
|
||||
import com.minelittlepony.hdskins.gui.PlayerPreview;
|
||||
import com.minelittlepony.hdskins.dummy.DummyPlayer;
|
||||
import com.minelittlepony.hdskins.dummy.PlayerPreview;
|
||||
import com.minelittlepony.pony.IPony;
|
||||
import com.minelittlepony.pony.meta.Race;
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
||||
|
||||
public class PonyPreview extends PlayerPreview {
|
||||
|
||||
private final EntityPonyModel localPlayer = new EntityPonyModel(minecraft.getSession().getProfile());
|
||||
private final EntityPonyModel remotePlayer = new EntityPonyModel(minecraft.getSession().getProfile());
|
||||
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");
|
||||
|
||||
private final DummyPony localPlayer = new DummyPony(localTextures);
|
||||
private final DummyPony remotePlayer = new DummyPony(remoteTextures);
|
||||
|
||||
public void setWet(boolean isWet) {
|
||||
((EntityPonyModel)localPlayer).setWet(isWet);
|
||||
((EntityPonyModel)remotePlayer).setWet(isWet);
|
||||
localPlayer.setWet(isWet);
|
||||
remotePlayer.setWet(isWet);
|
||||
}
|
||||
|
||||
protected EntityPlayerModel ponify(EntityPlayerModel entity, EntityPlayerModel pony) {
|
||||
Identifier loc = entity.getTexture(Type.SKIN).getTexture();
|
||||
@Override
|
||||
public Identifier getBlankSkin(Type type) {
|
||||
if (type == Type.SKIN) {
|
||||
return localPlayer.wet ? NO_SKIN_SEAPONY : NO_SKIN_PONY;
|
||||
}
|
||||
return super.getBlankSkin(type);
|
||||
}
|
||||
|
||||
protected DummyPlayer ponify(DummyPlayer human, DummyPlayer pony) {
|
||||
Identifier loc = human.getTextures().get(Type.SKIN).getId();
|
||||
|
||||
if (loc == null || Pony.getBufferedImage(loc) == null) {
|
||||
return entity;
|
||||
return pony;
|
||||
}
|
||||
|
||||
IPony thePony = MineLittlePony.getInstance().getManager().getPony(loc);
|
||||
|
@ -31,20 +43,20 @@ public class PonyPreview extends PlayerPreview {
|
|||
Race race = thePony.getRace(false);
|
||||
|
||||
if (race.isHuman()) {
|
||||
return entity;
|
||||
return human;
|
||||
}
|
||||
|
||||
return pony;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityPlayerModel getRemote() {
|
||||
public DummyPlayer getRemote() {
|
||||
return ponify(super.getRemote(), remotePlayer);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public EntityPlayerModel getLocal() {
|
||||
public DummyPlayer getLocal() {
|
||||
return ponify(super.getLocal(), localPlayer);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.minelittlepony.client.render.IPonyRender;
|
|||
import com.minelittlepony.client.render.RenderPony;
|
||||
import com.minelittlepony.client.render.layer.LayerGear;
|
||||
import com.minelittlepony.client.render.layer.LayerPonyElytra;
|
||||
import com.minelittlepony.hdskins.gui.RenderPlayerModel;
|
||||
import com.minelittlepony.hdskins.dummy.RenderDummyPlayer;
|
||||
import com.minelittlepony.pony.IPony;
|
||||
import com.minelittlepony.pony.meta.Race;
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
||||
|
@ -21,29 +21,29 @@ import net.minecraft.util.Identifier;
|
|||
/**
|
||||
* Renderer used for the dummy pony model when selecting a skin.
|
||||
*/
|
||||
public class RenderPonyModel extends RenderPlayerModel<EntityPonyModel, ClientPonyModel<EntityPonyModel>> implements IPonyRender<EntityPonyModel, ClientPonyModel<EntityPonyModel>> {
|
||||
public class RenderDummyPony extends RenderDummyPlayer<DummyPony, ClientPonyModel<DummyPony>> implements IPonyRender<DummyPony, ClientPonyModel<DummyPony>> {
|
||||
|
||||
protected final RenderPony<EntityPonyModel, ClientPonyModel<EntityPonyModel>> renderPony = new RenderPony<>(this);
|
||||
protected final RenderPony<DummyPony, ClientPonyModel<DummyPony>> renderPony = new RenderPony<>(this);
|
||||
|
||||
public RenderPonyModel(EntityRenderDispatcher manager) {
|
||||
public RenderDummyPony(EntityRenderDispatcher manager) {
|
||||
super(manager);
|
||||
addFeature(new LayerGear<>(this));
|
||||
}
|
||||
|
||||
private ModelWrapper<EntityPonyModel, ClientPonyModel<EntityPonyModel>> playerModel;
|
||||
private ModelWrapper<DummyPony, ClientPonyModel<DummyPony>> playerModel;
|
||||
|
||||
@Override
|
||||
public ModelWrapper<EntityPonyModel, ClientPonyModel<EntityPonyModel>> getModelWrapper() {
|
||||
public ModelWrapper<DummyPony, ClientPonyModel<DummyPony>> getModelWrapper() {
|
||||
return playerModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPony getEntityPony(EntityPonyModel entity) {
|
||||
public IPony getEntityPony(DummyPony entity) {
|
||||
return MineLittlePony.getInstance().getManager().getPony(getTexture(entity));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void scale(EntityPonyModel entity, float ticks) {
|
||||
protected void scale(DummyPony entity, float ticks) {
|
||||
renderPony.preRenderCallback(entity, ticks);
|
||||
|
||||
GlStateManager.translatef(0, 0, -entity.getWidth() / 2); // move us to the center of the shadow
|
||||
|
@ -51,18 +51,18 @@ public class RenderPonyModel extends RenderPlayerModel<EntityPonyModel, ClientPo
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public ClientPonyModel<EntityPonyModel> getEntityModel(EntityPonyModel playermodel) {
|
||||
public ClientPonyModel<DummyPony> getEntityModel(DummyPony playermodel) {
|
||||
Identifier loc = getTexture(playermodel);
|
||||
|
||||
boolean slim = playermodel.usesThinSkin();
|
||||
boolean slim = playermodel.getTextures().usesThinSkin();
|
||||
|
||||
IPony thePony = MineLittlePony.getInstance().getManager().getPony(loc);
|
||||
|
||||
Race race = thePony.getRace(false);
|
||||
|
||||
boolean canWet = playermodel.wet && (loc == playermodel.getBlankSkin(Type.SKIN) || race == Race.SEAPONY);
|
||||
boolean canWet = playermodel.wet && (loc == playermodel.getTextures().getBlankSkin(Type.SKIN) || race == Race.SEAPONY);
|
||||
|
||||
playerModel = canWet ? PlayerModels.SEAPONY.getModel(slim) : PlayerModels.forRace(thePony.getRace(true)).getModel(slim);
|
||||
playerModel = new ModelWrapper<>(canWet ? PlayerModels.SEAPONY.getModel(slim) : PlayerModels.forRace(thePony.getRace(true)).getModel(slim));
|
||||
playerModel.apply(thePony.getMetadata());
|
||||
|
||||
renderPony.setPonyModel(playerModel);
|
||||
|
@ -71,22 +71,22 @@ public class RenderPonyModel extends RenderPlayerModel<EntityPonyModel, ClientPo
|
|||
}
|
||||
|
||||
@Override
|
||||
protected FeatureRenderer<EntityPonyModel, ClientPonyModel<EntityPonyModel>> getElytraLayer() {
|
||||
return new LayerPonyElytra<EntityPonyModel, ClientPonyModel<EntityPonyModel>>(this) {
|
||||
protected FeatureRenderer<DummyPony, ClientPonyModel<DummyPony>> getElytraLayer() {
|
||||
return new LayerPonyElytra<DummyPony, ClientPonyModel<DummyPony>>(this) {
|
||||
@Override
|
||||
protected Identifier getElytraTexture(EntityPonyModel entity) {
|
||||
return entity.getTexture(Type.ELYTRA).getTexture();
|
||||
protected Identifier getElytraTexture(DummyPony entity) {
|
||||
return entity.getTextures().get(Type.ELYTRA).getId();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderPony<EntityPonyModel, ClientPonyModel<EntityPonyModel>> getInternalRenderer() {
|
||||
public RenderPony<DummyPony, ClientPonyModel<DummyPony>> getInternalRenderer() {
|
||||
return renderPony;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier findTexture(EntityPonyModel entity) {
|
||||
public Identifier findTexture(DummyPony entity) {
|
||||
return getTexture(entity);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue