예제 #1
0
  public void die() {
    int i = this.getSize();

    if (!this.world.isStatic && i > 1 && this.getHealth() <= 0) {
      int j = 2 + this.random.nextInt(3);

      // CraftBukkit start
      org.bukkit.event.entity.SlimeSplitEvent event =
          new org.bukkit.event.entity.SlimeSplitEvent(this.getBukkitEntity(), j);
      this.world.getServer().getPluginManager().callEvent(event);

      if (!event.isCancelled() && event.getCount() > 0) {
        j = event.getCount();
      } else {
        super.die();
        return;
      }
      // CraftBukkit end

      for (int k = 0; k < j; ++k) {
        float f = ((float) (k % 2) - 0.5F) * (float) i / 4.0F;
        float f1 = ((float) (k / 2) - 0.5F) * (float) i / 4.0F;
        EntitySlime entityslime = this.y();

        entityslime.setSize(i / 2);
        entityslime.setPositionRotation(
            this.locX + (double) f,
            this.locY + 0.5D,
            this.locZ + (double) f1,
            this.random.nextFloat() * 360.0F,
            0.0F);
        this.world.addEntity(entityslime);
      }
    }

    super.die();
  }
예제 #2
0
  public void die() {
    int i = this.getSize();

    if (!this.world.isStatic && i > 1 && this.getHealth() <= 0) {
      int j = 2 + this.random.nextInt(3);

      for (int k = 0; k < j; ++k) {
        float f = ((float) (k % 2) - 0.5F) * (float) i / 4.0F;
        float f1 = ((float) (k / 2) - 0.5F) * (float) i / 4.0F;
        EntitySlime entityslime = this.i();

        entityslime.setSize(i / 2);
        entityslime.setPositionRotation(
            this.locX + (double) f,
            this.locY + 0.5D,
            this.locZ + (double) f1,
            this.random.nextFloat() * 360.0F,
            0.0F);
        this.world.addEntity(entityslime);
      }
    }

    super.die();
  }