예제 #1
0
 public EntityArrow(World world, EntityLiving entityliving, float f) {
   super(world);
   this.shooter = entityliving;
   this.fromPlayer = entityliving instanceof EntityHuman;
   this.b(0.5F, 0.5F);
   this.setPositionRotation(
       entityliving.locX,
       entityliving.locY + (double) entityliving.x(),
       entityliving.locZ,
       entityliving.yaw,
       entityliving.pitch);
   this.locX -= (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * 0.16F);
   this.locY -= 0.10000000149011612D;
   this.locZ -= (double) (MathHelper.sin(this.yaw / 180.0F * 3.1415927F) * 0.16F);
   this.setPosition(this.locX, this.locY, this.locZ);
   this.height = 0.0F;
   this.motX =
       (double)
           (-MathHelper.sin(this.yaw / 180.0F * 3.1415927F)
               * MathHelper.cos(this.pitch / 180.0F * 3.1415927F));
   this.motZ =
       (double)
           (MathHelper.cos(this.yaw / 180.0F * 3.1415927F)
               * MathHelper.cos(this.pitch / 180.0F * 3.1415927F));
   this.motY = (double) (-MathHelper.sin(this.pitch / 180.0F * 3.1415927F));
   this.a(this.motX, this.motY, this.motZ, f * 1.5F, 1.0F);
 }
예제 #2
0
  public EntityArrow(World world, EntityLiving entityliving, float f) {
    super(world);
    this.j = 10.0D;
    this.shooter = entityliving;
    this.projectileSource = (LivingEntity) entityliving.getBukkitEntity(); // CraftBukkit
    if (entityliving instanceof EntityHuman) {
      this.fromPlayer = 1;
    }

    this.a(0.5F, 0.5F);
    this.setPositionRotation(
        entityliving.locX,
        entityliving.locY + (double) entityliving.getHeadHeight(),
        entityliving.locZ,
        entityliving.yaw,
        entityliving.pitch);
    this.locX -= (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * 0.16F);
    this.locY -= 0.10000000149011612D;
    this.locZ -= (double) (MathHelper.sin(this.yaw / 180.0F * 3.1415927F) * 0.16F);
    this.setPosition(this.locX, this.locY, this.locZ);
    this.height = 0.0F;
    this.motX =
        (double)
            (-MathHelper.sin(this.yaw / 180.0F * 3.1415927F)
                * MathHelper.cos(this.pitch / 180.0F * 3.1415927F));
    this.motZ =
        (double)
            (MathHelper.cos(this.yaw / 180.0F * 3.1415927F)
                * MathHelper.cos(this.pitch / 180.0F * 3.1415927F));
    this.motY = (double) (-MathHelper.sin(this.pitch / 180.0F * 3.1415927F));
    this.shoot(this.motX, this.motY, this.motZ, f * 1.5F, 1.0F);
  }
예제 #3
0
  protected final Vec3D f(float f, float f1) {
    float f2 = MathHelper.cos(-f1 * 0.017453292F - 3.1415927F);
    float f3 = MathHelper.sin(-f1 * 0.017453292F - 3.1415927F);
    float f4 = -MathHelper.cos(-f * 0.017453292F);
    float f5 = MathHelper.sin(-f * 0.017453292F);

    return new Vec3D((double) (f3 * f4), (double) f5, (double) (f2 * f4));
  }
예제 #4
0
  public EntityItem a(ItemStack itemstack, boolean flag) {
    if (itemstack == null) {
      return null;
    } else {
      EntityItem entityitem =
          new EntityItem(
              this.world,
              this.locX,
              this.locY - 0.30000001192092896D + (double) this.getHeadHeight(),
              this.locZ,
              itemstack);

      entityitem.pickupDelay = 40;
      float f = 0.1F;
      float f1;

      if (flag) {
        f1 = this.random.nextFloat() * 0.5F;
        float f2 = this.random.nextFloat() * 3.1415927F * 2.0F;

        entityitem.motX = (double) (-MathHelper.sin(f2) * f1);
        entityitem.motZ = (double) (MathHelper.cos(f2) * f1);
        entityitem.motY = 0.20000000298023224D;
      } else {
        f = 0.3F;
        entityitem.motX =
            (double)
                (-MathHelper.sin(this.yaw / 180.0F * 3.1415927F)
                    * MathHelper.cos(this.pitch / 180.0F * 3.1415927F)
                    * f);
        entityitem.motZ =
            (double)
                (MathHelper.cos(this.yaw / 180.0F * 3.1415927F)
                    * MathHelper.cos(this.pitch / 180.0F * 3.1415927F)
                    * f);
        entityitem.motY = (double) (-MathHelper.sin(this.pitch / 180.0F * 3.1415927F) * f + 0.1F);
        f = 0.02F;
        f1 = this.random.nextFloat() * 3.1415927F * 2.0F;
        f *= this.random.nextFloat();
        entityitem.motX += Math.cos((double) f1) * (double) f;
        entityitem.motY += (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F);
        entityitem.motZ += Math.sin((double) f1) * (double) f;
      }

      this.a(entityitem);
      this.a(StatisticList.v, 1);
      return entityitem;
    }
  }
예제 #5
0
  public void d(World world, BlockPosition blockposition) {
    if (!world.worldProvider.o()) {
      IBlockData iblockdata = world.getType(blockposition);
      int i = world.b(EnumSkyBlock.SKY, blockposition) - world.ab();
      float f = world.d(1.0F);
      float f1 = f < 3.1415927F ? 0.0F : 6.2831855F;

      f += (f1 - f) * 0.2F;
      i = Math.round((float) i * MathHelper.cos(f));
      i = MathHelper.clamp(i, 0, 15);
      if (this.b) {
        i = 15 - i;
      }

      if (((Integer) iblockdata.get(BlockDaylightDetector.POWER)).intValue() != i) {
        i =
            org.bukkit.craftbukkit.event.CraftEventFactory.callRedstoneChange(
                    world,
                    blockposition.getX(),
                    blockposition.getY(),
                    blockposition.getZ(),
                    ((Integer) iblockdata.get(POWER)),
                    i)
                .getNewCurrent(); // CraftBukkit - Call BlockRedstoneEvent
        world.setTypeAndData(
            blockposition, iblockdata.set(BlockDaylightDetector.POWER, Integer.valueOf(i)), 3);
      }
    }
  }
예제 #6
0
  public void a(Packet18ArmAnimation packet18armanimation) {
    // CraftBukkit start
    if (this.player.dead) {
      return;
    }
    // CraftBukkit end

    if (packet18armanimation.b == 1) {
      // CraftBukkit start - raytrace to look for 'rogue armswings'
      float f = 1.0F;
      float f1 = this.player.lastPitch + (this.player.pitch - this.player.lastPitch) * f;
      float f2 = this.player.lastYaw + (this.player.yaw - this.player.lastYaw) * f;
      double d0 = this.player.lastX + (this.player.locX - this.player.lastX) * (double) f;
      double d1 =
          this.player.lastY
              + (this.player.locY - this.player.lastY) * (double) f
              + 1.62D
              - (double) this.player.height;
      double d2 = this.player.lastZ + (this.player.locZ - this.player.lastZ) * (double) f;
      Vec3D vec3d = Vec3D.create(d0, d1, d2);

      float f3 = MathHelper.cos(-f2 * 0.017453292F - 3.1415927F);
      float f4 = MathHelper.sin(-f2 * 0.017453292F - 3.1415927F);
      float f5 = -MathHelper.cos(-f1 * 0.017453292F);
      float f6 = MathHelper.sin(-f1 * 0.017453292F);
      float f7 = f4 * f5;
      float f8 = f3 * f5;
      double d3 = 5.0D;
      Vec3D vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3);
      MovingObjectPosition movingobjectposition = this.player.world.rayTrace(vec3d, vec3d1, true);

      if (movingobjectposition == null || movingobjectposition.type != EnumMovingObjectType.TILE) {
        CraftEventFactory.callPlayerInteractEvent(
            this.player, Action.LEFT_CLICK_AIR, this.player.inventory.getItemInHand());
      }

      // Arm swing animation
      Player player = getPlayer();
      PlayerAnimationEvent event = new PlayerAnimationEvent(player);
      server.getPluginManager().callEvent(event);
      // CraftBukkit end

      this.player.k_();
    }
  }
예제 #7
0
  private double r(int i) {
    if (i <= 0) {
      return this.locX;
    } else {
      float f = (this.aN + (float) (180 * (i - 1))) / 180.0F * 3.1415927F;
      float f1 = MathHelper.cos(f);

      return this.locX + (double) f1 * 1.3D;
    }
  }
예제 #8
0
파일: Vec3D.java 프로젝트: Chocanto/mc-dev
  public void b(float f) {
    float f1 = MathHelper.cos(f);
    float f2 = MathHelper.sin(f);
    double d0 = this.a * (double) f1 + this.c * (double) f2;
    double d1 = this.b;
    double d2 = this.c * (double) f1 - this.a * (double) f2;

    this.a = d0;
    this.b = d1;
    this.c = d2;
  }
예제 #9
0
  protected MovingObjectPosition a(World world, EntityHuman entityhuman, boolean flag) {
    float f = 1.0F;
    float f1 = entityhuman.lastPitch + (entityhuman.pitch - entityhuman.lastPitch) * f;
    float f2 = entityhuman.lastYaw + (entityhuman.yaw - entityhuman.lastYaw) * f;
    double d0 = entityhuman.lastX + (entityhuman.locX - entityhuman.lastX) * (double) f;
    double d1 =
        entityhuman.lastY
            + (entityhuman.locY - entityhuman.lastY) * (double) f
            + 1.62D
            - (double) entityhuman.height;
    double d2 = entityhuman.lastZ + (entityhuman.locZ - entityhuman.lastZ) * (double) f;
    Vec3D vec3d = Vec3D.a(d0, d1, d2);
    float f3 = MathHelper.cos(-f2 * 0.017453292F - 3.1415927F);
    float f4 = MathHelper.sin(-f2 * 0.017453292F - 3.1415927F);
    float f5 = -MathHelper.cos(-f1 * 0.017453292F);
    float f6 = MathHelper.sin(-f1 * 0.017453292F);
    float f7 = f4 * f5;
    float f8 = f3 * f5;
    double d3 = 5.0D;
    Vec3D vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3);

    return world.rayTrace(vec3d, vec3d1, flag, !flag, false);
  }
예제 #10
0
  public Vec3D j(float f) {
    float f1;
    float f2;
    float f3;
    float f4;

    if (f == 1.0F) {
      f1 = MathHelper.cos(-this.yaw * 0.017453292F - 3.1415927F);
      f2 = MathHelper.sin(-this.yaw * 0.017453292F - 3.1415927F);
      f3 = -MathHelper.cos(-this.pitch * 0.017453292F);
      f4 = MathHelper.sin(-this.pitch * 0.017453292F);
      return this.world.getVec3DPool().create((double) (f2 * f3), (double) f4, (double) (f1 * f3));
    } else {
      f1 = this.lastPitch + (this.pitch - this.lastPitch) * f;
      f2 = this.lastYaw + (this.yaw - this.lastYaw) * f;
      f3 = MathHelper.cos(-f2 * 0.017453292F - 3.1415927F);
      f4 = MathHelper.sin(-f2 * 0.017453292F - 3.1415927F);
      float f5 = -MathHelper.cos(-f1 * 0.017453292F);
      float f6 = MathHelper.sin(-f1 * 0.017453292F);

      return this.world.getVec3DPool().create((double) (f4 * f5), (double) f6, (double) (f3 * f5));
    }
  }
