示例#1
0
  public void b_(EntityHuman entityhuman) {
    if (this.l()) {
      int i = this.getSize();

      if (this.n(entityhuman)
          && this.e(entityhuman) < 0.6D * (double) i * 0.6D * (double) i
          && entityhuman.damageEntity(DamageSource.mobAttack(this), this.m())) {
        this.makeSound(
            "mob.attack", 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
      }
    }
  }
示例#2
0
  public boolean m(Entity entity) {
    this.br = 10;
    this.world.broadcastEntityEffect(this, (byte) 4);
    boolean flag =
        entity.damageEntity(DamageSource.mobAttack(this), (float) (7 + this.random.nextInt(15)));

    if (flag) {
      entity.motY += 0.4000000059604645D;
    }

    this.makeSound("mob.irongolem.throw", 1.0F, 1.0F);
    return flag;
  }
  protected void a(MovingObjectPosition movingobjectposition) {
    if (!this.world.isStatic) {
      if (movingobjectposition.entity != null) {
        if (this.shooter != null) {
          if (movingobjectposition.entity.damageEntity(DamageSource.mobAttack(this.shooter), 8)
              && !movingobjectposition.entity.isAlive()) {
            this.shooter.heal(5, EntityRegainHealthEvent.RegainReason.WITHER); // CraftBukkit
          }
        } else {
          movingobjectposition.entity.damageEntity(DamageSource.MAGIC, 5);
        }

        if (movingobjectposition.entity instanceof EntityLiving) {
          byte b0 = 0;

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

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

      // CraftBukkit start
      ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 1.0F, false);
      this.world.getServer().getPluginManager().callEvent(event);

      if (!event.isCancelled()) {
        this.world.createExplosion(
            this,
            this.locX,
            this.locY,
            this.locZ,
            event.getRadius(),
            event.getFire(),
            this.world.getGameRules().getBoolean("mobGriefing"));
      }
      // CraftBukkit end

      this.die();
    }
  }
示例#4
0
  public void a_(EntityHuman entityhuman) {
    if (this.C()) {
      int i = this.getSize();

      if (this.g(entityhuman)
          && (double) this.h(entityhuman) < 0.6D * (double) i
          && entityhuman.damageEntity(DamageSource.mobAttack(this), this.D())) {
        this.world.makeSound(
            this,
            "mob.slimeattack",
            1.0F,
            (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
      }
    }
  }
  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;
  }
示例#6
0
  public boolean m(Entity entity) {
    float f = (float) this.getAttributeInstance(GenericAttributes.e).getValue();
    int i = 0;

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

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

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

      int j = EnchantmentManager.getFireAspectEnchantmentLevel(this);

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

      if (entity instanceof EntityLiving) {
        EnchantmentManager.a((EntityLiving) entity, (Entity) this);
      }

      EnchantmentManager.b(this, entity);
    }

    return flag;
  }
示例#7
0
 public boolean n(Entity entity) {
   return entity.damageEntity(DamageSource.mobAttack(this), 3.0F);
 }
示例#8
0
 public boolean attack(Entity entity, float f) {
   return this.attack(entity, DamageSource.mobAttack(this), f);
 }