Example #1
0
 public IBlockData getPlacedState(
     World world,
     BlockPosition blockposition,
     EnumDirection enumdirection,
     float f,
     float f1,
     float f2,
     int i,
     EntityLiving entityliving) {
   IBlockData iblockdata = getBlockData().set(POWERED, Boolean.valueOf(false));
   if (a(world, blockposition, enumdirection.opposite())) {
     return iblockdata.set(
         FACING, EnumLeverPosition.a(enumdirection, entityliving.getDirection()));
   }
   Iterator iterator = EnumDirection.EnumDirectionLimit.HORIZONTAL.iterator();
   EnumDirection enumdirection1;
   do {
     if (!iterator.hasNext()) {
       if (World.a(world, blockposition.down())) {
         return iblockdata.set(
             FACING, EnumLeverPosition.a(EnumDirection.UP, entityliving.getDirection()));
       }
       return iblockdata;
     }
     enumdirection1 = (EnumDirection) iterator.next();
   } while ((enumdirection1 == enumdirection)
       || (!a(world, blockposition, enumdirection1.opposite())));
   return iblockdata.set(FACING, EnumLeverPosition.a(enumdirection1, entityliving.getDirection()));
 }
Example #2
0
  @Override
  public boolean shouldStart() {
    if (myPet.getRangedDamage() <= 0) {
      return false;
    }
    if (!entityMyPet.canMove()) {
      return false;
    }
    if (!entityMyPet.hasTarget()) {
      return false;
    }

    EntityLiving target = ((CraftLivingEntity) this.entityMyPet.getTarget()).getHandle();

    if (target instanceof EntityArmorStand) {
      return false;
    }
    double meleeDamage = myPet.getDamage();
    if (meleeDamage > 0
        && this.entityMyPet.f(target.locX, target.getBoundingBox().b, target.locZ) < 4) {
      if (meleeDamage > rangedSkill.getDamage()) {
        return false;
      }
    }
    this.target = target;
    return true;
  }
  @Override
  public boolean update() {
    EntityLiving entity = this.getEntityHandle();
    NMSUtil.getControllerLook(entity).a(this.m_target, 30, 30);
    if ((this.m_ignoreSight || NMSUtil.getEntitySenses(entity).canSee(this.m_target))
        && --this.m_moveTick <= 0) {
      this.m_moveTick = 4 + entity.aC().nextInt(7);
      this.getRemoteEntity()
          .move(
              (LivingEntity) this.m_target.getBukkitEntity(),
              (this.m_speed == -1 ? this.getRemoteEntity().getSpeed() : this.m_speed));
    }

    this.m_attackTick = Math.max(this.m_attackTick - 1, 0);
    double minDist = entity.width * 2 * entity.width * 2;
    if (this.m_attackTick <= 0
        && entity.e(this.m_target.locX, this.m_target.boundingBox.b, this.m_target.locZ)
            <= minDist) {
      this.m_attackTick = 20;
      if (entity.aY() != null) this.getEntityHandle().aR();

      this.attack(this.m_target.getBukkitEntity());
    }
    return true;
  }
  public void c() {
    this.c.setGoalTarget(this.b);
    EntityLiving entityliving = this.a.getOwner();

    if (entityliving != null) {
      this.e = entityliving.aF();
    }

    super.c();
  }
  @Override
  public boolean c(EntityLiving entity) {
    if (this.getRemoteEntity() == null) return super.c(entity);

    if (!(entity.getBukkitEntity() instanceof Player)) return super.c(entity);

    return ((RemoteBaseEntity) this.m_remoteEntity)
            .onInteract((Player) entity.getBukkitEntity(), false)
        && super.c(entity);
  }
 /**
  * Calculates de (magic) damage done by the enchantment on a living entity based on level and
  * entity passed.
  */
 public int calcModifierLiving(int par1, EntityLiving par2EntityLiving) {
   return this.damageType == 0
       ? MathHelper.floor_float((float) par1 * 2.75F)
       : (this.damageType == 1
               && par2EntityLiving.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD
           ? MathHelper.floor_float((float) par1 * 4.5F)
           : (this.damageType == 2
                   && par2EntityLiving.getCreatureAttribute() == EnumCreatureAttribute.ARTHROPOD
               ? MathHelper.floor_float((float) par1 * 4.5F)
               : 0));
 }
 public boolean func_46082_a() {
   if (!field_48392_a.func_48139_F_()) {
     return false;
   }
   EntityLiving entityliving = field_48392_a.func_48144_ah();
   if (entityliving == null) {
     return false;
   } else {
     field_48391_b = entityliving.func_48088_aP();
     return func_48376_a(field_48391_b, false);
   }
 }
  public boolean a() {
    EntityLiving entityliving = this.b.getGoalTarget();

    if (entityliving == null) {
      return false;
    } else if (!entityliving.isAlive()) {
      return false;
    } else if (this.g != null && !this.g.isAssignableFrom(entityliving.getClass())) {
      return false;
    } else {
      this.f = this.b.getNavigation().a(entityliving);
      return this.f != null;
    }
  }
  /** Returns whether the EntityAIBase should begin execution. */
  public boolean shouldExecute() {
    if (!this.entityOwner.isTamed()) {
      return false;
    } else {
      EntityLiving var1 = this.entityOwner.getOwner();

      if (var1 == null) {
        return false;
      } else {
        this.field_48393_b = var1.getAITarget();
        return this.isSuitableTarget(this.field_48393_b, false);
      }
    }
  }
  public boolean b() {
    EntityLiving entityliving = this.b.getGoalTarget();

    return entityliving == null
        ? false
        : (!entityliving.isAlive()
            ? false
            : (!this.e
                ? !this.b.getNavigation().g()
                : this.b.b(
                    MathHelper.floor(entityliving.locX),
                    MathHelper.floor(entityliving.locY),
                    MathHelper.floor(entityliving.locZ))));
  }
  public boolean a() {
    if (!this.a.isTamed()) {
      return false;
    } else {
      EntityLiving entityliving = this.a.getOwner();

      if (entityliving == null) {
        return false;
      } else {
        this.b = entityliving.aD();
        return this.a(this.b, false);
      }
    }
  }
  @Override
  public boolean shouldExecute() {
    if (this.getEntityHandle() == null) return false;

    EntityLiving entityTarget = NMSUtil.getGoalTarget(this.getEntityHandle());

    if (entityTarget == null) return false;
    else if (this.m_toAttack != null && !this.m_toAttack.isAssignableFrom(entityTarget.getClass()))
      return false;
    else {
      this.m_target = entityTarget;
      this.m_path = this.getNavigation().a(this.m_target);
      return this.m_path != null;
    }
  }
  public boolean a(Entity entity) {
    if (!entity.isAlive()) {
      return false;
    } else if (!(entity instanceof EntityLiving)) {
      return false;
    } else {
      EntityLiving entityliving = (EntityLiving) entity;

      return entityliving.getEquipment(EntityInsentient.b(this.c)) != null
          ? false
          : (entityliving instanceof EntityInsentient
              ? ((EntityInsentient) entityliving).bH()
              : entityliving instanceof EntityHuman);
    }
  }
  public boolean a() {
    if (!this.a.isTamed()) {
      return false;
    } else {
      EntityLiving entityliving = this.a.getOwner();

      if (entityliving == null) {
        return false;
      } else {
        this.b = entityliving.getLastDamager();
        int i = entityliving.aF();

        return i != this.e && this.a(this.b, false) && this.a.a(this.b, entityliving);
      }
    }
  }
  /** Returns whether the EntityAIBase should begin execution. */
  public boolean shouldExecute() {
    targetEntity = theEntity.getAttackTarget();

    if (targetEntity == null) {
      return false;
    }

    if (targetEntity.getDistanceSqToEntity(theEntity) > (double) (field_48218_g * field_48218_g)) {
      return false;
    }

    Vec3D vec3d =
        RandomPositionGenerator.func_48395_a(
            theEntity,
            16,
            7,
            Vec3D.createVector(targetEntity.posX, targetEntity.posY, targetEntity.posZ));

    if (vec3d == null) {
      return false;
    } else {
      movePosX = vec3d.xCoord;
      movePosY = vec3d.yCoord;
      movePosZ = vec3d.zCoord;
      return true;
    }
  }
  @Override
  public void update(int dt) {

    // TODO: Debug
    /*
    if (statEffects.contains(StatEffect.EMP)) {

    	return;
    }
    */

    // debug
    if (parent == null) {

      System.out.println("Somehow parent is null! WTF");
    }
    if (owner == null) {

      System.out.println("Somehow owner is null! WTF");
    }

    setPos(getPos().add(step));

    life += dt;

    if (life >= lifeTime) {

      parent.removeChild(this);
    }

    EntityLiving e =
        (EntityLiving)
            Utils.getNearestEntity(
                Utils.sortByType(MainGame.instance.lc.getCopyOfChildren(), "Enemy"),
                this.getCenterPos(),
                50);

    if (e != null) {

      e.damage(owner.getDamage());

      parent.removeChild(this);
    }
  }
