mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 16:24: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 java.util.function.Function;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.minelittlepony.client.gui.hdskins.EntityPonyModel;
|
import com.minelittlepony.client.gui.hdskins.DummyPony;
|
||||||
import com.minelittlepony.client.gui.hdskins.RenderPonyModel;
|
import com.minelittlepony.client.gui.hdskins.RenderDummyPony;
|
||||||
import com.minelittlepony.client.mixin.MixinRenderManager;
|
import com.minelittlepony.client.mixin.MixinRenderManager;
|
||||||
import com.minelittlepony.client.model.races.PlayerModels;
|
import com.minelittlepony.client.model.races.PlayerModels;
|
||||||
import com.minelittlepony.client.render.LevitatingItemRenderer;
|
import com.minelittlepony.client.render.LevitatingItemRenderer;
|
||||||
|
@ -49,7 +49,7 @@ public class PonyRenderManager {
|
||||||
*/
|
*/
|
||||||
public void initialiseRenderers(EntityRenderDispatcher manager) {
|
public void initialiseRenderers(EntityRenderDispatcher manager) {
|
||||||
// Preview on the select skin gui
|
// 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();
|
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.MineLittlePony;
|
||||||
import com.minelittlepony.common.client.gui.element.IconicToggle;
|
import com.minelittlepony.common.client.gui.element.IconicToggle;
|
||||||
import com.minelittlepony.common.client.gui.style.Style;
|
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.GuiSkins;
|
||||||
import com.minelittlepony.hdskins.gui.PlayerPreview;
|
|
||||||
import com.minelittlepony.hdskins.net.SkinServer;
|
import com.minelittlepony.hdskins.net.SkinServer;
|
||||||
import com.minelittlepony.pony.IPonyManager;
|
import com.minelittlepony.pony.IPonyManager;
|
||||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||||
|
@ -66,7 +66,7 @@ public class GuiSkinsMineLP extends GuiSkins {
|
||||||
|
|
||||||
isWet = wet == 1;
|
isWet = wet == 1;
|
||||||
|
|
||||||
previewer.getLocal().releaseTextures();
|
previewer.getLocal().getTextures().release();;
|
||||||
|
|
||||||
if (previewer instanceof PonyPreview) {
|
if (previewer instanceof PonyPreview) {
|
||||||
((PonyPreview)previewer).setWet(isWet);
|
((PonyPreview)previewer).setWet(isWet);
|
||||||
|
@ -80,7 +80,7 @@ public class GuiSkinsMineLP extends GuiSkins {
|
||||||
|
|
||||||
MineLittlePony.logger.debug("Invalidating old local skin, checking updated local skin");
|
MineLittlePony.logger.debug("Invalidating old local skin, checking updated local skin");
|
||||||
if (type == Type.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.MineLittlePony;
|
||||||
import com.minelittlepony.client.pony.Pony;
|
import com.minelittlepony.client.pony.Pony;
|
||||||
import com.minelittlepony.hdskins.gui.EntityPlayerModel;
|
import com.minelittlepony.hdskins.dummy.DummyPlayer;
|
||||||
import com.minelittlepony.hdskins.gui.PlayerPreview;
|
import com.minelittlepony.hdskins.dummy.PlayerPreview;
|
||||||
import com.minelittlepony.pony.IPony;
|
import com.minelittlepony.pony.IPony;
|
||||||
import com.minelittlepony.pony.meta.Race;
|
import com.minelittlepony.pony.meta.Race;
|
||||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
||||||
|
|
||||||
public class PonyPreview extends PlayerPreview {
|
public class PonyPreview extends PlayerPreview {
|
||||||
|
|
||||||
private final EntityPonyModel localPlayer = new EntityPonyModel(minecraft.getSession().getProfile());
|
public static final Identifier NO_SKIN_PONY = new Identifier("minelittlepony", "textures/mob/noskin.png");
|
||||||
private final EntityPonyModel remotePlayer = new EntityPonyModel(minecraft.getSession().getProfile());
|
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) {
|
public void setWet(boolean isWet) {
|
||||||
((EntityPonyModel)localPlayer).setWet(isWet);
|
localPlayer.setWet(isWet);
|
||||||
((EntityPonyModel)remotePlayer).setWet(isWet);
|
remotePlayer.setWet(isWet);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected EntityPlayerModel ponify(EntityPlayerModel entity, EntityPlayerModel pony) {
|
@Override
|
||||||
Identifier loc = entity.getTexture(Type.SKIN).getTexture();
|
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) {
|
if (loc == null || Pony.getBufferedImage(loc) == null) {
|
||||||
return entity;
|
return pony;
|
||||||
}
|
}
|
||||||
|
|
||||||
IPony thePony = MineLittlePony.getInstance().getManager().getPony(loc);
|
IPony thePony = MineLittlePony.getInstance().getManager().getPony(loc);
|
||||||
|
@ -31,20 +43,20 @@ public class PonyPreview extends PlayerPreview {
|
||||||
Race race = thePony.getRace(false);
|
Race race = thePony.getRace(false);
|
||||||
|
|
||||||
if (race.isHuman()) {
|
if (race.isHuman()) {
|
||||||
return entity;
|
return human;
|
||||||
}
|
}
|
||||||
|
|
||||||
return pony;
|
return pony;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EntityPlayerModel getRemote() {
|
public DummyPlayer getRemote() {
|
||||||
return ponify(super.getRemote(), remotePlayer);
|
return ponify(super.getRemote(), remotePlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EntityPlayerModel getLocal() {
|
public DummyPlayer getLocal() {
|
||||||
return ponify(super.getLocal(), localPlayer);
|
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.RenderPony;
|
||||||
import com.minelittlepony.client.render.layer.LayerGear;
|
import com.minelittlepony.client.render.layer.LayerGear;
|
||||||
import com.minelittlepony.client.render.layer.LayerPonyElytra;
|
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.IPony;
|
||||||
import com.minelittlepony.pony.meta.Race;
|
import com.minelittlepony.pony.meta.Race;
|
||||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
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.
|
* 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);
|
super(manager);
|
||||||
addFeature(new LayerGear<>(this));
|
addFeature(new LayerGear<>(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
private ModelWrapper<EntityPonyModel, ClientPonyModel<EntityPonyModel>> playerModel;
|
private ModelWrapper<DummyPony, ClientPonyModel<DummyPony>> playerModel;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ModelWrapper<EntityPonyModel, ClientPonyModel<EntityPonyModel>> getModelWrapper() {
|
public ModelWrapper<DummyPony, ClientPonyModel<DummyPony>> getModelWrapper() {
|
||||||
return playerModel;
|
return playerModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPony getEntityPony(EntityPonyModel entity) {
|
public IPony getEntityPony(DummyPony entity) {
|
||||||
return MineLittlePony.getInstance().getManager().getPony(getTexture(entity));
|
return MineLittlePony.getInstance().getManager().getPony(getTexture(entity));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void scale(EntityPonyModel entity, float ticks) {
|
protected void scale(DummyPony entity, float ticks) {
|
||||||
renderPony.preRenderCallback(entity, ticks);
|
renderPony.preRenderCallback(entity, ticks);
|
||||||
|
|
||||||
GlStateManager.translatef(0, 0, -entity.getWidth() / 2); // move us to the center of the shadow
|
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")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public ClientPonyModel<EntityPonyModel> getEntityModel(EntityPonyModel playermodel) {
|
public ClientPonyModel<DummyPony> getEntityModel(DummyPony playermodel) {
|
||||||
Identifier loc = getTexture(playermodel);
|
Identifier loc = getTexture(playermodel);
|
||||||
|
|
||||||
boolean slim = playermodel.usesThinSkin();
|
boolean slim = playermodel.getTextures().usesThinSkin();
|
||||||
|
|
||||||
IPony thePony = MineLittlePony.getInstance().getManager().getPony(loc);
|
IPony thePony = MineLittlePony.getInstance().getManager().getPony(loc);
|
||||||
|
|
||||||
Race race = thePony.getRace(false);
|
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());
|
playerModel.apply(thePony.getMetadata());
|
||||||
|
|
||||||
renderPony.setPonyModel(playerModel);
|
renderPony.setPonyModel(playerModel);
|
||||||
|
@ -71,22 +71,22 @@ public class RenderPonyModel extends RenderPlayerModel<EntityPonyModel, ClientPo
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected FeatureRenderer<EntityPonyModel, ClientPonyModel<EntityPonyModel>> getElytraLayer() {
|
protected FeatureRenderer<DummyPony, ClientPonyModel<DummyPony>> getElytraLayer() {
|
||||||
return new LayerPonyElytra<EntityPonyModel, ClientPonyModel<EntityPonyModel>>(this) {
|
return new LayerPonyElytra<DummyPony, ClientPonyModel<DummyPony>>(this) {
|
||||||
@Override
|
@Override
|
||||||
protected Identifier getElytraTexture(EntityPonyModel entity) {
|
protected Identifier getElytraTexture(DummyPony entity) {
|
||||||
return entity.getTexture(Type.ELYTRA).getTexture();
|
return entity.getTextures().get(Type.ELYTRA).getId();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RenderPony<EntityPonyModel, ClientPonyModel<EntityPonyModel>> getInternalRenderer() {
|
public RenderPony<DummyPony, ClientPonyModel<DummyPony>> getInternalRenderer() {
|
||||||
return renderPony;
|
return renderPony;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Identifier findTexture(EntityPonyModel entity) {
|
public Identifier findTexture(DummyPony entity) {
|
||||||
return getTexture(entity);
|
return getTexture(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue