Exemplo n.º 1
0
  /** Called to update the entity's position/logic. */
  public void onUpdate() {
    super.onUpdate();
    this.field_70924_f = this.field_70926_e;

    if (this.func_70922_bv()) {
      this.field_70926_e += (1.0F - this.field_70926_e) * 0.4F;
    } else {
      this.field_70926_e += (0.0F - this.field_70926_e) * 0.4F;
    }

    if (this.func_70922_bv()) {
      this.numTicksToChaseTarget = 10;
    }

    if (this.isWet()) {
      this.isShaking = true;
      this.field_70928_h = false;
      this.timeWolfIsShaking = 0.0F;
      this.prevTimeWolfIsShaking = 0.0F;
    } else if ((this.isShaking || this.field_70928_h) && this.field_70928_h) {
      if (this.timeWolfIsShaking == 0.0F) {
        this.playSound(
            "mob.wolf.shake",
            this.getSoundVolume(),
            (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
      }

      this.prevTimeWolfIsShaking = this.timeWolfIsShaking;
      this.timeWolfIsShaking += 0.05F;

      if (this.prevTimeWolfIsShaking >= 2.0F) {
        this.isShaking = false;
        this.field_70928_h = false;
        this.prevTimeWolfIsShaking = 0.0F;
        this.timeWolfIsShaking = 0.0F;
      }

      if (this.timeWolfIsShaking > 0.4F) {
        float var1 = (float) this.boundingBox.minY;
        int var2 = (int) (MathHelper.sin((this.timeWolfIsShaking - 0.4F) * (float) Math.PI) * 7.0F);

        for (int var3 = 0; var3 < var2; ++var3) {
          float var4 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F;
          float var5 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F;
          this.worldObj.spawnParticle(
              "splash",
              this.posX + (double) var4,
              (double) (var1 + 0.8F),
              this.posZ + (double) var5,
              this.motionX,
              this.motionY,
              this.motionZ);
        }
      }
    }
  }
  /** Called to update the entity's position/logic. */
  public void onUpdate() {
    if (!this.worldObj.isRemote && this.isConverting()) {
      int i = this.getConversionTimeBoost();
      this.conversionTime -= i;

      if (this.conversionTime <= 0) {
        this.convertToVillager();
      }
    }

    super.onUpdate();
  }
Exemplo n.º 3
0
  /** Called to update the entity's position/logic. */
  public void onUpdate() {
    super.onUpdate();
    this.field_70924_f = this.field_70926_e;

    if (this.isWet() && isStone() == 0) {
      this.isShaking = true;
      this.field_70928_h = false;
      this.timeWolfIsShaking = 0.0F;
      this.prevTimeWolfIsShaking = 0.0F;
    } else if (isStone() == 0 && (this.isShaking || this.field_70928_h) && this.field_70928_h) {
      if (this.timeWolfIsShaking == 0.0F) {
        this.playSound(
            "mob.wolf.shake",
            this.getSoundVolume(),
            (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
      }

      this.prevTimeWolfIsShaking = this.timeWolfIsShaking;
      this.timeWolfIsShaking += 0.05F;

      if (this.prevTimeWolfIsShaking >= 2.0F) {
        this.isShaking = false;
        this.field_70928_h = false;
        this.prevTimeWolfIsShaking = 0.0F;
        this.timeWolfIsShaking = 0.0F;
      }

      if (this.timeWolfIsShaking > 0.4F) {
        float f = (float) this.boundingBox.minY;
        int i = (int) (MathHelper.sin((this.timeWolfIsShaking - 0.4F) * (float) Math.PI) * 7.0F);

        for (int j = 0; j < i; ++j) {
          float f1 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F;
          float f2 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F;
          this.worldObj.spawnParticle(
              "splash",
              this.posX + (double) f1,
              (double) (f + 0.8F),
              this.posZ + (double) f2,
              this.motionX,
              this.motionY,
              this.motionZ);
        }
      }
    }
  }