예제 #11
0
  protected void be() {
    this.motY = 0.41999998688697815D;
    if (this.hasEffect(MobEffectList.JUMP)) {
      this.motY +=
          (double) ((float) (this.getEffect(MobEffectList.JUMP).getAmplifier() + 1) * 0.1F);
    }

    if (this.isSprinting()) {
      float f = this.yaw * 0.017453292F;

      this.motX -= (double) (MathHelper.sin(f) * 0.2F);
      this.motZ += (double) (MathHelper.cos(f) * 0.2F);
    }

    this.an = true;
  }
예제 #12
0
  public void ab() {
    super.ab();
    if (this.bM > 0.0F) {
      float f = MathHelper.sin(this.aM * 3.1415927F / 180.0F);
      float f1 = MathHelper.cos(this.aM * 3.1415927F / 180.0F);
      float f2 = 0.7F * this.bM;
      float f3 = 0.15F * this.bM;

      this.passenger.setPosition(
          this.locX + (double) (f2 * f),
          this.locY + this.ad() + this.passenger.ac() + (double) f3,
          this.locZ - (double) (f2 * f1));
      if (this.passenger instanceof EntityLiving) {
        ((EntityLiving) this.passenger).aM = this.aM;
      }
    }
  }
예제 #13
0
  public void a(float f, float f1, float f2) {
    float f3 = MathHelper.c(f * f + f1 * f1);

    if (f3 >= 0.01F) {
      if (f3 < 1.0F) {
        f3 = 1.0F;
      }

      f3 = f2 / f3;
      f *= f3;
      f1 *= f3;
      float f4 = MathHelper.sin(this.yaw * 3.1415927F / 180.0F);
      float f5 = MathHelper.cos(this.yaw * 3.1415927F / 180.0F);

      this.motX += (double) (f * f5 - f1 * f4);
      this.motZ += (double) (f1 * f5 + f * f4);
    }
  }
예제 #14
0
  public void die(DamageSource damagesource) {
    super.die(damagesource);
    this.b(0.2F, 0.2F);
    this.setPosition(this.locX, this.locY, this.locZ);
    this.motY = 0.10000000149011612D;
    if (this.name.equals("Notch")) {
      this.a(new ItemStack(Item.APPLE, 1), true);
    }

    this.inventory.k();
    if (damagesource != null) {
      this.motX = (double) (-MathHelper.cos((this.au + this.yaw) * 3.1415927F / 180.0F) * 0.1F);
      this.motZ = (double) (-MathHelper.sin((this.au + this.yaw) * 3.1415927F / 180.0F) * 0.1F);
    } else {
      this.motX = this.motZ = 0.0D;
    }

    this.height = 0.1F;
    this.a(StatisticList.y, 1);
  }
예제 #15
0
  public boolean m(Entity entity) {
    int i = this.c(entity);

    if (this.hasEffect(MobEffectList.INCREASE_DAMAGE)) {
      i += 3 << this.getEffect(MobEffectList.INCREASE_DAMAGE).getAmplifier();
    }

    if (this.hasEffect(MobEffectList.WEAKNESS)) {
      i -= 2 << this.getEffect(MobEffectList.WEAKNESS).getAmplifier();
    }

    int j = 0;

    if (entity instanceof EntityLiving) {
      i += EnchantmentManager.a((EntityLiving) this, (EntityLiving) entity);
      j += EnchantmentManager.getKnockbackEnchantmentLevel(this, (EntityLiving) entity);
    }

    boolean flag = entity.damageEntity(DamageSource.mobAttack(this), i);

    if (flag) {
      if (j > 0) {
        entity.g(
            (double) (-MathHelper.sin(this.yaw * 3.1415927F / 180.0F) * (float) j * 0.5F),
            0.1D,
            (double) (MathHelper.cos(this.yaw * 3.1415927F / 180.0F) * (float) j * 0.5F));
        this.motX *= 0.6D;
        this.motZ *= 0.6D;
      }

      int k = EnchantmentManager.getFireAspectEnchantmentLevel(this);

      if (k > 0) {
        entity.setOnFire(k * 4);
      }
    }

    return flag;
  }
