Advertisement
GamingLVScripts

doRender

Apr 1st, 2024
363
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 7.95 KB | None | 0 0
  1. /**
  2.      * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
  3.      * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
  4.      * (Render<T extends Entity>) and this method has signature public void doRender(T entity, double d, double d1,
  5.      * double d2, float f, float f1). But JAD is pre 1.5 so doe
  6.      *  
  7.      * @param entityYaw The yaw rotation of the passed entity
  8.      */
  9.     public void doRender(T entity, double x, double y, double z, float entityYaw, float partialTicks)
  10.     {
  11.         if (!Reflector.RenderLivingEvent_Pre_Constructor.exists() || !Reflector.postForgeBusEvent(Reflector.RenderLivingEvent_Pre_Constructor, new Object[] {entity, this, Double.valueOf(x), Double.valueOf(y), Double.valueOf(z)}))
  12.         {
  13.             if (animateModelLiving)
  14.             {
  15.                 entity.limbSwingAmount = 1.0F;
  16.             }
  17.  
  18.             GlStateManager.pushMatrix();
  19.             GlStateManager.disableCull();
  20.             this.mainModel.swingProgress = this.getSwingProgress(entity, partialTicks);
  21.             this.mainModel.isRiding = entity.isRiding();
  22.  
  23.             if (Reflector.ForgeEntity_shouldRiderSit.exists())
  24.             {
  25.                 this.mainModel.isRiding = entity.isRiding() && entity.ridingEntity != null && Reflector.callBoolean(entity.ridingEntity, Reflector.ForgeEntity_shouldRiderSit, new Object[0]);
  26.             }
  27.  
  28.             this.mainModel.isChild = entity.isChild();
  29.  
  30.             try
  31.             {
  32.                 float yaw = entity.rotationYawHead;
  33.                 if(entity == Minecraft.getMinecraft().thePlayer) {
  34.                     yaw = PlayerHandler.yaw;
  35.                 }
  36.                 float f = this.interpolateRotation(entity.prevRenderYawOffset, entity.renderYawOffset, partialTicks);
  37.                 float f1 = this.interpolateRotation(entity.prevRotationYawHead, yaw, partialTicks);
  38.                 float f2 = f1 - f;
  39.  
  40.                 if (this.mainModel.isRiding && entity.ridingEntity instanceof EntityLivingBase)
  41.                 {
  42.                     EntityLivingBase entitylivingbase = (EntityLivingBase)entity.ridingEntity;
  43.                     f = this.interpolateRotation(entitylivingbase.prevRenderYawOffset, entitylivingbase.renderYawOffset, partialTicks);
  44.                     f2 = f1 - f;
  45.                     float f3 = MathHelper.wrapAngleTo180_float(f2);
  46.  
  47.                     if (f3 < -85.0F)
  48.                     {
  49.                         f3 = -85.0F;
  50.                     }
  51.  
  52.                     if (f3 >= 85.0F)
  53.                     {
  54.                         f3 = 85.0F;
  55.                     }
  56.  
  57.                     f = f1 - f3;
  58.  
  59.                     if (f3 * f3 > 2500.0F)
  60.                     {
  61.                         f += f3 * 0.2F;
  62.                     }
  63.  
  64.                     f2 = f1 - f;
  65.                 }
  66.  
  67.                 float f7 = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks;
  68.                 this.renderLivingAt(entity, x, y, z);
  69.                 float f8 = this.handleRotationFloat(entity, partialTicks);
  70.                 if (entity == Minecraft.getMinecraft().thePlayer)
  71.                     f7 = PlayerHandler.prevPitch + (PlayerHandler.pitch - PlayerHandler.prevPitch) * partialTicks;
  72.                 this.rotateCorpse(entity, f8, f, partialTicks);
  73.                 GlStateManager.enableRescaleNormal();
  74.                 GlStateManager.scale(-1.0F, -1.0F, 1.0F);
  75.                 this.preRenderCallback(entity, partialTicks);
  76.                 float f4 = 0.0625F;
  77.                 GlStateManager.translate(0.0F, -1.5078125F, 0.0F);
  78.                 float f5 = entity.prevLimbSwingAmount + (entity.limbSwingAmount - entity.prevLimbSwingAmount) * partialTicks;
  79.                 float f6 = entity.limbSwing - entity.limbSwingAmount * (1.0F - partialTicks);
  80.  
  81.                 if (entity.isChild())
  82.                 {
  83.                     f6 *= 3.0F;
  84.                 }
  85.  
  86.                 if (f5 > 1.0F)
  87.                 {
  88.                     f5 = 1.0F;
  89.                 }
  90.  
  91.                 GlStateManager.enableAlpha();
  92.                 this.mainModel.setLivingAnimations(entity, f6, f5, partialTicks);
  93.                 this.mainModel.setRotationAngles(f6, f5, f8, f2, f7, 0.0625F, entity);
  94.  
  95.                 if (CustomEntityModels.isActive())
  96.                 {
  97.                     this.renderEntity = entity;
  98.                     this.renderLimbSwing = f6;
  99.                     this.renderLimbSwingAmount = f5;
  100.                     this.renderAgeInTicks = f8;
  101.                     this.renderHeadYaw = f2;
  102.                     this.renderHeadPitch = f7;
  103.                     this.renderScaleFactor = f4;
  104.                     this.renderPartialTicks = partialTicks;
  105.                 }
  106.  
  107.                 if (this.renderOutlines)
  108.                 {
  109.                     boolean flag1 = this.setScoreTeamColor(entity);
  110.                     this.renderModel(entity, f6, f5, f8, f2, f7, 0.0625F);
  111.  
  112.                     if (flag1)
  113.                     {
  114.                         this.unsetScoreTeamColor();
  115.                     }
  116.                 }
  117.                 else
  118.                 {
  119.                     boolean flag = this.setDoRenderBrightness(entity, partialTicks);
  120.  
  121.                     if (EmissiveTextures.isActive())
  122.                     {
  123.                         EmissiveTextures.beginRender();
  124.                     }
  125.  
  126.                     if (this.renderModelPushMatrix)
  127.                     {
  128.                         GlStateManager.pushMatrix();
  129.                     }
  130.  
  131.                     this.renderModel(entity, f6, f5, f8, f2, f7, 0.0625F);
  132.  
  133.                     if (this.renderModelPushMatrix)
  134.                     {
  135.                         GlStateManager.popMatrix();
  136.                     }
  137.  
  138.                     if (EmissiveTextures.isActive())
  139.                     {
  140.                         if (EmissiveTextures.hasEmissive())
  141.                         {
  142.                             this.renderModelPushMatrix = true;
  143.                             EmissiveTextures.beginRenderEmissive();
  144.                             GlStateManager.pushMatrix();
  145.                             this.renderModel(entity, f6, f5, f8, f2, f7, f4);
  146.                             GlStateManager.popMatrix();
  147.                             EmissiveTextures.endRenderEmissive();
  148.                         }
  149.  
  150.                         EmissiveTextures.endRender();
  151.                     }
  152.  
  153.                     if (flag)
  154.                     {
  155.                         this.unsetBrightness();
  156.                     }
  157.  
  158.                     GlStateManager.depthMask(true);
  159.  
  160.                     if (!(entity instanceof EntityPlayer) || !((EntityPlayer)entity).isSpectator())
  161.                     {
  162.                         this.renderLayers(entity, f6, f5, partialTicks, f8, f2, f7, 0.0625F);
  163.                     }
  164.                 }
  165.  
  166.                 if (CustomEntityModels.isActive())
  167.                 {
  168.                     this.renderEntity = null;
  169.                 }
  170.  
  171.                 GlStateManager.disableRescaleNormal();
  172.             }
  173.             catch (Exception exception)
  174.             {
  175.                 logger.error((String)"Couldn\'t render entity", (Throwable)exception);
  176.             }
  177.  
  178.             GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit);
  179.             GlStateManager.enableTexture2D();
  180.             GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit);
  181.             GlStateManager.enableCull();
  182.             GlStateManager.popMatrix();
  183.  
  184.             if (!this.renderOutlines)
  185.             {
  186.                 super.doRender(entity, x, y, z, entityYaw, partialTicks);
  187.             }
  188.  
  189.             if (Reflector.RenderLivingEvent_Post_Constructor.exists())
  190.             {
  191.                 Reflector.postForgeBusEvent(Reflector.RenderLivingEvent_Post_Constructor, new Object[] {entity, this, Double.valueOf(x), Double.valueOf(y), Double.valueOf(z)});
  192.             }
  193.         }
  194.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement