From 29f2f5ee587718d22e640999e75d608fca8ecf9a Mon Sep 17 00:00:00 2001 From: Matthew Messinger Date: Fri, 16 Jun 2017 01:41:36 -0400 Subject: [PATCH] Fix class cast exceptions * elytras in skins menu * zombie villagers --- .../model/pony/ModelVillagerPony.java | 22 ++++++++++--------- .../renderer/layer/AbstractPonyLayer.java | 7 +++--- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/minelittlepony/model/pony/ModelVillagerPony.java b/src/main/java/com/minelittlepony/model/pony/ModelVillagerPony.java index b56048b5..079cb49b 100644 --- a/src/main/java/com/minelittlepony/model/pony/ModelVillagerPony.java +++ b/src/main/java/com/minelittlepony/model/pony/ModelVillagerPony.java @@ -2,6 +2,7 @@ package com.minelittlepony.model.pony; import com.minelittlepony.renderer.PlaneRenderer; import net.minecraft.entity.Entity; +import net.minecraft.entity.passive.EntityVillager; import net.minecraft.util.math.MathHelper; public class ModelVillagerPony extends ModelPlayerPony { @@ -10,8 +11,6 @@ public class ModelVillagerPony extends ModelPlayerPony { public PlaneRenderer VillagerApron; public PlaneRenderer VillagerTrinket; - public int profession; - public ModelVillagerPony() { super(false); } @@ -40,15 +39,18 @@ public class ModelVillagerPony extends ModelPlayerPony { protected void renderBody(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { super.renderBody(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); - this.bipedBody.postRender(this.scale); - if (profession < 2) { - for (PlaneRenderer aVillagerBagPiece : this.VillagerBagPiece) { - aVillagerBagPiece.render(this.scale); + if (entityIn instanceof EntityVillager) { + this.bipedBody.postRender(this.scale); + int profession = ((EntityVillager) entityIn).getProfession(); + if (profession < 2) { + for (PlaneRenderer aVillagerBagPiece : this.VillagerBagPiece) { + aVillagerBagPiece.render(this.scale); + } + } else if (profession == 2) { + this.VillagerTrinket.render(this.scale); + } else if (profession > 2) { + this.VillagerApron.render(this.scale); } - } else if (profession == 2) { - this.VillagerTrinket.render(this.scale); - } else if (profession > 2) { - this.VillagerApron.render(this.scale); } } diff --git a/src/main/java/com/minelittlepony/renderer/layer/AbstractPonyLayer.java b/src/main/java/com/minelittlepony/renderer/layer/AbstractPonyLayer.java index ab2edd57..733a4bba 100644 --- a/src/main/java/com/minelittlepony/renderer/layer/AbstractPonyLayer.java +++ b/src/main/java/com/minelittlepony/renderer/layer/AbstractPonyLayer.java @@ -1,8 +1,7 @@ package com.minelittlepony.renderer.layer; -import com.minelittlepony.ducks.IRenderPony; -import com.minelittlepony.model.PlayerModel; import com.minelittlepony.model.pony.ModelHumanPlayer; +import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.entity.RenderLivingBase; import net.minecraft.client.renderer.entity.layers.LayerRenderer; import net.minecraft.entity.EntityLivingBase; @@ -19,8 +18,8 @@ public abstract class AbstractPonyLayer implements L public final void doRenderLayer(T entity, float limbSwing, float limbSwingAmount, float ticks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { - PlayerModel model = ((IRenderPony) renderer).getPony(); - if (model.getModel() instanceof ModelHumanPlayer) { + ModelBase model = renderer.getMainModel(); + if (model instanceof ModelHumanPlayer) { // render the human layer layer.doRenderLayer(entity, limbSwing, limbSwingAmount, ticks, ageInTicks, netHeadYaw, headPitch, scale); } else {