Example #17
0
 @Override
 public boolean shouldFinish() {
   if (entityMyPet.getTarget() == null
       || !target.isAlive()
       || myPet.getRangedDamage() <= 0
       || !entityMyPet.canMove()) {
     return true;
   }
   if (this.target.getBukkitEntity() != this.myPet.getEntity().getTarget()) {
     return true;
   }
   double meleeDamage = myPet.getDamage();
   if (meleeDamage > 0
       && this.entityMyPet.f(target.locX, target.getBoundingBox().b, target.locZ) < 4) {
     if (meleeDamage > rangedSkill.getDamage()) {
       return true;
     }
   }
   return false;
 }
Example #18
0
  /**
   * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack,
   * world, entityPlayer
   */
  public ItemStack onItemRightClick(
      ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
    int var4 = EntityLiving.getArmorPosition(par1ItemStack) - 1;
    ItemStack var5 = par3EntityPlayer.getCurrentArmor(var4);

    if (var5 == null) {
      par3EntityPlayer.setCurrentItemOrArmor(var4, par1ItemStack.copy());
      par1ItemStack.stackSize = 0;
    }

    return par1ItemStack;
  }
 public void b(EntityLiving entityliving) {
   super.b(entityliving);
   if (village != null && entityliving != null) {
     village.a(entityliving);
     if (entityliving instanceof EntityHuman) {
       byte byte0 = -1;
       if (isBaby()) byte0 = -3;
       village.a(entityliving.getName(), byte0);
       if (isAlive()) world.broadcastEntityEffect(this, (byte) 13);
     }
   }
 }
  public void e() {
    EntityLiving entityliving = this.b.getGoalTarget();

    this.b.getControllerLook().a(entityliving, 30.0F, 30.0F);
    double d0 = this.b.e(entityliving.locX, entityliving.boundingBox.b, entityliving.locZ);
    double d1 = (double) (this.b.width * 2.0F * this.b.width * 2.0F + entityliving.width);

    --this.h;
    if ((this.e || this.b.getEntitySenses().canSee(entityliving))
        && this.h <= 0
        && (this.i == 0.0D && this.j == 0.0D && this.k == 0.0D
            || entityliving.e(this.i, this.j, this.k) >= 1.0D
            || this.b.aI().nextFloat() < 0.05F)) {
      this.i = entityliving.locX;
      this.j = entityliving.boundingBox.b;
      this.k = entityliving.locZ;
      this.h = 4 + this.b.aI().nextInt(7);
      if (d0 > 1024.0D) {
        this.h += 10;
      } else if (d0 > 256.0D) {
        this.h += 5;
      }

      if (!this.b.getNavigation().a((Entity) entityliving, this.d)) {
        this.h += 15;
      }
    }

    this.c = Math.max(this.c - 1, 0);
    if (d0 <= d1 && this.c <= 20) {
      this.c = 20;
      if (this.b.be() != null) {
        this.b.ba();
      }

      this.b.n(entityliving);
    }
  }
