Fix class cast exceptions

* elytras in skins menu
* zombie villagers
This commit is contained in:
Matthew Messinger 2017-06-16 01:41:36 -04:00
parent 62e77acc38
commit 29f2f5ee58
2 changed files with 15 additions and 14 deletions

View file

@ -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);
}
}

View file

@ -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<T extends EntityLivingBase> 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 {