예제 #16
0
  public void attack(Entity entity) {
    if (entity.k_()) {
      int i = this.inventory.a(entity);

      if (this.hasEffect(MobEffectList.INCREASE_DAMAGE)) {
        i += 3 << this.getEffect(MobEffectList.INCREASE_DAMAGE).getAmplifier();
      }

      if (this.hasEffect(MobEffectList.WEAKNESS)) {
        i -= 2 << this.getEffect(MobEffectList.WEAKNESS).getAmplifier();
      }

      int j = 0;
      int k = 0;

      if (entity instanceof EntityLiving) {
        k = EnchantmentManager.a(this.inventory, (EntityLiving) entity);
        j += EnchantmentManager.getKnockbackEnchantmentLevel(this.inventory, (EntityLiving) entity);
      }

      if (this.isSprinting()) {
        ++j;
      }

      if (i > 0 || k > 0) {
        boolean flag =
            this.fallDistance > 0.0F
                && !this.onGround
                && !this.t()
                && !this.aU()
                && !this.hasEffect(MobEffectList.BLINDNESS)
                && this.vehicle == null
                && entity instanceof EntityLiving;

        if (flag) {
          i += this.random.nextInt(i / 2 + 2);
        }

        i += k;
        boolean flag1 = entity.damageEntity(DamageSource.playerAttack(this), i);

        if (flag1) {
          if (j > 0) {
            entity.b_(
                (double) (-MathHelper.sin(this.yaw * 3.1415927F / 180.0F) * (float) j * 0.5F),
                0.1D,
                (double) (MathHelper.cos(this.yaw * 3.1415927F / 180.0F) * (float) j * 0.5F));
            this.motX *= 0.6D;
            this.motZ *= 0.6D;
            this.setSprinting(false);
          }

          if (flag) {
            this.c(entity);
          }

          if (k > 0) {
            this.d(entity);
          }

          if (i >= 18) {
            this.a((Statistic) AchievementList.E);
          }

          this.g(entity);
        }

        ItemStack itemstack = this.U();

        if (itemstack != null && entity instanceof EntityLiving) {
          itemstack.a((EntityLiving) entity, this);
          if (itemstack.count <= 0) {
            itemstack.a(this);
            this.V();
          }
        }

        if (entity instanceof EntityLiving) {
          if (entity.isAlive()) {
            this.a((EntityLiving) entity, true);
          }

          this.a(StatisticList.w, i);
          int l =
              EnchantmentManager.getFireAspectEnchantmentLevel(
                  this.inventory, (EntityLiving) entity);

          if (l > 0) {
            entity.setOnFire(l * 4);
          }
        }

        this.c(0.3F);
      }
    }
  }