Example #21
0
  public void die() {
    int i = this.getSize();

    if (!this.world.isStatic && i > 1 && this.getHealth() <= 0) {
      int j = 2 + this.random.nextInt(3);

      // CraftBukkit start
      org.bukkit.event.entity.SlimeSplitEvent event =
          new org.bukkit.event.entity.SlimeSplitEvent(this.getBukkitEntity(), j);
      this.world.getServer().getPluginManager().callEvent(event);

      if (!event.isCancelled() && event.getCount() > 0) {
        j = event.getCount();
      } else {
        super.die();
        return;
      }
      // CraftBukkit end

      for (int k = 0; k < j; ++k) {
        float f = ((float) (k % 2) - 0.5F) * (float) i / 4.0F;
        float f1 = ((float) (k / 2) - 0.5F) * (float) i / 4.0F;
        EntitySlime entityslime = this.y();

        entityslime.setSize(i / 2);
        entityslime.setPositionRotation(
            this.locX + (double) f,
            this.locY + 0.5D,
            this.locZ + (double) f1,
            this.random.nextFloat() * 360.0F,
            0.0F);
        this.world.addEntity(entityslime);
      }
    }

    super.die();
  }
Example #22
0
  public void l_() {
    if (!this.world.isStatic && this.world.difficulty == 0 && this.getSize() > 0) {
      this.dead = true;
    }

    this.c += (this.b - this.c) * 0.5F;
    this.d = this.c;
    boolean flag = this.onGround;

    super.l_();
    int i;

    if (this.onGround && !flag) {
      i = this.getSize();

      for (int j = 0; j < i * 8; ++j) {
        float f = this.random.nextFloat() * 3.1415927F * 2.0F;
        float f1 = this.random.nextFloat() * 0.5F + 0.5F;
        float f2 = MathHelper.sin(f) * (float) i * 0.5F * f1;
        float f3 = MathHelper.cos(f) * (float) i * 0.5F * f1;

        this.world.addParticle(
            this.h(),
            this.locX + (double) f2,
            this.boundingBox.b,
            this.locZ + (double) f3,
            0.0D,
            0.0D,
            0.0D);
      }

      if (this.o()) {
        this.makeSound(
            this.n(),
            this.ba(),
            ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) / 0.8F);
      }

      this.b = -0.5F;
    } else if (!this.onGround && flag) {
      this.b = 1.0F;
    }

    this.k();
    if (this.world.isStatic) {
      i = this.getSize();
      this.a(0.6F * (float) i, 0.6F * (float) i);
    }
  }
