Advertisement
Guest User

2

a guest
Feb 17th, 2020
335
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.15 KB | None | 0 0
  1. package net.minecraft.client.renderer.entity.layers;
  2.  
  3. import net.minecraft.client.entity.AbstractClientPlayer;
  4. import net.minecraft.client.renderer.GlStateManager;
  5. import net.minecraft.client.renderer.entity.RenderPlayer;
  6. import net.minecraft.entity.EntityLivingBase;
  7. import net.minecraft.entity.player.EnumPlayerModelParts;
  8. import net.minecraft.util.MathHelper;
  9.  
  10. public class LayerCape implements LayerRenderer<AbstractClientPlayer>
  11. {
  12. private final RenderPlayer playerRenderer;
  13. private static final String __OBFID = "CL_00002425";
  14.  
  15. public LayerCape(RenderPlayer playerRendererIn)
  16. {
  17. this.playerRenderer = playerRendererIn;
  18. }
  19.  
  20. public void doRenderLayer(AbstractClientPlayer entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale)
  21. {
  22. if (entitylivingbaseIn.hasPlayerInfo() && !entitylivingbaseIn.isInvisible() && entitylivingbaseIn.isWearing(EnumPlayerModelParts.CAPE) && entitylivingbaseIn.getLocationCape() != null)
  23. {
  24. GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
  25. this.playerRenderer.bindTexture(entitylivingbaseIn.getLocationCape());
  26. GlStateManager.pushMatrix();
  27. GlStateManager.translate(0.0F, 0.0F, 0.125F);
  28. double d0 = entitylivingbaseIn.prevChasingPosX + (entitylivingbaseIn.chasingPosX - entitylivingbaseIn.prevChasingPosX) * (double)partialTicks - (entitylivingbaseIn.prevPosX + (entitylivingbaseIn.posX - entitylivingbaseIn.prevPosX) * (double)partialTicks);
  29. double d1 = entitylivingbaseIn.prevChasingPosY + (entitylivingbaseIn.chasingPosY - entitylivingbaseIn.prevChasingPosY) * (double)partialTicks - (entitylivingbaseIn.prevPosY + (entitylivingbaseIn.posY - entitylivingbaseIn.prevPosY) * (double)partialTicks);
  30. double d2 = entitylivingbaseIn.prevChasingPosZ + (entitylivingbaseIn.chasingPosZ - entitylivingbaseIn.prevChasingPosZ) * (double)partialTicks - (entitylivingbaseIn.prevPosZ + (entitylivingbaseIn.posZ - entitylivingbaseIn.prevPosZ) * (double)partialTicks);
  31. float f = entitylivingbaseIn.prevRenderYawOffset + (entitylivingbaseIn.renderYawOffset - entitylivingbaseIn.prevRenderYawOffset) * partialTicks;
  32. double d3 = (double)MathHelper.sin(f * (float)Math.PI / 180.0F);
  33. double d4 = (double)(-MathHelper.cos(f * (float)Math.PI / 180.0F));
  34. float f1 = (float)d1 * 10.0F;
  35. f1 = MathHelper.clamp_float(f1, -6.0F, 32.0F);
  36. float f2 = (float)(d0 * d3 + d2 * d4) * 100.0F;
  37. float f3 = (float)(d0 * d4 - d2 * d3) * 100.0F;
  38.  
  39. if (f2 < 0.0F)
  40. {
  41. f2 = 0.0F;
  42. }
  43.  
  44. if (f2 > 165.0F)
  45. {
  46. f2 = 165.0F;
  47. }
  48.  
  49. float f4 = entitylivingbaseIn.prevCameraYaw + (entitylivingbaseIn.cameraYaw - entitylivingbaseIn.prevCameraYaw) * partialTicks;
  50. f1 = f1 + MathHelper.sin((entitylivingbaseIn.prevDistanceWalkedModified + (entitylivingbaseIn.distanceWalkedModified - entitylivingbaseIn.prevDistanceWalkedModified) * partialTicks) * 6.0F) * 32.0F * f4;
  51.  
  52. if (entitylivingbaseIn.isSneaking())
  53. {
  54. f1 += 25.0F;
  55. GlStateManager.translate(0.0F, 0.142F, -0.0178F);
  56. }
  57.  
  58. GlStateManager.rotate(6.0F + f2 / 2.0F + f1, 1.0F, 0.0F, 0.0F);
  59. GlStateManager.rotate(f3 / 2.0F, 0.0F, 0.0F, 1.0F);
  60. GlStateManager.rotate(-f3 / 2.0F, 0.0F, 1.0F, 0.0F);
  61. GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
  62. this.playerRenderer.getMainModel().renderCape(0.0625F);
  63. GlStateManager.popMatrix();
  64. }
  65. }
  66.  
  67. public boolean shouldCombineTextures()
  68. {
  69. return false;
  70. }
  71.  
  72. public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale)
  73. {
  74. this.doRenderLayer((AbstractClientPlayer)entitylivingbaseIn, p_177141_2_, p_177141_3_, partialTicks, p_177141_5_, p_177141_6_, p_177141_7_, scale);
  75. }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement