/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render) and this method has signature public void doRender(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doe
*
* @param entityYaw The yaw rotation of the passed entity
*/
public void doRender(T entity, double x, double y, double z, float entityYaw, float partialTicks)
{
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)}))
{
if (animateModelLiving)
{
entity.limbSwingAmount = 1.0F;
}
GlStateManager.pushMatrix();
GlStateManager.disableCull();
this.mainModel.swingProgress = this.getSwingProgress(entity, partialTicks);
this.mainModel.isRiding = entity.isRiding();
if (Reflector.ForgeEntity_shouldRiderSit.exists())
{
this.mainModel.isRiding = entity.isRiding() && entity.ridingEntity != null && Reflector.callBoolean(entity.ridingEntity, Reflector.ForgeEntity_shouldRiderSit, new Object[0]);
}
this.mainModel.isChild = entity.isChild();
try
{
float yaw = entity.rotationYawHead;
if(entity == Minecraft.getMinecraft().thePlayer) {
yaw = PlayerHandler.yaw;
}
float f = this.interpolateRotation(entity.prevRenderYawOffset, entity.renderYawOffset, partialTicks);
float f1 = this.interpolateRotation(entity.prevRotationYawHead, yaw, partialTicks);
float f2 = f1 - f;
if (this.mainModel.isRiding && entity.ridingEntity instanceof EntityLivingBase)
{
EntityLivingBase entitylivingbase = (EntityLivingBase)entity.ridingEntity;
f = this.interpolateRotation(entitylivingbase.prevRenderYawOffset, entitylivingbase.renderYawOffset, partialTicks);
f2 = f1 - f;
float f3 = MathHelper.wrapAngleTo180_float(f2);
if (f3 < -85.0F)
{
f3 = -85.0F;
}
if (f3 >= 85.0F)
{
f3 = 85.0F;
}
f = f1 - f3;
if (f3 * f3 > 2500.0F)
{
f += f3 * 0.2F;
}
f2 = f1 - f;
}
float f7 = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks;
this.renderLivingAt(entity, x, y, z);
float f8 = this.handleRotationFloat(entity, partialTicks);
if (entity == Minecraft.getMinecraft().thePlayer)
f7 = PlayerHandler.prevPitch + (PlayerHandler.pitch - PlayerHandler.prevPitch) * partialTicks;
this.rotateCorpse(entity, f8, f, partialTicks);
GlStateManager.enableRescaleNormal();
GlStateManager.scale(-1.0F, -1.0F, 1.0F);
this.preRenderCallback(entity, partialTicks);
float f4 = 0.0625F;
GlStateManager.translate(0.0F, -1.5078125F, 0.0F);
float f5 = entity.prevLimbSwingAmount + (entity.limbSwingAmount - entity.prevLimbSwingAmount) * partialTicks;
float f6 = entity.limbSwing - entity.limbSwingAmount * (1.0F - partialTicks);
if (entity.isChild())
{
f6 *= 3.0F;
}
if (f5 > 1.0F)
{
f5 = 1.0F;
}
GlStateManager.enableAlpha();
this.mainModel.setLivingAnimations(entity, f6, f5, partialTicks);
this.mainModel.setRotationAngles(f6, f5, f8, f2, f7, 0.0625F, entity);
if (CustomEntityModels.isActive())
{
this.renderEntity = entity;
this.renderLimbSwing = f6;
this.renderLimbSwingAmount = f5;
this.renderAgeInTicks = f8;
this.renderHeadYaw = f2;
this.renderHeadPitch = f7;
this.renderScaleFactor = f4;
this.renderPartialTicks = partialTicks;
}
if (this.renderOutlines)
{
boolean flag1 = this.setScoreTeamColor(entity);
this.renderModel(entity, f6, f5, f8, f2, f7, 0.0625F);
if (flag1)
{
this.unsetScoreTeamColor();
}
}
else
{
boolean flag = this.setDoRenderBrightness(entity, partialTicks);
if (EmissiveTextures.isActive())
{
EmissiveTextures.beginRender();
}
if (this.renderModelPushMatrix)
{
GlStateManager.pushMatrix();
}
this.renderModel(entity, f6, f5, f8, f2, f7, 0.0625F);
if (this.renderModelPushMatrix)
{
GlStateManager.popMatrix();
}
if (EmissiveTextures.isActive())
{
if (EmissiveTextures.hasEmissive())
{
this.renderModelPushMatrix = true;
EmissiveTextures.beginRenderEmissive();
GlStateManager.pushMatrix();
this.renderModel(entity, f6, f5, f8, f2, f7, f4);
GlStateManager.popMatrix();
EmissiveTextures.endRenderEmissive();
}
EmissiveTextures.endRender();
}
if (flag)
{
this.unsetBrightness();
}
GlStateManager.depthMask(true);
if (!(entity instanceof EntityPlayer) || !((EntityPlayer)entity).isSpectator())
{
this.renderLayers(entity, f6, f5, partialTicks, f8, f2, f7, 0.0625F);
}
}
if (CustomEntityModels.isActive())
{
this.renderEntity = null;
}
GlStateManager.disableRescaleNormal();
}
catch (Exception exception)
{
logger.error((String)"Couldn\'t render entity", (Throwable)exception);
}
GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit);
GlStateManager.enableTexture2D();
GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit);
GlStateManager.enableCull();
GlStateManager.popMatrix();
if (!this.renderOutlines)
{
super.doRender(entity, x, y, z, entityYaw, partialTicks);
}
if (Reflector.RenderLivingEvent_Post_Constructor.exists())
{
Reflector.postForgeBusEvent(Reflector.RenderLivingEvent_Post_Constructor, new Object[] {entity, this, Double.valueOf(x), Double.valueOf(y), Double.valueOf(z)});
}
}
}