Solved Fiery Snowball Explosion

Discussion in 'Plugin Development' started by w84u2cy, Dec 10, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    w84u2cy

    So I've got this code:

    Code:java
    1. @EventHandler
    2. public void onProjectileHit(ProjectileHitEvent e) {
    3. Projectile p = e.getEntity();
    4. if (!(p instanceof Snowball)) return;
    5. Snowball s = (Snowball) p;
    6. s.getWorld().createExplosion(s.getLocation(), 8.0F);
    7. for (Entity en : s.getNearbyEntities(10, 10, 10)) {
    8. if (en instanceof Player) {
    9. Player pl = (Player) en;
    10. Location loc = pl.getLocation();
    11. pl.playSound(loc, Sound.AMBIENCE_THUNDER, 1, 10);
    12. pl.playSound(loc, Sound.BREATH, 1, 10);
    13. pl.playSound(loc, Sound.EXPLODE, 1, 10);
    14. pl.playSound(loc, Sound.FIRE_IGNITE, 1, 10);
    15. pl.playSound(loc, Sound.FIREWORK_TWINKLE, 1, 10);
    16. pl.playSound(loc, Sound.FIREWORK_BLAST, 1, 10);
    17. pl.playSound(loc, Sound.AMBIENCE_THUNDER, 1, 10);
    18. pl.playSound(loc, Sound.FIZZ, 1, 10);


    And i can't find a way to make fire spawn in a radius around it.
    If anyone can help please do!

    Thanks
     
  2. Offline

    fireblast709

    w84u2cy Do you mean the fire particles? Those are
    Code:
    Effect.MOBSPAWNER_FLAMES
    , which you play with Player#playEffect(Location,Effect,T) (T being a variable depending on the effect, I believe this is an int with this specific effect)
     
  3. Offline

    rocket138

    Try this:
    Code:java
    1. s.getWorld().createExplosion(s.getLocation(), 8.0F, true);

    That should spawn fire
     
  4. Offline

    w84u2cy

    Sorry,
    I meant actual fire

    Thanks so much! It worked

    May death rain upon them [tnt] :p

    Thanks

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 5, 2016
Thread Status:
Not open for further replies.

Share This Page