Beispiel #1
0
  protected void a(Entity entity, float f) {
    if (entity instanceof EntityHuman) {
      if (f < 3.0F) {
        double d0 = entity.locX - this.locX;
        double d1 = entity.locZ - this.locZ;

        this.yaw = (float) (Math.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - 90.0F;
        this.b = true;
      }

      EntityHuman entityhuman = (EntityHuman) entity;

      if (entityhuman.bT() == null || !this.c(entityhuman.bT())) {
        this.target = null;
      }
    } else if (entity instanceof EntityAnimal) {
      EntityAnimal entityanimal = (EntityAnimal) entity;

      if (this.getAge() > 0 && entityanimal.getAge() < 0) {
        if ((double) f < 2.5D) {
          this.b = true;
        }
      } else if (this.love > 0 && entityanimal.love > 0) {
        if (entityanimal.target == null) {
          entityanimal.target = this;
        }

        if (entityanimal.target == this && (double) f < 3.5D) {
          ++entityanimal.love;
          ++this.love;
          ++this.e;
          if (this.e % 4 == 0) {
            this.world.addParticle(
                "heart",
                this.locX
                    + (double) (this.random.nextFloat() * this.width * 2.0F)
                    - (double) this.width,
                this.locY + 0.5D + (double) (this.random.nextFloat() * this.length),
                this.locZ
                    + (double) (this.random.nextFloat() * this.width * 2.0F)
                    - (double) this.width,
                0.0D,
                0.0D,
                0.0D);
          }

          if (this.e == 60) {
            this.b((EntityAnimal) entity);
          }
        } else {
          this.e = 0;
        }
      } else {
        this.e = 0;
        this.target = null;
      }
    }
  }
Beispiel #2
0
  private void b(EntityAnimal entityanimal) {
    EntityAgeable entityageable = this.createChild(entityanimal);

    if (entityageable != null) {
      this.setAge(6000);
      entityanimal.setAge(6000);
      this.love = 0;
      this.e = 0;
      this.target = null;
      entityanimal.target = null;
      entityanimal.e = 0;
      entityanimal.love = 0;
      entityageable.setAge(-24000);
      entityageable.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, this.pitch);

      for (int i = 0; i < 7; ++i) {
        double d0 = this.random.nextGaussian() * 0.02D;
        double d1 = this.random.nextGaussian() * 0.02D;
        double d2 = this.random.nextGaussian() * 0.02D;

        this.world.addParticle(
            "heart",
            this.locX
                + (double) (this.random.nextFloat() * this.width * 2.0F)
                - (double) this.width,
            this.locY + 0.5D + (double) (this.random.nextFloat() * this.length),
            this.locZ
                + (double) (this.random.nextFloat() * this.width * 2.0F)
                - (double) this.width,
            d0,
            d1,
            d2);
      }

      this.world.addEntity(entityageable);
    }
  }