Checking blocks in a exploded TNT's radius

Discussion in 'Plugin Development' started by EpicCraft21, Jan 8, 2015.

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

    EpicCraft21

    Hey guys, so I'm trying to make a plugin that allows obsidian to be blown up. How do I check when a TNT blows up, it finds all blocks in the explosion radius?

    For example: In a Flatland, TNT blows up, and the code finds the blocks it blew up(in this case dirt and grass) and stores it?

    If someone could help me with this I would be very Grateful!
    Thank you!

    BTW: I don't have much code so far, just empty code, so it would be a bit pointless to post it.
     
  2. Offline

    Larry Newman

  3. Offline

    Bloxcraft

    EntityExplodeEvent has a .blockList() method that returns all the blocks exploded by the explosion.
     
  4. Offline

    EpicCraft21

    Ok thanks! I will try this!
     
  5. Offline

    EpicCraft21

    But how do i give the obsidian health? Like tnt explodes three times near obsidian and then it breaks.
     
  6. Offline

    InfamousSheep

    Save the blocks in a hashmap with an integer key as the health. If the obsidian is already in the hashmap when damage is done, take away 1 from the int value until it's 0.
     
  7. Offline

    EpicCraft21

    Ok! Thanks for the quick reply!
     
Thread Status:
Not open for further replies.

Share This Page