Remove the c/p to prevent future errors

This commit is contained in:
Sollace 2018-07-28 13:04:40 +02:00
parent a1fa6a2ce8
commit ccc9790e72
2 changed files with 29 additions and 36 deletions

View file

@ -2,15 +2,12 @@ package com.minelittlepony.hdskins.gui;
import com.minelittlepony.MineLittlePony; import com.minelittlepony.MineLittlePony;
import com.minelittlepony.ducks.IRenderPony; import com.minelittlepony.ducks.IRenderPony;
import com.minelittlepony.model.BodyPart;
import com.minelittlepony.model.ModelWrapper; 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.model.player.PlayerModels;
import com.minelittlepony.pony.data.Pony; import com.minelittlepony.pony.data.Pony;
import com.minelittlepony.pony.data.PonyRace; import com.minelittlepony.pony.data.PonyRace;
import com.minelittlepony.render.RenderPony; 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.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
import com.voxelmodpack.hdskins.gui.RenderPlayerModel; 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.RenderManager;
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.EntityLivingBase;
import net.minecraft.init.Items;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
/** /**
@ -99,35 +93,25 @@ public class RenderPonyModel extends RenderPlayerModel<EntityPonyModel> implemen
@Override @Override
protected LayerRenderer<EntityLivingBase> getElytraLayer() { protected LayerRenderer<EntityLivingBase> getElytraLayer() {
return new AbstractPonyLayer<EntityPonyModel>(this) { return new LayerPonyElytra<EntityPonyModel>(this) {
final PonyElytra ponyElytra = new PonyElytra(); private final ModelElytra modelElytra = new ModelElytra();
final ModelElytra modelElytra = new ModelElytra();
@Override @Override
public void doPonyRender(EntityPonyModel entity, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale) { protected void preRenderCallback() {
ItemStack itemstack = entity.getItemStackFromSlot(EntityEquipmentSlot.CHEST); if (!renderingAsHuman) {
super.preRenderCallback();
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();
} }
} }
@Override
protected ModelBase getElytraModel() {
return renderingAsHuman ? modelElytra : super.getElytraModel();
}
@Override
protected ResourceLocation getElytraTexture(EntityPonyModel entity) {
return entity.getLocal(Type.ELYTRA).getTexture();
}
}; };
} }
} }

View file

@ -4,6 +4,7 @@ import com.minelittlepony.model.BodyPart;
import com.minelittlepony.model.components.PonyElytra; import com.minelittlepony.model.components.PonyElytra;
import net.minecraft.client.entity.AbstractClientPlayer; import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderLivingBase; import net.minecraft.client.renderer.entity.RenderLivingBase;
import net.minecraft.client.renderer.entity.layers.LayerArmorBase; import net.minecraft.client.renderer.entity.layers.LayerArmorBase;
@ -35,20 +36,28 @@ public class LayerPonyElytra<T extends EntityLivingBase> extends AbstractPonyLay
getRenderer().bindTexture(getElytraTexture(entity)); getRenderer().bindTexture(getElytraTexture(entity));
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
GlStateManager.translate(0, getPlayerModel().getRiderYOffset(), 0.125F); preRenderCallback();
getPlayerModel().transform(BodyPart.BODY);
modelElytra.setRotationAngles(move, swing, ticks, yaw, head, scale, entity); getElytraModel().setRotationAngles(move, swing, ticks, yaw, head, scale, entity);
modelElytra.render(entity, move, swing, ticks, yaw, head, scale); getElytraModel().render(entity, move, swing, ticks, yaw, head, scale);
if (itemstack.isItemEnchanted()) { 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(); 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) { protected ResourceLocation getElytraTexture(T entity) {
if (entity instanceof AbstractClientPlayer) { if (entity instanceof AbstractClientPlayer) {
AbstractClientPlayer player = (AbstractClientPlayer) entity; AbstractClientPlayer player = (AbstractClientPlayer) entity;