From 50c7b373fc53432e8ba5b7cdbf24ed74ef1d0688 Mon Sep 17 00:00:00 2001 From: Sollace Date: Sat, 18 Aug 2018 16:16:11 +0200 Subject: [PATCH] Fixed witch hats being in the wrong position when riding --- .../model/ponies/ModelWitchPony.java | 23 +++++++++++++++---- .../render/ponies/RenderPonyWitch.java | 12 +++------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/minelittlepony/model/ponies/ModelWitchPony.java b/src/main/java/com/minelittlepony/model/ponies/ModelWitchPony.java index fefa64b6..5b5267ef 100644 --- a/src/main/java/com/minelittlepony/model/ponies/ModelWitchPony.java +++ b/src/main/java/com/minelittlepony/model/ponies/ModelWitchPony.java @@ -1,6 +1,7 @@ package com.minelittlepony.model.ponies; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -8,7 +9,10 @@ import net.minecraft.entity.monster.EntityWitch; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.MathHelper; +import org.lwjgl.opengl.GL11; + import com.minelittlepony.model.player.ModelZebra; +import com.minelittlepony.pony.data.Pony; import com.minelittlepony.render.PonyRenderer; public class ModelWitchPony extends ModelZebra { @@ -21,7 +25,9 @@ public class ModelWitchPony extends ModelZebra { super(false); } - public void setLivingAnimations(EntityLivingBase entity, float move, float swing, float ticks) { + @Override + public void updateLivingState(EntityLivingBase entity, Pony pony) { + super.updateLivingState(entity, pony); EntityWitch witch = ((EntityWitch) entity); leftArmPose = ArmPose.EMPTY; @@ -68,14 +74,21 @@ public class ModelWitchPony extends ModelZebra { } @Override - public void render(Entity entityIn, float move, float swing, float ticks, float headYaw, float headPitch, float scale) { - super.render(entityIn, move, swing, ticks, headYaw, headPitch, scale); + public boolean isChild() { + return isChild; + } - copyModelAngles(bipedHead, witchHat); + @Override + protected void renderHead(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) { + super.renderHead(entity, move, swing, ticks, headYaw, headPitch, scale); + + GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); TextureManager tex = Minecraft.getMinecraft().getRenderManager().renderEngine; tex.bindTexture(WITCH_TEXTURES); - witchHat.render(scale * 1.3f); + witchHat.render(scale * 1.3F); + + GlStateManager.popAttrib(); } @Override diff --git a/src/main/java/com/minelittlepony/render/ponies/RenderPonyWitch.java b/src/main/java/com/minelittlepony/render/ponies/RenderPonyWitch.java index c2b671bd..72609753 100644 --- a/src/main/java/com/minelittlepony/render/ponies/RenderPonyWitch.java +++ b/src/main/java/com/minelittlepony/render/ponies/RenderPonyWitch.java @@ -3,7 +3,6 @@ package com.minelittlepony.render.ponies; import com.minelittlepony.model.PMAPI; import com.minelittlepony.render.RenderPonyMob; import com.minelittlepony.render.layer.LayerHeldPonyItem; -import com.minelittlepony.render.layer.LayerHeldPonyItemMagical; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; @@ -23,16 +22,11 @@ public class RenderPonyWitch extends RenderPonyMob { @Override protected LayerHeldPonyItem createItemHoldingLayer() { - return new LayerHeldPonyItemMagical(this) { + return new LayerHeldPonyItem(this) { @Override protected void preItemRender(EntityWitch entity, ItemStack drop, TransformType transform, EnumHandSide hand) { - if (isUnicorn()) { - GlStateManager.translate(-0.1F, 0.7F, 0); - GlStateManager.rotate(110, 1, 0, 0); - } else { - GlStateManager.translate(0, -0.3F, -0.8F); - GlStateManager.rotate(10, 1, 0, 0); - } + GlStateManager.translate(0, -0.3F, -0.8F); + GlStateManager.rotate(10, 1, 0, 0); } }; }