Block break on explosion

Discussion in 'Plugin Development' started by rsod, May 16, 2014.

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

    rsod

    Hello, I need an event which triggers when creeper or tnt or anything else explodes and exploded block is dropping as item. Thanks.
    A goal of this is override what will drop from block (I'm doing so golden ore drops couple nuggets instead of itself)
     
  2. Offline

    tommycake50

    I believe there's an event for creepers and TNT blowing up in which you are able to get the blocks destroyed by the blast.
    Try EntityCombustEvent.
     
  3. Offline

    rsod

    I also belive there should be such event, I just need the name, I can't find it.
    EntityExplodeEvent provides list of exploded blocks and also percent of drops, but it doesn't return which blocks exactly will be dropped. EntityCombustEvent is definitely not that
     
  4. Offline

    tommycake50

    In which case I don't think there is such event unless there is event to get a dropped item(ItemSpawnEvent) and then get the reason it spawned which I believe you can't do or at least according to the javadocs it doesn't look like you can.
     
    rsod likes this.
  5. Offline

    rsod

    hmm, actually as I'm getting rid of golden ore at all, I think I can use ItemSpawnEvent. That's what I'll do, thanks for idea.
     
  6. Offline

    NathanWolf

    You can use EntityExplodeEvent for this, it even gives you a list of the affected blocks. Works for creepers and TNT.
     
  7. Offline

    rsod

    Affected blocks, but not blocks that will drop as items! Anyway doesn't matter as problem solved in another way.
     
  8. Offline

    NathanWolf

    Oh, hrm, yeah fair enough. Well I suppose you could track which blocks exploded and look for entities that spawn in the same location shortly after (I have a utility class that does this if you want to look)... But yeah I can see your problem.
     
Thread Status:
Not open for further replies.

Share This Page