[Tutorial] Get the block where a projectile Landed.

Discussion in 'Resources' started by DevRosemberg, Sep 22, 2013.

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

    MaximumFX

    Is this the same in Bukkit 1.7.4?
     
  2. Offline

    jmmalcolm3

  3. Offline

    Roelyboely12

    not working for me:
    Code:java
    1. public void MelonExplode(ProjectileHitEvent event)
    2. {
    3. BlockIterator iterator = new BlockIterator(event.getEntity().getWorld(), event.getEntity().getLocation().toVector(), event.getEntity().getVelocity().normalize(), 0.0D, 4);
    4. Block hitBlock = null;
    5. while (iterator.hasNext()) {
    6. hitBlock = iterator.next();
    7.  
    8. if (hitBlock.getType() != Material.AIR) {
    9. break;
    10. }
    11. }
    12.  
    13. if (hitBlock.getType() == Material.MELON_BLOCK) {
    14. hitBlock.getWorld().playEffect(hitBlock.getLocation(), Effect.STEP_SOUND, hitBlock.getType());
    15. hitBlock.setType(Material.AIR);
    16. }
    17. }
     
  4. Offline

    DevRosemberg

    Roelyboely12 Did you register the event and add @EventHandler?
     
  5. Offline

    Roelyboely12

    DevRosemberg forget the @EventHandler sorry. It works great!!! Love it!
     
  6. Offline

    RoboticPlayer

    I want this to work on all blocks, and when the arrow lands, set the block to primed tnt. How would I do this?

    I just tested it out as a spleef tool, and it doesn't work. My only error is a warning that the block.getTypeId() is deprecated.
    My code: http://pastebin.com/pQXARihJ
    (Note that I want to use this as a plugin for arrows that turn into primed tnt when they land)
     
    Last edited by a moderator: Jan 5, 2015
  7. Offline

    eyamaz

    You should post this and ask for help in Plugin Development instead of necroing a tut. Thread is locked.
     
Thread Status:
Not open for further replies.

Share This Page