mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-25 13:57:59 +01:00
Mobs can now wear elytras.
This commit is contained in:
parent
6c0542ff89
commit
d5e766aaef
2 changed files with 18 additions and 9 deletions
|
@ -8,6 +8,7 @@ import com.minelittlepony.ducks.IRenderPony;
|
||||||
import com.minelittlepony.model.PlayerModel;
|
import com.minelittlepony.model.PlayerModel;
|
||||||
import com.minelittlepony.renderer.layer.LayerHeldPonyItem;
|
import com.minelittlepony.renderer.layer.LayerHeldPonyItem;
|
||||||
import com.minelittlepony.renderer.layer.LayerPonyArmor;
|
import com.minelittlepony.renderer.layer.LayerPonyArmor;
|
||||||
|
import com.minelittlepony.renderer.layer.LayerPonyElytra;
|
||||||
import com.minelittlepony.renderer.layer.LayerPonySkull;
|
import com.minelittlepony.renderer.layer.LayerPonySkull;
|
||||||
import com.voxelmodpack.hdskins.HDSkinManager;
|
import com.voxelmodpack.hdskins.HDSkinManager;
|
||||||
import net.minecraft.client.renderer.entity.RenderLiving;
|
import net.minecraft.client.renderer.entity.RenderLiving;
|
||||||
|
@ -27,6 +28,7 @@ public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving
|
||||||
this.addLayer(new LayerHeldPonyItem(this));
|
this.addLayer(new LayerHeldPonyItem(this));
|
||||||
// this.addLayer(new LayerArrow(this));
|
// this.addLayer(new LayerArrow(this));
|
||||||
this.addLayer(new LayerPonySkull(this));
|
this.addLayer(new LayerPonySkull(this));
|
||||||
|
this.addLayer(new LayerPonyElytra(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -7,10 +7,11 @@ import com.minelittlepony.model.ModelPonyElytra;
|
||||||
import com.minelittlepony.model.pony.ModelHumanPlayer;
|
import com.minelittlepony.model.pony.ModelHumanPlayer;
|
||||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
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.LayerArmorBase;
|
||||||
import net.minecraft.client.renderer.entity.layers.LayerElytra;
|
import net.minecraft.client.renderer.entity.layers.LayerElytra;
|
||||||
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
|
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EnumPlayerModelParts;
|
import net.minecraft.entity.player.EnumPlayerModelParts;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||||
|
@ -19,21 +20,21 @@ import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public class LayerPonyElytra implements LayerRenderer<AbstractClientPlayer> {
|
public class LayerPonyElytra implements LayerRenderer<EntityLivingBase> {
|
||||||
|
|
||||||
private static final ResourceLocation TEXTURE_ELYTRA = new ResourceLocation("textures/entity/elytra.png");
|
private static final ResourceLocation TEXTURE_ELYTRA = new ResourceLocation("textures/entity/elytra.png");
|
||||||
private RenderPlayer renderPlayer;
|
private RenderLivingBase<?> renderPlayer;
|
||||||
private ModelPonyElytra modelElytra = new ModelPonyElytra();
|
private ModelPonyElytra modelElytra = new ModelPonyElytra();
|
||||||
|
|
||||||
private LayerElytra elytra;
|
private LayerElytra elytra;
|
||||||
|
|
||||||
public LayerPonyElytra(RenderPlayer rp) {
|
public LayerPonyElytra(RenderLivingBase<?> rp) {
|
||||||
this.renderPlayer = rp;
|
this.renderPlayer = rp;
|
||||||
this.elytra = new LayerElytra(rp);
|
this.elytra = new LayerElytra(rp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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();
|
AbstractPonyModel model = ((IRenderPony) this.renderPlayer).getPony().getModel();
|
||||||
if (model instanceof ModelHumanPlayer) {
|
if (model instanceof ModelHumanPlayer) {
|
||||||
|
@ -46,10 +47,16 @@ public class LayerPonyElytra implements LayerRenderer<AbstractClientPlayer> {
|
||||||
if (itemstack.getItem() == Items.ELYTRA) {
|
if (itemstack.getItem() == Items.ELYTRA) {
|
||||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
|
||||||
if (entity.isPlayerInfoSet() && entity.getLocationElytra() != null) {
|
if (entity instanceof AbstractClientPlayer) {
|
||||||
this.renderPlayer.bindTexture(entity.getLocationElytra());
|
|
||||||
} else if (entity.hasPlayerInfo() && entity.getLocationCape() != null && entity.isWearing(EnumPlayerModelParts.CAPE)) {
|
AbstractClientPlayer player = (AbstractClientPlayer) entity;
|
||||||
this.renderPlayer.bindTexture(entity.getLocationCape());
|
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 {
|
} else {
|
||||||
this.renderPlayer.bindTexture(TEXTURE_ELYTRA);
|
this.renderPlayer.bindTexture(TEXTURE_ELYTRA);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue