Hello! I am looking to use an event of when TNT is dispensed from a dispenser, add the TNT to a hashmap of <Entity, Location>. (Location being the location of the TNT spawning). This sounds easy, use ExplosionPrimeEvent, or BlockDispenseEvent, or something along those lines. ExplosionPrimeEvent is not called right when TNT is dispensed and BlockDispenseEvent is only good for dispensing items from dispensers. I can use BlockDispenseEvent and check if the item is TNT, but I then can't get that TNT Entity and do anything with it, I can only use e.getItem(), which returns an ItemStack. Any thoughts?
I would instinctively think ExplosionPrimeEvent, what do you mean its not called right when TNT is dispensed? How long after..? I would have thought its called as soon as it's dispensed as TNT primes right after being shot out.
The ExplosionPrimeEvent is called the instant before the TNT explodes for some reason. In my opinion it is falsely named.
How about EntitySpawnEvent? There is a separate CreatureSpawnEvent, so potentially ESE will fire when TNT is primed as an entity in such case is created.
Just checked, CreatureSpawnEvent and EntitySpawnEvent do not get tiggered when TNT is dispensed or ignited.
@opd02 If you couldn't find anything better, you could check for all of the entities around the dispenser, cast the entity as TNTPrimed (after checking of course) and see how long it's lifetime has been and then add it to your hashmap Edit: Here's TNTPrimed, getFuseTicks() looks useful