001 package net.minecraft.src;
002
003 public class EntityBodyHelper
004 {
005 /** Instance of EntityLiving. */
006 private EntityLiving theLiving;
007 private int field_75666_b = 0;
008 private float field_75667_c = 0.0F;
009
010 public EntityBodyHelper(EntityLiving par1EntityLiving)
011 {
012 this.theLiving = par1EntityLiving;
013 }
014
015 public void func_75664_a()
016 {
017 double var1 = this.theLiving.posX - this.theLiving.prevPosX;
018 double var3 = this.theLiving.posZ - this.theLiving.prevPosZ;
019
020 if (var1 * var1 + var3 * var3 > 2.500000277905201E-7D)
021 {
022 this.theLiving.renderYawOffset = this.theLiving.rotationYaw;
023 this.theLiving.rotationYawHead = this.func_75665_a(this.theLiving.renderYawOffset, this.theLiving.rotationYawHead, 75.0F);
024 this.field_75667_c = this.theLiving.rotationYawHead;
025 this.field_75666_b = 0;
026 }
027 else
028 {
029 float var5 = 75.0F;
030
031 if (Math.abs(this.theLiving.rotationYawHead - this.field_75667_c) > 15.0F)
032 {
033 this.field_75666_b = 0;
034 this.field_75667_c = this.theLiving.rotationYawHead;
035 }
036 else
037 {
038 ++this.field_75666_b;
039
040 if (this.field_75666_b > 10)
041 {
042 var5 = Math.max(1.0F - (float)(this.field_75666_b - 10) / 10.0F, 0.0F) * 75.0F;
043 }
044 }
045
046 this.theLiving.renderYawOffset = this.func_75665_a(this.theLiving.rotationYawHead, this.theLiving.renderYawOffset, var5);
047 }
048 }
049
050 private float func_75665_a(float par1, float par2, float par3)
051 {
052 float var4 = MathHelper.wrapAngleTo180_float(par1 - par2);
053
054 if (var4 < -par3)
055 {
056 var4 = -par3;
057 }
058
059 if (var4 >= par3)
060 {
061 var4 = par3;
062 }
063
064 return par1 - var4;
065 }
066 }