| 1 | package net.minecraft.entity;
|
| 2 |
|
| 3 | import net.minecraft.block.Block;
|
| 4 | import net.minecraft.util.BlockPos;
|
| 5 | import net.minecraft.util.MathHelper;
|
| 6 | import net.minecraft.world.World;
|
| 7 |
|
| 8 | public abstract class EntityFlying extends EntityLiving
|
| 9 | {
|
| 10 | public EntityFlying(World worldIn)
|
| 11 | {
|
| 12 | super(worldIn);
|
| 13 | }
|
| 14 |
|
| 15 | public void fall(float distance, float damageMultiplier)
|
| 16 | {
|
| 17 | }
|
| 18 |
|
| 19 | protected void updateFallState(double y, boolean onGroundIn, Block blockIn, BlockPos pos)
|
| 20 | {
|
| 21 | }
|
| 22 |
|
| 23 | /**
|
| 24 | * Moves the entity based on the specified heading. Args: strafe, forward
|
| 25 | */
|
| 26 | public void moveEntityWithHeading(float strafe, float forward)
|
| 27 | {
|
| 28 | if (this.isInWater())
|
| 29 | {
|
| 30 | this.moveFlying(strafe, forward, 0.02F);
|
| 31 | this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
| 32 | this.motionX *= 0.800000011920929D;
|
| 33 | this.motionY *= 0.800000011920929D;
|
| 34 | this.motionZ *= 0.800000011920929D;
|
| 35 | }
|
| 36 | else if (this.isInLava())
|
| 37 | {
|
| 38 | this.moveFlying(strafe, forward, 0.02F);
|
| 39 | this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
| 40 | this.motionX *= 0.5D;
|
| 41 | this.motionY *= 0.5D;
|
| 42 | this.motionZ *= 0.5D;
|
| 43 | }
|
| 44 | else
|
| 45 | {
|
| 46 | float f = 0.91F;
|
| 47 |
|
| 48 | if (this.onGround)
|
| 49 | {
|
| 50 | f = this.worldObj.getBlockState(new BlockPos(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.getEntityBoundingBox().minY) - 1, MathHelper.floor_double(this.posZ))).getBlock().slipperiness * 0.91F;
|
| 51 | }
|
| 52 |
|
| 53 | float f1 = 0.16277136F / (f * f * f);
|
| 54 | this.moveFlying(strafe, forward, this.onGround ? 0.1F * f1 : 0.02F);
|
| 55 | f = 0.91F;
|
| 56 |
|
| 57 | if (this.onGround)
|
| 58 | {
|
| 59 | f = this.worldObj.getBlockState(new BlockPos(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.getEntityBoundingBox().minY) - 1, MathHelper.floor_double(this.posZ))).getBlock().slipperiness * 0.91F;
|
| 60 | }
|
| 61 |
|
| 62 | this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
| 63 | this.motionX *= (double)f;
|
| 64 | this.motionY *= (double)f;
|
| 65 | this.motionZ *= (double)f;
|
| 66 | }
|
| 67 |
|
| 68 | this.prevLimbSwingAmount = this.limbSwingAmount;
|
| 69 | double d1 = this.posX - this.prevPosX;
|
| 70 | double d0 = this.posZ - this.prevPosZ;
|
| 71 | float f2 = MathHelper.sqrt_double(d1 * d1 + d0 * d0) * 4.0F;
|
| 72 |
|
| 73 | if (f2 > 1.0F)
|
| 74 | {
|
| 75 | f2 = 1.0F;
|
| 76 | }
|
| 77 |
|
| 78 | this.limbSwingAmount += (f2 - this.limbSwingAmount) * 0.4F;
|
| 79 | this.limbSwing += this.limbSwingAmount;
|
| 80 | }
|
| 81 |
|
| 82 | /**
|
| 83 | * returns true if this entity is by a ladder, false otherwise
|
| 84 | */
|
| 85 | public boolean isOnLadder()
|
| 86 | {
|
| 87 | return false;
|
| 88 | }
|
| 89 | }
|
| 90 |
|