Example #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() {
    super.onLivingUpdate();

    if (this.getGrowingAge() != 0) {
      this.inLove = 0;
    }

    if (this.inLove > 0) {
      --this.inLove;

      if (this.inLove % 10 == 0) {
        double var1 = this.rand.nextGaussian() * 0.02D;
        double var3 = this.rand.nextGaussian() * 0.02D;
        double var5 = this.rand.nextGaussian() * 0.02D;
        this.worldObj.spawnParticle(
            EnumParticleTypes.HEART,
            this.posX + (double) (this.rand.nextFloat() * this.width * 2.0F) - (double) this.width,
            this.posY + 0.5D + (double) (this.rand.nextFloat() * this.height),
            this.posZ + (double) (this.rand.nextFloat() * this.width * 2.0F) - (double) this.width,
            var1,
            var3,
            var5,
            new int[0]);
      }
    }
  }