예제 #17
0
  public void collide(Entity entity) {
    if (!this.world.isStatic) {
      if (entity != this.passenger) {
        if (entity instanceof EntityLiving
            && !(entity instanceof EntityHuman)
            && !(entity instanceof EntityIronGolem)
            && this.type == 0
            && this.motX * this.motX + this.motZ * this.motZ > 0.01D
            && this.passenger == null
            && entity.vehicle == null) {
          entity.mount(this);
        }

        double d0 = entity.locX - this.locX;
        double d1 = entity.locZ - this.locZ;
        double d2 = d0 * d0 + d1 * d1;

        if (d2 >= 9.999999747378752E-5D) {
          d2 = (double) MathHelper.sqrt(d2);
          d0 /= d2;
          d1 /= d2;
          double d3 = 1.0D / d2;

          if (d3 > 1.0D) {
            d3 = 1.0D;
          }

          d0 *= d3;
          d1 *= d3;
          d0 *= 0.10000000149011612D;
          d1 *= 0.10000000149011612D;
          d0 *= (double) (1.0F - this.Z);
          d1 *= (double) (1.0F - this.Z);
          d0 *= 0.5D;
          d1 *= 0.5D;
          if (entity instanceof EntityMinecart) {
            double d4 = entity.locX - this.locX;
            double d5 = entity.locZ - this.locZ;
            Vec3D vec3d = this.world.getVec3DPool().create(d4, 0.0D, d5).a();
            Vec3D vec3d1 =
                this.world
                    .getVec3DPool()
                    .create(
                        (double) MathHelper.cos(this.yaw * 3.1415927F / 180.0F),
                        0.0D,
                        (double) MathHelper.sin(this.yaw * 3.1415927F / 180.0F))
                    .a();
            double d6 = Math.abs(vec3d.b(vec3d1));

            if (d6 < 0.800000011920929D) {
              return;
            }

            double d7 = entity.motX + this.motX;
            double d8 = entity.motZ + this.motZ;

            if (((EntityMinecart) entity).type == 2 && this.type != 2) {
              this.motX *= 0.20000000298023224D;
              this.motZ *= 0.20000000298023224D;
              this.g(entity.motX - d0, 0.0D, entity.motZ - d1);
              entity.motX *= 0.949999988079071D;
              entity.motZ *= 0.949999988079071D;
            } else if (((EntityMinecart) entity).type != 2 && this.type == 2) {
              entity.motX *= 0.20000000298023224D;
              entity.motZ *= 0.20000000298023224D;
              entity.g(this.motX + d0, 0.0D, this.motZ + d1);
              this.motX *= 0.949999988079071D;
              this.motZ *= 0.949999988079071D;
            } else {
              d7 /= 2.0D;
              d8 /= 2.0D;
              this.motX *= 0.20000000298023224D;
              this.motZ *= 0.20000000298023224D;
              this.g(d7 - d0, 0.0D, d8 - d1);
              entity.motX *= 0.20000000298023224D;
              entity.motZ *= 0.20000000298023224D;
              entity.g(d7 + d0, 0.0D, d8 + d1);
            }
          } else {
            this.g(-d0, 0.0D, -d1);
            entity.g(d0 / 4.0D, 0.0D, d1 / 4.0D);
          }
        }
      }
    }
  }
  public void collide(Entity var1) {
    if (!this.world.isClientSide) {
      if (!var1.noclip && !this.noclip) {
        if (var1 != this.passenger) {
          if (var1 instanceof EntityLiving
              && !(var1 instanceof EntityHuman)
              && !(var1 instanceof EntityIronGolem)
              && this.s() == EntityMinecartAbstract.EnumMinecartType.RIDEABLE
              && this.motX * this.motX + this.motZ * this.motZ > 0.01D
              && this.passenger == null
              && var1.vehicle == null) {
            var1.mount(this);
          }

          double var2 = var1.locX - this.locX;
          double var4 = var1.locZ - this.locZ;
          double var6 = var2 * var2 + var4 * var4;
          if (var6 >= 9.999999747378752E-5D) {
            var6 = (double) MathHelper.sqrt(var6);
            var2 /= var6;
            var4 /= var6;
            double var8 = 1.0D / var6;
            if (var8 > 1.0D) {
              var8 = 1.0D;
            }

            var2 *= var8;
            var4 *= var8;
            var2 *= 0.10000000149011612D;
            var4 *= 0.10000000149011612D;
            var2 *= (double) (1.0F - this.U);
            var4 *= (double) (1.0F - this.U);
            var2 *= 0.5D;
            var4 *= 0.5D;
            if (var1 instanceof EntityMinecartAbstract) {
              double var10 = var1.locX - this.locX;
              double var12 = var1.locZ - this.locZ;
              Vec3D var14 = (new Vec3D(var10, 0.0D, var12)).a();
              Vec3D var15 =
                  (new Vec3D(
                          (double) MathHelper.cos(this.yaw * 3.1415927F / 180.0F),
                          0.0D,
                          (double) MathHelper.sin(this.yaw * 3.1415927F / 180.0F)))
                      .a();
              double var16 = Math.abs(var14.b(var15));
              if (var16 < 0.800000011920929D) {
                return;
              }

              double var18 = var1.motX + this.motX;
              double var20 = var1.motZ + this.motZ;
              if (((EntityMinecartAbstract) var1).s()
                      == EntityMinecartAbstract.EnumMinecartType.FURNACE
                  && this.s() != EntityMinecartAbstract.EnumMinecartType.FURNACE) {
                this.motX *= 0.20000000298023224D;
                this.motZ *= 0.20000000298023224D;
                this.g(var1.motX - var2, 0.0D, var1.motZ - var4);
                var1.motX *= 0.949999988079071D;
                var1.motZ *= 0.949999988079071D;
              } else if (((EntityMinecartAbstract) var1).s()
                      != EntityMinecartAbstract.EnumMinecartType.FURNACE
                  && this.s() == EntityMinecartAbstract.EnumMinecartType.FURNACE) {
                var1.motX *= 0.20000000298023224D;
                var1.motZ *= 0.20000000298023224D;
                var1.g(this.motX + var2, 0.0D, this.motZ + var4);
                this.motX *= 0.949999988079071D;
                this.motZ *= 0.949999988079071D;
              } else {
                var18 /= 2.0D;
                var20 /= 2.0D;
                this.motX *= 0.20000000298023224D;
                this.motZ *= 0.20000000298023224D;
                this.g(var18 - var2, 0.0D, var20 - var4);
                var1.motX *= 0.20000000298023224D;
                var1.motZ *= 0.20000000298023224D;
                var1.g(var18 + var2, 0.0D, var20 + var4);
              }
            } else {
              this.g(-var2, 0.0D, -var4);
              var1.g(var2 / 4.0D, 0.0D, var4 / 4.0D);
            }
          }
        }
      }
    }
  }
