diff --git a/src/main/java/com/minelittlepony/renderer/RenderPonyMob.java b/src/main/java/com/minelittlepony/renderer/RenderPonyMob.java index b98e1da0..4f600681 100644 --- a/src/main/java/com/minelittlepony/renderer/RenderPonyMob.java +++ b/src/main/java/com/minelittlepony/renderer/RenderPonyMob.java @@ -8,6 +8,7 @@ import com.minelittlepony.ducks.IRenderPony; import com.minelittlepony.model.PlayerModel; import com.minelittlepony.renderer.layer.LayerHeldPonyItem; import com.minelittlepony.renderer.layer.LayerPonyArmor; +import com.minelittlepony.renderer.layer.LayerPonyElytra; import com.minelittlepony.renderer.layer.LayerPonySkull; import com.voxelmodpack.hdskins.HDSkinManager; import net.minecraft.client.renderer.entity.RenderLiving; @@ -27,6 +28,7 @@ public abstract class RenderPonyMob extends RenderLiving this.addLayer(new LayerHeldPonyItem(this)); // this.addLayer(new LayerArrow(this)); this.addLayer(new LayerPonySkull(this)); + this.addLayer(new LayerPonyElytra(this)); } @Override diff --git a/src/main/java/com/minelittlepony/renderer/layer/LayerPonyElytra.java b/src/main/java/com/minelittlepony/renderer/layer/LayerPonyElytra.java index 58c84a98..51685c21 100644 --- a/src/main/java/com/minelittlepony/renderer/layer/LayerPonyElytra.java +++ b/src/main/java/com/minelittlepony/renderer/layer/LayerPonyElytra.java @@ -7,10 +7,11 @@ import com.minelittlepony.model.ModelPonyElytra; import com.minelittlepony.model.pony.ModelHumanPlayer; import net.minecraft.client.entity.AbstractClientPlayer; import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.entity.RenderPlayer; +import net.minecraft.client.renderer.entity.RenderLivingBase; import net.minecraft.client.renderer.entity.layers.LayerArmorBase; import net.minecraft.client.renderer.entity.layers.LayerElytra; import net.minecraft.client.renderer.entity.layers.LayerRenderer; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EnumPlayerModelParts; import net.minecraft.init.Items; import net.minecraft.inventory.EntityEquipmentSlot; @@ -19,21 +20,21 @@ import net.minecraft.util.ResourceLocation; import javax.annotation.Nonnull; -public class LayerPonyElytra implements LayerRenderer { +public class LayerPonyElytra implements LayerRenderer { private static final ResourceLocation TEXTURE_ELYTRA = new ResourceLocation("textures/entity/elytra.png"); - private RenderPlayer renderPlayer; + private RenderLivingBase renderPlayer; private ModelPonyElytra modelElytra = new ModelPonyElytra(); private LayerElytra elytra; - public LayerPonyElytra(RenderPlayer rp) { + public LayerPonyElytra(RenderLivingBase rp) { this.renderPlayer = rp; this.elytra = new LayerElytra(rp); } @Override - public void doRenderLayer(@Nonnull AbstractClientPlayer entity, float swing, float swingAmount, float ticks, float age, float yaw, float head, float scale) { + public void doRenderLayer(@Nonnull EntityLivingBase entity, float swing, float swingAmount, float ticks, float age, float yaw, float head, float scale) { AbstractPonyModel model = ((IRenderPony) this.renderPlayer).getPony().getModel(); if (model instanceof ModelHumanPlayer) { @@ -46,10 +47,16 @@ public class LayerPonyElytra implements LayerRenderer { if (itemstack.getItem() == Items.ELYTRA) { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - if (entity.isPlayerInfoSet() && entity.getLocationElytra() != null) { - this.renderPlayer.bindTexture(entity.getLocationElytra()); - } else if (entity.hasPlayerInfo() && entity.getLocationCape() != null && entity.isWearing(EnumPlayerModelParts.CAPE)) { - this.renderPlayer.bindTexture(entity.getLocationCape()); + if (entity instanceof AbstractClientPlayer) { + + AbstractClientPlayer player = (AbstractClientPlayer) entity; + if (player.isPlayerInfoSet() && player.getLocationElytra() != null) { + this.renderPlayer.bindTexture(player.getLocationElytra()); + } else if (player.hasPlayerInfo() && player.getLocationCape() != null && player.isWearing(EnumPlayerModelParts.CAPE)) { + this.renderPlayer.bindTexture(player.getLocationCape()); + } else { + this.renderPlayer.bindTexture(TEXTURE_ELYTRA); + } } else { this.renderPlayer.bindTexture(TEXTURE_ELYTRA); }