Shoot item tnt

Discussion in 'Spigot Plugin Development' started by Snowmite, Jun 9, 2016.

  1. So I am trying to make a plugin where if you left click tnt, it will drop tnt that has a velocity to look like it's shot, and when the tnt touches a block, it creates an explosion. I got as far as listing all the chunks and checking if it's the same as the dropped tnt's chunk, but got stuck where to get the blocks in the chunk. All I need is way to get the blocks in that chunk and check if the blocks in the chunk's location from the dropped tnt is less than 1, then create an explosion.

    What I have so far: http://hastebin.com/zuxerecila.avrasm
     
  2. Instead of looping through all the blocks in the chunk, I would recommend using a runnable to track the location of the TNT, then see if the block below it's location is air. Much more efficient and compact.
     
    • Winner Winner x 1
  3. Thank you so much for the help! You were right! Using a runnable is wayyyy more efficient. Thank you again!
     
    • Friendly Friendly x 1