Exemplo n.º 1
0
  public void setSprinting(boolean flag) {
    super.setSprinting(flag);
    AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.d);

    if (attributeinstance.a(b) != null) {
      attributeinstance.b(c);
    }

    if (flag) {
      attributeinstance.a(c);
    }
  }
Exemplo n.º 2
0
  public void e() {
    if (this.L()) {
      this.damageEntity(DamageSource.DROWN, 1.0F);
    }

    if (this.bu != this.target) {
      AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.d);

      attributeinstance.b(bq);
      if (this.target != null) {
        attributeinstance.a(bq);
      }
    }

    this.bu = this.target;
    int i;

    if (!this.world.isStatic && this.world.getGameRules().getBoolean("mobGriefing")) {
      int j;
      int k;
      Block block;

      if (this.getCarried().getMaterial() == Material.AIR) {
        if (this.random.nextInt(20) == 0) {
          i = MathHelper.floor(this.locX - 2.0D + this.random.nextDouble() * 4.0D);
          j = MathHelper.floor(this.locY + this.random.nextDouble() * 3.0D);
          k = MathHelper.floor(this.locZ - 2.0D + this.random.nextDouble() * 4.0D);
          block = this.world.getType(i, j, k);
          if (br[Block.getId(block)]) {
            this.setCarried(block);
            this.setCarriedData(this.world.getData(i, j, k));
            this.world.setTypeUpdate(i, j, k, Blocks.AIR);
          }
        }
      } else if (this.random.nextInt(2000) == 0) {
        i = MathHelper.floor(this.locX - 1.0D + this.random.nextDouble() * 2.0D);
        j = MathHelper.floor(this.locY + this.random.nextDouble() * 2.0D);
        k = MathHelper.floor(this.locZ - 1.0D + this.random.nextDouble() * 2.0D);
        block = this.world.getType(i, j, k);
        Block block1 = this.world.getType(i, j - 1, k);

        if (block.getMaterial() == Material.AIR
            && block1.getMaterial() != Material.AIR
            && block1.d()) {
          this.world.setTypeAndData(i, j, k, this.getCarried(), this.getCarriedData(), 3);
          this.setCarried(Blocks.AIR);
        }
      }
    }

    for (i = 0; i < 2; ++i) {
      this.world.addParticle(
          "portal",
          this.locX + (this.random.nextDouble() - 0.5D) * (double) this.width,
          this.locY + this.random.nextDouble() * (double) this.length - 0.25D,
          this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.width,
          (this.random.nextDouble() - 0.5D) * 2.0D,
          -this.random.nextDouble(),
          (this.random.nextDouble() - 0.5D) * 2.0D);
    }

    if (this.world.w() && !this.world.isStatic) {
      float f = this.d(1.0F);

      if (f > 0.5F
          && this.world.i(
              MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ))
          && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
        this.target = null;
        this.a(false);
        this.bv = false;
        this.bZ();
      }
    }

    if (this.L() || this.isBurning()) {
      this.target = null;
      this.a(false);
      this.bv = false;
      this.bZ();
    }

    if (this.cd() && !this.bv && this.random.nextInt(100) == 0) {
      this.a(false);
    }

    this.bc = false;
    if (this.target != null) {
      this.a(this.target, 100.0F, 100.0F);
    }

    if (!this.world.isStatic && this.isAlive()) {
      if (this.target != null) {
        if (this.target instanceof EntityHuman && this.f((EntityHuman) this.target)) {
          if (this.target.f((Entity) this) < 16.0D) {
            this.bZ();
          }

          this.bs = 0;
        } else if (this.target.f((Entity) this) > 256.0D
            && this.bs++ >= 30
            && this.c(this.target)) {
          this.bs = 0;
        }
      } else {
        this.a(false);
        this.bs = 0;
      }
    }

    super.e();
  }