示例#1
0
  /**
   * Called frequently so the entity can update its state every tick as required. For example,
   * zombies and skeletons use this to react to sunlight and start to burn.
   */
  public void onLivingUpdate() {
    if (this.worldObj.isRemote) {
      this.sheepTimer = Math.max(0, this.sheepTimer - 1);
    }

    super.onLivingUpdate();
  }
示例#2
0
  /**
   * Called frequently so the entity can update its state every tick as required. For example,
   * zombies and skeletons use this to react to sunlight and start to burn.
   */
  public void onLivingUpdate() {
    super.onLivingUpdate();
    this.field_70888_h = this.field_70886_e;
    this.field_70884_g = this.destPos;
    this.destPos = (float) ((double) this.destPos + (double) (this.onGround ? -1 : 4) * 0.3D);

    if (this.destPos < 0.0F) {
      this.destPos = 0.0F;
    }

    if (this.destPos > 1.0F) {
      this.destPos = 1.0F;
    }

    if (!this.onGround && this.field_70889_i < 1.0F) {
      this.field_70889_i = 1.0F;
    }

    this.field_70889_i = (float) ((double) this.field_70889_i * 0.9D);

    if (!this.onGround && this.motionY < 0.0D) {
      this.motionY *= 0.6D;
    }

    this.field_70886_e += this.field_70889_i * 2.0F;

    if (!this.isChild() && !this.worldObj.isRemote && --this.timeUntilNextEgg <= 0) {
      this.playSound(
          "mob.chicken.plop", 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
      this.dropItem(Item.egg.itemID, 1);
      this.timeUntilNextEgg = this.rand.nextInt(6000) + 6000;
    }
  }
  /**
   * Called frequently so the entity can update its state every tick as required. For example,
   * zombies and skeletons use this to react to sunlight and start to burn.
   */
  public void onLivingUpdate() {
    if (this.rand.nextInt(200) == 0) {
      this.func_110210_cH();
    }

    super.onLivingUpdate();

    if (!this.worldObj.isRemote) {
      if (this.rand.nextInt(900) == 0 && this.deathTime == 0) {
        this.heal(1.0F);
      }

      if (!this.isEatingHaystack()
          && this.riddenByEntity == null
          && this.rand.nextInt(300) == 0
          && this.worldObj.getBlock(
                  MathHelper.floor_double(this.posX),
                  MathHelper.floor_double(this.posY) - 1,
                  MathHelper.floor_double(this.posZ))
              == Blocks.grass) {
        this.setEatingHaystack(true);
      }

      if (this.isEatingHaystack() && ++this.eatingHaystackCounter > 50) {
        this.eatingHaystackCounter = 0;
        this.setEatingHaystack(false);
      }

      if (this.func_110205_ce() && !this.isAdultHorse() && !this.isEatingHaystack()) {
        EntityHorse entityhorse = this.getClosestHorse(this, 16.0D);

        if (entityhorse != null && this.getDistanceSqToEntity(entityhorse) > 4.0D) {
          PathEntity pathentity =
              this.worldObj.getPathEntityToEntity(
                  this, entityhorse, 16.0F, true, false, false, true);
          this.setPathToEntity(pathentity);
        }
      }
    }
  }
 /**
  * Called frequently so the entity can update its state every tick as required. For example,
  * zombies and skeletons use this to react to sunlight and start to burn.
  */
 @Override
 public void onLivingUpdate() {
   super.onLivingUpdate();
 }