Crazy Killer Ghasts

Discussion in 'Plugin Development' started by opd02, Mar 19, 2020.

  1. Offline

    opd02

    I am trying to give ghasts a make over and make them hard and challenging. I want to make their fireballs more explosive and possible get them to rapid fire fireballs. I know in the game you can summon fireballs with different ExplosionPower tags, but I cant seem to figure out how to edit it in code! Please help!
     
  2. Offline

    pietermantel

    To change the explosion power, you can get the fireball using an EntityExplodeEvent, check if it is a fireball, cast it to fireball, and use .setYield to change the power:
    Code:
    @EventHandler
    public void onEntityExplode(EntityExplodeEvent event) {
      if (event.getEntity() instanceof Fireball) {
        Fireball fireball = (Fireball) event.getEntity();
        fireball.setYield(10); // According to the javadoc, this is the radius
      }
    }
    I haven't tested it, so it might not work.
     
  3. Offline

    opd02

    Yup that worked! For anyone else who is curious, I then made a repeating task to summon a fireball at the ghast and set its vector to that of the original fireball.
    @pietermantel
     
    pietermantel likes this.

Share This Page