Solved Location where Snowball/Egg hits the ground?

Discussion in 'Plugin Development' started by Regenwurm97, Apr 21, 2013.

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

    Regenwurm97

    Hey ;)

    I wondered if theres an event that registers when you throw a snowball or egg (thought about the projectile one but not sure) and that registers when the ball or egg kinda "explodes"
    (you know the particles that appear when an egg or snowball hits the ground? Thats what I mean)

    I'd need it for making like grenades and many other stuff
     
  2. Offline

    Chinwe

    Pretty sure that would be ProjectileHitEvent, and then check if event.getEntity().getEntityType().equals(EntityType.SNOWBALL) or something like that?
     
  3. Offline

    Regenwurm97

    Will test it but sounds good
     
  4. Offline

    kreashenz

    To create an explosion non - incendiary and that doesn't break blocks on the ProjectileHitEvent :
    Code:java
    1. @EventHandler
    2. public void onAirstrikeHit(ProjectileHitEvent e){
    3. Entity ent = e.getEntity();
    4. if(ent instanceof Snowball){
    5. Location loc = ent.getLocation();
    6. ent.getWorld().createExplosion(loc.getX(), loc.getY(), loc.getZ(), 3F, false, false);
    7. }
    8. }
     
  5. Offline

    Regenwurm97

    Works fine, thanks! :D
     
  6. Offline

    kreashenz

    Regenwurm97 Please set this to solved if your problem is solved :) Thanks.
     
  7. Offline

    Regenwurm97

    Ummm....how can I do so? ;)
     
Thread Status:
Not open for further replies.

Share This Page