From e2b6075fb6f8e43dc18b870c4795f8e3b564b946 Mon Sep 17 00:00:00 2001 From: Sollace Date: Sat, 28 Jul 2018 13:04:40 +0200 Subject: [PATCH] Remove the c/p to prevent future errors --- .../hdskins/gui/RenderPonyModel.java | 46 ++++++------------- .../render/layer/LayerPonyElytra.java | 19 ++++++-- 2 files changed, 29 insertions(+), 36 deletions(-) diff --git a/src/main/java/com/minelittlepony/hdskins/gui/RenderPonyModel.java b/src/main/java/com/minelittlepony/hdskins/gui/RenderPonyModel.java index 5083f693..94417479 100644 --- a/src/main/java/com/minelittlepony/hdskins/gui/RenderPonyModel.java +++ b/src/main/java/com/minelittlepony/hdskins/gui/RenderPonyModel.java @@ -2,15 +2,12 @@ package com.minelittlepony.hdskins.gui; import com.minelittlepony.MineLittlePony; import com.minelittlepony.ducks.IRenderPony; -import com.minelittlepony.model.BodyPart; import com.minelittlepony.model.ModelWrapper; -import com.minelittlepony.model.capabilities.IModel; -import com.minelittlepony.model.components.PonyElytra; import com.minelittlepony.model.player.PlayerModels; import com.minelittlepony.pony.data.Pony; import com.minelittlepony.pony.data.PonyRace; import com.minelittlepony.render.RenderPony; -import com.minelittlepony.render.layer.AbstractPonyLayer; +import com.minelittlepony.render.layer.LayerPonyElytra; import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type; import com.voxelmodpack.hdskins.gui.RenderPlayerModel; @@ -21,9 +18,6 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.entity.layers.LayerRenderer; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.init.Items; -import net.minecraft.inventory.EntityEquipmentSlot; -import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; /** @@ -98,35 +92,25 @@ public class RenderPonyModel extends RenderPlayerModel implemen @Override protected LayerRenderer getElytraLayer() { - return new AbstractPonyLayer(this) { - final PonyElytra ponyElytra = new PonyElytra(); - final ModelElytra modelElytra = new ModelElytra(); + return new LayerPonyElytra(this) { + private final ModelElytra modelElytra = new ModelElytra(); @Override - public void doPonyRender(EntityPonyModel entity, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale) { - ItemStack itemstack = entity.getItemStackFromSlot(EntityEquipmentSlot.CHEST); - - if (itemstack.getItem() == Items.ELYTRA) { - GlStateManager.color(1, 1, 1, 1); - - bindTexture(entity.getLocal(Type.ELYTRA).getTexture()); - - GlStateManager.pushMatrix(); - - ModelBase model = renderingAsHuman ? modelElytra : ponyElytra; - - if (!renderingAsHuman) { - ((IModel)getMainModel()).transform(BodyPart.BODY); - GlStateManager.translate(0, ((IModel)getMainModel()).getRiderYOffset(), 0.125F); - } - - model.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity); - model.render(entity, move, swing, ticks, headYaw, headPitch, scale); - - GlStateManager.popMatrix(); + protected void preRenderCallback() { + if (!renderingAsHuman) { + super.preRenderCallback(); } } + @Override + protected ModelBase getElytraModel() { + return renderingAsHuman ? modelElytra : super.getElytraModel(); + } + + @Override + protected ResourceLocation getElytraTexture(EntityPonyModel entity) { + return entity.getLocal(Type.ELYTRA).getTexture(); + } }; } } diff --git a/src/main/java/com/minelittlepony/render/layer/LayerPonyElytra.java b/src/main/java/com/minelittlepony/render/layer/LayerPonyElytra.java index 0057df20..7c433088 100644 --- a/src/main/java/com/minelittlepony/render/layer/LayerPonyElytra.java +++ b/src/main/java/com/minelittlepony/render/layer/LayerPonyElytra.java @@ -4,6 +4,7 @@ import com.minelittlepony.model.BodyPart; import com.minelittlepony.model.components.PonyElytra; import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.entity.RenderLivingBase; import net.minecraft.client.renderer.entity.layers.LayerArmorBase; @@ -35,20 +36,28 @@ public class LayerPonyElytra extends AbstractPonyLay getRenderer().bindTexture(getElytraTexture(entity)); GlStateManager.pushMatrix(); - GlStateManager.translate(0, getPlayerModel().getRiderYOffset(), 0.125F); - getPlayerModel().transform(BodyPart.BODY); + preRenderCallback(); - modelElytra.setRotationAngles(move, swing, ticks, yaw, head, scale, entity); - modelElytra.render(entity, move, swing, ticks, yaw, head, scale); + getElytraModel().setRotationAngles(move, swing, ticks, yaw, head, scale, entity); + getElytraModel().render(entity, move, swing, ticks, yaw, head, scale); if (itemstack.isItemEnchanted()) { - LayerArmorBase.renderEnchantedGlint(getRenderer(), entity, modelElytra, move, swing, partialTicks, ticks, yaw, head, scale); + LayerArmorBase.renderEnchantedGlint(getRenderer(), entity, getElytraModel(), move, swing, partialTicks, ticks, yaw, head, scale); } GlStateManager.popMatrix(); } } + protected void preRenderCallback() { + GlStateManager.translate(0, getPlayerModel().getRiderYOffset(), 0.125F); + getPlayerModel().transform(BodyPart.BODY); + } + + protected ModelBase getElytraModel() { + return modelElytra; + } + protected ResourceLocation getElytraTexture(T entity) { if (entity instanceof AbstractClientPlayer) { AbstractClientPlayer player = (AbstractClientPlayer) entity;