Fixed remote preview player not being scaled correctly

This commit is contained in:
Sollace 2018-07-27 16:04:56 +02:00
parent 7d60a05317
commit 5635e9cd4c
2 changed files with 34 additions and 13 deletions

View file

@ -115,13 +115,4 @@ public class RenderPlayerModel<M extends EntityPlayerModel> extends RenderLiving
popAttrib(); popAttrib();
popMatrix(); popMatrix();
} }
@Override
protected void preRenderCallback(M entity, float partialTicks) {
renderCloak(entity, partialTicks);
}
protected void renderCloak(M entity, float partialTicks) {
super.preRenderCallback(entity, partialTicks);
}
} }

View file

@ -1,12 +1,14 @@
package com.minelittlepony.hdskins.gui; package com.minelittlepony.hdskins.gui;
import com.minelittlepony.MineLittlePony; import com.minelittlepony.MineLittlePony;
import com.minelittlepony.ducks.IRenderPony;
import com.minelittlepony.model.ModelWrapper; import com.minelittlepony.model.ModelWrapper;
import com.minelittlepony.model.capabilities.IModel; import com.minelittlepony.model.capabilities.IModel;
import com.minelittlepony.model.components.PonyElytra; import com.minelittlepony.model.components.PonyElytra;
import com.minelittlepony.model.player.PlayerModels; import com.minelittlepony.model.player.PlayerModels;
import com.minelittlepony.pony.data.Pony; import com.minelittlepony.pony.data.Pony;
import com.minelittlepony.pony.data.PonyRace; import com.minelittlepony.pony.data.PonyRace;
import com.minelittlepony.render.RenderPony;
import com.minelittlepony.render.layer.AbstractPonyLayer; import com.minelittlepony.render.layer.AbstractPonyLayer;
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type; import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
import com.voxelmodpack.hdskins.gui.RenderPlayerModel; import com.voxelmodpack.hdskins.gui.RenderPlayerModel;
@ -26,14 +28,40 @@ import net.minecraft.util.ResourceLocation;
/** /**
* 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> { public class RenderPonyModel extends RenderPlayerModel<EntityPonyModel> implements IRenderPony<EntityPonyModel> {
boolean renderingAsHuman = false; boolean renderingAsHuman = false;
protected final RenderPony<EntityPonyModel> renderPony = new RenderPony<>(this);
public RenderPonyModel(RenderManager manager) { public RenderPonyModel(RenderManager manager) {
super(manager); super(manager);
} }
private ModelWrapper playerModel;
@Override
public ModelWrapper getModelWrapper() {
return playerModel;
}
@Override
public Pony getEntityPony(EntityPonyModel entity) {
boolean slim = entity.usesThinSkin();
ResourceLocation loc = getEntityTexture(entity);
return MineLittlePony.getInstance().getManager().getPony(loc, slim);
}
@Override
protected void preRenderCallback(EntityPonyModel entity, float ticks) {
if (renderingAsHuman) {
super.preRenderCallback(entity, ticks);
} else {
renderPony.preRenderCallback(entity, ticks);
}
}
@Override @Override
public ModelPlayer getEntityModel(EntityPonyModel playermodel) { public ModelPlayer getEntityModel(EntityPonyModel playermodel) {
renderingAsHuman = true; renderingAsHuman = true;
@ -55,12 +83,14 @@ public class RenderPonyModel extends RenderPlayerModel<EntityPonyModel> {
boolean canWet = playermodel.wet && (loc == playermodel.getBlankSkin(Type.SKIN) || race == PonyRace.SEAPONY); boolean canWet = playermodel.wet && (loc == playermodel.getBlankSkin(Type.SKIN) || race == PonyRace.SEAPONY);
ModelWrapper pm = canWet ? PlayerModels.SEAPONY.getModel(slim) : thePony.getModel(true); playerModel = canWet ? PlayerModels.SEAPONY.getModel(slim) : thePony.getModel(true);
pm.apply(thePony.getMetadata()); playerModel.apply(thePony.getMetadata());
renderPony.setPonyModel(playerModel);
renderingAsHuman = false; renderingAsHuman = false;
return pm.getBody(); return playerModel.getBody();
} }
@Override @Override