What event does igniting TNT pull up?

Discussion in 'Plugin Development' started by OstlerDev, Jun 20, 2012.

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

    OstlerDev

    Hey so I am trying to create a plugin that instantly sets off tnt, the only part I am stuck at is how to detect when TNT is set off by redstone! I have tried RedstoneBlockEvent, but that does not pull up anything! What event should I be using to detect this?
     
  2. Offline

    Malikk

    ExplosionPrimeEvent
     
  3. Offline

    OstlerDev

    How would I set the ticks left on the TNT to be 0?
     
  4. Offline

    Malikk

    I would think you would get the entity, cast it to TNTPrimed, and then set it from there.

    Have a look at the Apidocs, tho, that will save you a LOT of these really simple questions...
     
  5. Offline

    EnvisionRed

  6. Offline

    OstlerDev

    I have been looking at the APIdocs... I am not stupid I could just not find the event that would call up when tnt gets set off...

    Also an ExplosionPrimeEvent only gets called when the TNT explodes... Is there any other events?
     
  7. Offline

    Malikk

    ...no, its called when any entity is primed to explode. Get the entity from that event, and set its ticks.
     
  8. Offline

    OstlerDev

    That is called right before the entity explodes, the java doc even says "Called when an entity has made a decision to explode." That is called the tick before it explodes.

    If your logic was correct then this should have worked.
    Code:
    public void ExplosionPrimeEvent(ExplosionPrimeEvent event) {
            log.info("[iTNT] There was a ExplosionPrimeEvent!");
            if (event.getClass() == TNTPrimed.class){
                TNTPrimed tnt = (TNTPrimed)event.getEntity();
                tnt.setFuseTicks(0);
            }
    }
    That does not work though, is there anyway to detect when redstone current interacts a TNT block?
     
  9. Nonono, your checking if the event's class is equal to TNT. You want to check if event.getEntity().getClass() == TNTPrimed.class
     
    Firefly likes this.
  10. Offline

    OstlerDev

    Thanks for letting me know of that, but the issue is that the ExplosionPrimeEvent is getting called up the tick before the explosion, not after it is primed via redstone.

    Does anybody know how to detect this?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 26, 2016
  11. Offline

    JxAxVxAx

    This Might Help You .

     
Thread Status:
Not open for further replies.

Share This Page