Ejemplo n.º 1
0
  public void hurt(Entity cause, int damage) {
    if (this.hasFur && cause instanceof Player) {
      this.hasFur = false;
      int wool = (int) (Math.random() * 3.0D + 1.0D);

      for (int count = 0; count < wool; ++count) {
        this.level.addEntity(
            new Item(this.level, this.x, this.y, this.z, VanillaBlock.WHITE_CLOTH.getId()));
      }

    } else {
      super.hurt(cause, damage);
    }
  }
Ejemplo n.º 2
0
  public void die(Entity cause) {
    if (cause != null) {
      cause.awardKillScore(this, 10);
    }

    int drops = (int) (Math.random() + Math.random() + 1.0D);

    for (int count = 0; count < drops; ++count) {
      this.level.addEntity(
          new Item(this.level, this.x, this.y, this.z, VanillaBlock.WHITE_CLOTH.getId()));
    }

    super.die(cause);
  }