Example #23
0
  @Override
  public void tick() {
    super.tick();

    // TODO Operations like that wont work anymore.
    /*if(!isWalking() && !walk && Utils.getSide() == Side.SERVER)
    {
    	String[] players = new String[mapObj.onlinePlayersMap.values().size()];
    	players = mapObj.onlinePlayersMap.values().toArray(players);
    	if(players.length > 0)
    	{
    		Entity player = mapObj.entityMap.get(players[0]);
    		walkTo(player.xCoord, player.yCoord, Double.MAX_VALUE);
    	}
    }*/
  }
  /** Dispense the specified stack, play the dispense sound and spawn particles. */
  public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack) {
    EnumFacing var3 = BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata());
    double var4 = par1IBlockSource.getX() + (double) var3.getFrontOffsetX();
    double var6 = (double) ((float) par1IBlockSource.getYInt() + 0.2F);
    double var8 = par1IBlockSource.getZ() + (double) var3.getFrontOffsetZ();
    Entity var10 =
        ItemMonsterPlacer.spawnCreature(
            par1IBlockSource.getWorld(), par2ItemStack.getItemDamage(), var4, var6, var8);

    if (var10 instanceof EntityLiving && par2ItemStack.hasDisplayName()) {
      ((EntityLiving) var10).func_94058_c(par2ItemStack.getDisplayName());
    }

    par2ItemStack.splitStack(1);
    return par2ItemStack;
  }
Example #25
0
 public void func_40613_a(
     EntityLiving p_40613_1_, EntityLiving p_40613_2_, int p_40613_3_, double p_40613_4_) {
   if (field_35670_H == field_35685_h.field_35670_H && !p_40613_2_.func_40122_aP()
       || field_35670_H == field_35686_i.field_35670_H && p_40613_2_.func_40122_aP()) {
     int i = (int) (p_40613_4_ * (double) (6 << p_40613_3_) + 0.5D);
     p_40613_2_.func_432_b(i);
   } else if (field_35670_H == field_35686_i.field_35670_H && !p_40613_2_.func_40122_aP()
       || field_35670_H == field_35685_h.field_35670_H && p_40613_2_.func_40122_aP()) {
     int j = (int) (p_40613_4_ * (double) (6 << p_40613_3_) + 0.5D);
     if (p_40613_1_ == null) {
       p_40613_2_.func_396_a(DamageSource.field_35545_l, j);
     } else {
       p_40613_2_.func_396_a(DamageSource.func_40542_b(p_40613_2_, p_40613_1_), j);
     }
   }
 }
