Solved How to change the fuse time on tnt

Discussion in 'Plugin Development' started by satarskrin, Oct 22, 2016.

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

    satarskrin

    i have this
    Code:
            EntityType tnt = EntityType.PRIMED_TNT;
    how do i change the fuse time?
     
  2. Offline

    timtower Administrator Administrator Moderator

    @satarskrin Spawn an entity first, then you can change it
     
  3. Offline

    XxTimexX

  4. Offline

    satarskrin

    @timtower
    now i spawned it but what do i do now?
    Code:
            world.spawnEntity(loc, EntityType.PRIMED_TNT);
     
  5. Offline

    timtower Administrator Administrator Moderator

    @satarskrin You cast it to an EntityPrimed, then you call the method above your post
     
  6. Offline

    satarskrin

    how do i cast it to an EntityPrimed?
    @timtower
     
  7. Offline

    timtower Administrator Administrator Moderator

    @satarskrin Like any casting that you do in Java.
    Called "Class casting"
     
  8. Offline

    satarskrin

    @timtower
    Yes i knowe how to cast but what do i do here?
    Code:
            EntityType tnt = EntityType.PRIMED_TNT;
            world.spawnEntity(loc, tnt);
            Entity tnt2 = ??
     
  9. Offline

    timtower Administrator Administrator Moderator

    @satarskrin Did you check the return value of spawnEntity?
     
  10. Offline

    satarskrin

    i did get it to work i just did somthing

    Final Code

    Code:
            Entity tnt = world.spawnEntity(loc, EntityType.PRIMED_TNT);
            TNTPrimed tnt2 = (TNTPrimed) tnt;
            tnt2.setFuseTicks(1000);
     
Thread Status:
Not open for further replies.

Share This Page