예제 #19
0
  public void e(float f, float f1) {
    if (this.passenger != null && this.passenger instanceof EntityLiving && this.cu()) {
      this.lastYaw = this.yaw = this.passenger.yaw;
      this.pitch = this.passenger.pitch * 0.5F;
      this.b(this.yaw, this.pitch);
      this.aO = this.aM = this.yaw;
      f = ((EntityLiving) this.passenger).bd * 0.5F;
      f1 = ((EntityLiving) this.passenger).be;
      if (f1 <= 0.0F) {
        f1 *= 0.25F;
        this.bP = 0;
      }

      if (this.onGround && this.bt == 0.0F && this.cn() && !this.bI) {
        f = 0.0F;
        f1 = 0.0F;
      }

      if (this.bt > 0.0F && !this.cj() && this.onGround) {
        this.motY = this.getJumpStrength() * (double) this.bt;
        if (this.hasEffect(MobEffectList.JUMP)) {
          this.motY +=
              (double) ((float) (this.getEffect(MobEffectList.JUMP).getAmplifier() + 1) * 0.1F);
        }

        this.j(true);
        this.al = true;
        if (f1 > 0.0F) {
          float f2 = MathHelper.sin(this.yaw * 3.1415927F / 180.0F);
          float f3 = MathHelper.cos(this.yaw * 3.1415927F / 180.0F);

          this.motX += (double) (-0.4F * f2 * this.bt);
          this.motZ += (double) (0.4F * f3 * this.bt);
          this.makeSound("mob.horse.jump", 0.4F, 1.0F);
        }

        this.bt = 0.0F;
      }

      this.W = 1.0F;
      this.aQ = this.bk() * 0.1F;
      if (!this.world.isStatic) {
        this.i((float) this.getAttributeInstance(GenericAttributes.d).getValue());
        super.e(f, f1);
      }

      if (this.onGround) {
        this.bt = 0.0F;
        this.j(false);
      }

      this.aE = this.aF;
      double d0 = this.locX - this.lastX;
      double d1 = this.locZ - this.lastZ;
      float f4 = MathHelper.sqrt(d0 * d0 + d1 * d1) * 4.0F;

      if (f4 > 1.0F) {
        f4 = 1.0F;
      }

      this.aF += (f4 - this.aF) * 0.4F;
      this.aG += this.aF;
    } else {
      this.W = 0.5F;
      this.aQ = 0.02F;
      super.e(f, f1);
    }
  }