Example #26
0
  public void w_() {
    if (!this.world.isStatic && this.world.difficulty == 0 && this.getSize() > 0) {
      this.dead = true;
    }

    this.b += (this.a - this.b) * 0.5F;
    this.c = this.b;
    boolean flag = this.onGround;

    super.w_();
    if (this.onGround && !flag) {
      int i = this.getSize();

      for (int j = 0; j < i * 8; ++j) {
        float f = this.random.nextFloat() * 3.1415927F * 2.0F;
        float f1 = this.random.nextFloat() * 0.5F + 0.5F;
        float f2 = MathHelper.sin(f) * (float) i * 0.5F * f1;
        float f3 = MathHelper.cos(f) * (float) i * 0.5F * f1;

        this.world.a(
            this.w(),
            this.locX + (double) f2,
            this.boundingBox.b,
            this.locZ + (double) f3,
            0.0D,
            0.0D,
            0.0D);
      }

      if (this.G()) {
        this.world.makeSound(
            this,
            this.E(),
            this.o(),
            ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) / 0.8F);
      }

      this.a = -0.5F;
    }

    this.B();
  }
Example #27
0
  public boolean m(Entity entity) {
    if (super.m(entity)) {
      if (entity instanceof EntityLiving) {
        byte b0 = 0;

        if (this.world.difficulty > 1) {
          if (this.world.difficulty == 2) {
            b0 = 7;
          } else if (this.world.difficulty == 3) {
            b0 = 15;
          }
        }

        if (b0 > 0) {
          ((EntityLiving) entity).addEffect(new MobEffect(MobEffectList.POISON.id, b0 * 20, 0));
        }
      }

      return true;
    } else {
      return false;
    }
  }
Example #28
0
  public void die() {
    int i = this.getSize();

    if (!this.world.isStatic && i > 1 && this.getHealth() <= 0) {
      int j = 2 + this.random.nextInt(3);

      for (int k = 0; k < j; ++k) {
        float f = ((float) (k % 2) - 0.5F) * (float) i / 4.0F;
        float f1 = ((float) (k / 2) - 0.5F) * (float) i / 4.0F;
        EntitySlime entityslime = this.i();

        entityslime.setSize(i / 2);
        entityslime.setPositionRotation(
            this.locX + (double) f,
            this.locY + 0.5D,
            this.locZ + (double) f1,
            this.random.nextFloat() * 360.0F,
            0.0F);
        this.world.addEntity(entityslime);
      }
    }

    super.die();
  }
