001 package net.minecraft.src; 002 003 public abstract class EntityFlying extends EntityLiving 004 { 005 public EntityFlying(World par1World) 006 { 007 super(par1World); 008 } 009 010 /** 011 * Called when the mob is falling. Calculates and applies fall damage. 012 */ 013 protected void fall(float par1) {} 014 015 /** 016 * Takes in the distance the entity has fallen this tick and whether its on the ground to update the fall distance 017 * and deal fall damage if landing on the ground. Args: distanceFallenThisTick, onGround 018 */ 019 protected void updateFallState(double par1, boolean par3) {} 020 021 /** 022 * Moves the entity based on the specified heading. Args: strafe, forward 023 */ 024 public void moveEntityWithHeading(float par1, float par2) 025 { 026 if (this.isInWater()) 027 { 028 this.moveFlying(par1, par2, 0.02F); 029 this.moveEntity(this.motionX, this.motionY, this.motionZ); 030 this.motionX *= 0.800000011920929D; 031 this.motionY *= 0.800000011920929D; 032 this.motionZ *= 0.800000011920929D; 033 } 034 else if (this.handleLavaMovement()) 035 { 036 this.moveFlying(par1, par2, 0.02F); 037 this.moveEntity(this.motionX, this.motionY, this.motionZ); 038 this.motionX *= 0.5D; 039 this.motionY *= 0.5D; 040 this.motionZ *= 0.5D; 041 } 042 else 043 { 044 float var3 = 0.91F; 045 046 if (this.onGround) 047 { 048 var3 = 0.54600006F; 049 int var4 = this.worldObj.getBlockId(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ)); 050 051 if (var4 > 0) 052 { 053 var3 = Block.blocksList[var4].slipperiness * 0.91F; 054 } 055 } 056 057 float var8 = 0.16277136F / (var3 * var3 * var3); 058 this.moveFlying(par1, par2, this.onGround ? 0.1F * var8 : 0.02F); 059 var3 = 0.91F; 060 061 if (this.onGround) 062 { 063 var3 = 0.54600006F; 064 int var5 = this.worldObj.getBlockId(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ)); 065 066 if (var5 > 0) 067 { 068 var3 = Block.blocksList[var5].slipperiness * 0.91F; 069 } 070 } 071 072 this.moveEntity(this.motionX, this.motionY, this.motionZ); 073 this.motionX *= (double)var3; 074 this.motionY *= (double)var3; 075 this.motionZ *= (double)var3; 076 } 077 078 this.prevLegYaw = this.legYaw; 079 double var10 = this.posX - this.prevPosX; 080 double var9 = this.posZ - this.prevPosZ; 081 float var7 = MathHelper.sqrt_double(var10 * var10 + var9 * var9) * 4.0F; 082 083 if (var7 > 1.0F) 084 { 085 var7 = 1.0F; 086 } 087 088 this.legYaw += (var7 - this.legYaw) * 0.4F; 089 this.legSwing += this.legYaw; 090 } 091 092 /** 093 * returns true if this entity is by a ladder, false otherwise 094 */ 095 public boolean isOnLadder() 096 { 097 return false; 098 } 099 }