Skip to content

Commit

Permalink
Removed unnecessarily duplicated player rendering code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Phylogeny committed Aug 20, 2017
1 parent 6fde961 commit de03647
Showing 1 changed file with 2 additions and 42 deletions.
44 changes: 2 additions & 42 deletions src/main/java/baubles/client/gui/GuiPlayerExpanded.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.achievement.GuiStats;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.InventoryEffectRenderer;
import net.minecraft.client.renderer.OpenGlHelper;
Expand Down Expand Up @@ -97,48 +98,7 @@ protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2
}
}

drawPlayerModel(k + 51, l + 75, 30, (float)(k + 51) - this.xSizeFloat, (float)(l + 75 - 50) - this.ySizeFloat, this.mc.player);
}

public static void drawPlayerModel(int x, int y, int scale, float yaw, float pitch, EntityLivingBase playerdrawn)
{
GlStateManager.enableColorMaterial();
GlStateManager.pushMatrix();
GlStateManager.translate((float)x, (float)y, 50.0F);
GlStateManager.scale((float)(-scale), (float)scale, (float)scale);
GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F);
float f2 = playerdrawn.renderYawOffset;
float f3 = playerdrawn.rotationYaw;
float f4 = playerdrawn.rotationPitch;
float f5 = playerdrawn.prevRotationYawHead;
float f6 = playerdrawn.rotationYawHead;
GlStateManager.rotate(135.0F, 0.0F, 1.0F, 0.0F);
RenderHelper.enableStandardItemLighting();
GlStateManager.rotate(-135.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(-((float)Math.atan((double)(pitch / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F);
playerdrawn.renderYawOffset = (float)Math.atan((double)(yaw / 40.0F)) * 20.0F;
playerdrawn.rotationYaw = (float)Math.atan((double)(yaw / 40.0F)) * 40.0F;
playerdrawn.rotationPitch = -((float)Math.atan((double)(pitch / 40.0F))) * 20.0F;
playerdrawn.rotationYawHead = playerdrawn.rotationYaw;
playerdrawn.prevRotationYawHead = playerdrawn.rotationYaw;
GlStateManager.translate(0.0F, 0.0F, 0.0F);
RenderManager renderManager = Minecraft.getMinecraft().getRenderManager();
renderManager.setPlayerViewY(180.0F);
renderManager.setRenderShadow(false);
renderManager.doRenderEntity(playerdrawn, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, false);

renderManager.setRenderShadow(true);
playerdrawn.renderYawOffset = f2;
playerdrawn.rotationYaw = f3;
playerdrawn.rotationPitch = f4;
playerdrawn.prevRotationYawHead = f5;
playerdrawn.rotationYawHead = f6;
GlStateManager.popMatrix();
RenderHelper.disableStandardItemLighting();
GlStateManager.disableRescaleNormal();
GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit);
GlStateManager.disableTexture2D();
GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit);
GuiInventory.drawEntityOnScreen(k + 51, l + 75, 30, (float)(k + 51) - this.xSizeFloat, (float)(l + 75 - 50) - this.ySizeFloat, this.mc.player);
}

@Override
Expand Down

0 comments on commit de03647

Please sign in to comment.