Example #29
0
  public void shootProjectile(EntityLiving target, float damage, Projectiles projectile) {
    World world = target.world;

    if (projectile == Projectiles.Arrow) {
      EntityArrow arrow = new MyPetArrow(world, entityMyPet, target, 1.6F, 1);
      arrow.b(damage);
      arrow.setCritical(false);
      entityMyPet.makeSound(
          "random.bow", 1.0F, 1.0F / (entityMyPet.getRandom().nextFloat() * 0.4F + 0.8F));
      world.addEntity(arrow);
    } else if (projectile == Projectiles.Snowball) {
      MyPetSnowball snowball = new MyPetSnowball(world, entityMyPet);
      double distanceX = target.locX - entityMyPet.locX;
      double distanceY = target.locY + target.getHeadHeight() - 1.100000023841858D - snowball.locY;
      double distanceZ = target.locZ - entityMyPet.locZ;
      float distance20percent =
          MathHelper.sqrt(distanceX * distanceX + distanceZ * distanceZ) * 0.2F;
      snowball.setDamage(damage);
      snowball.shoot(distanceX, distanceY + distance20percent, distanceZ, 1.6F, 1);
      entityMyPet.makeSound(
          "random.bow", 0.5F, 0.4F / (entityMyPet.getRandom().nextFloat() * 0.4F + 0.8F));
      world.addEntity(snowball);
    } else if (projectile == Projectiles.Egg) {
      MyPetEgg egg = new MyPetEgg(world, entityMyPet);
      double distanceX = target.locX - entityMyPet.locX;
      double distanceY = target.locY + target.getHeadHeight() - 1.100000023841858D - egg.locY;
      double distanceZ = target.locZ - entityMyPet.locZ;
      float distance20percent =
          MathHelper.sqrt(distanceX * distanceX + distanceZ * distanceZ) * 0.2F;
      egg.setDamage(damage);
      egg.shoot(distanceX, distanceY + distance20percent, distanceZ, 1.6F, 1);
      entityMyPet.makeSound(
          "random.bow", 0.5F, 0.4F / (entityMyPet.getRandom().nextFloat() * 0.4F + 0.8F));
      world.addEntity(egg);
    } else if (projectile == Projectiles.LargeFireball) {
      double distanceX = this.target.locX - entityMyPet.locX;
      double distanceY =
          this.target.getBoundingBox().b
              + (double) (this.target.length / 2.0F)
              - (0.5D + entityMyPet.locY + (double) (entityMyPet.length / 2.0F));
      double distanceZ = this.target.locZ - entityMyPet.locZ;
      MyPetLargeFireball largeFireball =
          new MyPetLargeFireball(world, entityMyPet, distanceX, distanceY, distanceZ);
      largeFireball.locY = (entityMyPet.locY + entityMyPet.length / 2.0F + 0.5D);
      largeFireball.setDamage(damage);
      world.addEntity(largeFireball);
      world.makeSound(
          entityMyPet.locX + 0.5D,
          entityMyPet.locY + 0.5D,
          entityMyPet.locZ + 0.5D,
          "mob.ghast.fireball",
          1.0F + entityMyPet.getRandom().nextFloat(),
          entityMyPet.getRandom().nextFloat() * 0.7F + 0.3F);
    } else if (projectile == Projectiles.SmallFireball) {
      double distanceX = this.target.locX - entityMyPet.locX;
      double distanceY =
          this.target.getBoundingBox().b
              + (this.target.length / 2.0F)
              - (0.5D + entityMyPet.locY + (entityMyPet.length / 2.0F));
      double distanceZ = this.target.locZ - entityMyPet.locZ;
      MyPetSmallFireball smallFireball =
          new MyPetSmallFireball(world, entityMyPet, distanceX, distanceY, distanceZ);
      smallFireball.locY = (entityMyPet.locY + entityMyPet.length / 2.0F + 0.5D);
      smallFireball.setDamage(damage);
      world.addEntity(smallFireball);
      world.makeSound(
          entityMyPet.locX + 0.5D,
          entityMyPet.locY + 0.5D,
          entityMyPet.locZ + 0.5D,
          "mob.ghast.fireball",
          1.0F + entityMyPet.getRandom().nextFloat(),
          entityMyPet.getRandom().nextFloat() * 0.7F + 0.3F);
    } else if (projectile == Projectiles.WitherSkull) {
      double distanceX = this.target.locX - entityMyPet.locX;
      double distanceY =
          this.target.getBoundingBox().b
              + (double) (this.target.length / 2.0F)
              - (0.5D + entityMyPet.locY + (double) (entityMyPet.length / 2.0F));
      double distanceZ = this.target.locZ - entityMyPet.locZ;
      MyPetWitherSkull witherSkull =
          new MyPetWitherSkull(world, entityMyPet, distanceX, distanceY, distanceZ);
      witherSkull.locY = (entityMyPet.locY + entityMyPet.length / 2.0F + 0.5D);
      witherSkull.setDamage(damage);
      world.addEntity(witherSkull);
      world.makeSound(
          entityMyPet.locX + 0.5D,
          entityMyPet.locY + 0.5D,
          entityMyPet.locZ + 0.5D,
          "mob.wither.shoot",
          1.0F + entityMyPet.getRandom().nextFloat(),
          entityMyPet.getRandom().nextFloat() * 0.7F + 0.3F);
    }
  }
  @Override
  public boolean update() {
    EntityHuman passenger = (EntityHuman) this.getEntityHandle().passenger;
    EntityLiving entity = this.getEntityHandle();
    float f = MathHelper.g(passenger.yaw - entity.yaw) * 0.5f;

    if (f > 5) f = 5;

    if (f < -5) f = -5;

    entity.yaw = MathHelper.g(entity.yaw + f);
    if (this.m_currentSpeed < this.m_maxSpeed)
      this.m_currentSpeed += (this.m_maxSpeed - this.m_currentSpeed) * 0.01;

    if (this.m_currentSpeed > this.m_maxSpeed) this.m_currentSpeed = this.m_maxSpeed;

    int x = MathHelper.floor(entity.locX);
    int y = MathHelper.floor(entity.locY);
    int z = MathHelper.floor(entity.locZ);
    float speed = this.m_currentSpeed;

    if (this.m_speedBoosted) {
      if (this.m_speedBoostTime++ > this.m_maxSpeedBoostTime) this.m_speedBoosted = false;

      speed +=
          speed
              * 1.15
              * MathHelper.sin(
                  (float) (this.m_speedBoostTime / this.m_maxSpeedBoostTime * Math.PI));
    }

    float f2 = 0.91f;
    if (entity.onGround) {
      f2 = 0.54600006F;
      Block block = entity.world.getType(MathHelper.d(x), MathHelper.d(y) - 1, MathHelper.d(z));
      if (block.getMaterial() != Material.AIR) f2 = block.frictionFactor * 0.91f;
    }

    float f3 = 0.16277136F / (f2 * f2 * f2);
    float f4 = MathHelper.sin(entity.yaw * 3.1415927F / 180.0F);
    float f5 = MathHelper.cos(entity.yaw * 3.1415927F / 180.0F);
    float f6 = entity.bl() * f3;
    float f7 = Math.max(speed, 1.0F);

    f7 = f6 / f7;
    float f8 = speed * f7;
    float f9 = -(f8 * f4);
    float f10 = f8 * f5;

    if (MathHelper.abs(f9) > MathHelper.abs(f10)) {
      if (f9 < 0.0F) {
        f9 -= entity.width / 2.0F;
      }

      if (f9 > 0.0F) {
        f9 += entity.width / 2.0F;
      }

      f10 = 0.0F;
    } else {
      f9 = 0.0F;
      if (f10 < 0.0F) {
        f10 -= entity.width / 2.0F;
      }

      if (f10 > 0.0F) {
        f10 += entity.width / 2.0F;
      }
    }

    int nextX = MathHelper.floor(entity.locX + f9);
    int nextZ = MathHelper.floor(entity.locZ + f10);
    PathPoint point =
        new PathPoint(
            MathHelper.d(entity.width + 1),
            MathHelper.d(entity.length + passenger.length + 1),
            MathHelper.d(entity.width + 1));
    if (x != nextX || z != nextZ) {
      Block type1 = entity.world.getType(x, y, z);
      Block type2 = entity.world.getType(x, y - 1, z);
      boolean isStep = this.isStep(type1) || type1 == null && this.isStep(type2);

      if (!isStep
          && Pathfinder.a(entity, nextX, y, nextZ, point, false, false, true) == 0
          && Pathfinder.a(entity, x, y + 1, z, point, false, false, true) == 1
          && Pathfinder.a(entity, nextX, y + 1, nextZ, point, false, false, true) == 1)
        NMSUtil.getControllerLook(entity).a();
    }

    if (!passenger.abilities.canInstantlyBuild
        && this.m_currentSpeed >= this.m_maxSpeed * 0.5
        && entity.aI().nextFloat() < 0.006f
        && !this.m_speedBoosted) {
      ItemStack item = passenger.be();

      if (item != null && item.getItem() == Items.CARROT_STICK) {
        item.damage(1, passenger);
        if (item.count == 0) {
          ItemStack newItem = new ItemStack(Items.FISHING_ROD);
          newItem.setTag(item.tag);
          passenger.inventory.items[passenger.inventory.itemInHandIndex] = newItem;
        }
      }
    }

    entity.e(0, speed);
    return true;
  }