Solved TNT Fuse

Discussion in 'Plugin Development' started by PizzaPixel, Nov 1, 2013.

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

    PizzaPixel

    How would I change a TNT's fuse time. Then put the countdown in chat.

    And how would I make it when I use blaze powder on tnt the tnt turns in to prime tnt
     
  2. Offline

    tcvs

    PizzaPixel You would need a plugin... Not even sure if you can change tnt fuse.
     
  3. Offline

    PizzaPixel

    I found out how to change the fuse it's setfusetick

    But how would I make blaze powder ignite tnt
     
  4. Offline

    Necrodoom

    Moved to correct section.
     
  5. Offline

    PizzaPixel

    Cycryl I need help on making an item other than flint&steel that can ignite tnt
     
  6. Offline

    Cycryl

    I got some code together
    Code:java
    1. @EventHandler
    2. public void Command(PlayerInteractEvent event) {
    3. Player player = event.getPlayer();
    4. if(event.getAction().equals(Action.RIGHT_CLICK_BLOCK) && player.getItemInHand().getType().equals(Material.FLINT_AND_STEEL) && event.getClickedBlock().getType().equals(Material.TNT)){
    5. event.setCancelled(true);
    6. event.getClickedBlock().setType(Material.AIR);
    7. TNTPrimed tnt = (TNTPrimed) event.getClickedBlock().getWorld().spawn(event.getClickedBlock().getLocation().add(0, 1, 0), TNTPrimed.class);
    8. tnt.setFuseTicks(30);
    9. }
    10. }


    you can replace Material.FLINT_AND_STEEL with anything
     
  7. Offline

    PizzaPixel

    Cycryl Thank now one last thing how would I desactivate tnt prime with an item
     
  8. Offline

    Cycryl

    PizzaPixel
    this should work
    Code:java
    1. @EventHandler
    2. public void Command(PlayerInteractEntityEvent event) {
    3. Player player = event.getPlayer();
    4. if(player.getItemInHand().getType().equals(Material.SHEARS) && event.getRightClicked() instanceof TNTPrimed){
    5. TNTPrimed tnt = (TNTPrimed)event.getRightClicked();
    6. tnt.setFuseTicks(30);
    7. }
    8. }
     
  9. Offline

    PizzaPixel

    Cycryl Thank you but how does this cancel the primed tnt
     
  10. Offline

    tyler53


    You could just remove it and replace it with a regular block of TNT that is not primed
     
  11. Offline

    PizzaPixel

    This is for a mini game not just making it back to tnt
     
  12. Offline

    tyler53

    What do you mean it's not just making it back to TNT?

    You made it seem like what you wanted was to make it unprimed TNT, that would be regular TNT

    If you meant resetting the countdown of the fuse, then the answer is in the above posts
     
  13. Offline

    PizzaPixel

    I want that when you hit primed tnt with shears it turns to tnt but I want this to add it to a mini game plugin I'm making
     
  14. Offline

    tyler53

    So then just check if the TNT is primed when you hit it with shears, and if it is, replace that block with a TNT block that isn't primed
     
  15. Offline

    PizzaPixel

    How, can you show me the code
     
  16. Offline

    tyler53

  17. Offline

    PizzaPixel

    tyler53 Give me the link please
     
  18. Offline

    tyler53

    that was a link haha but if its only showing up as a video, click here
     
  19. Offline

    Cycryl

    PizzaPixel tyler53
    sorry i missunderstood you
    add this to the code and remove tnt.setfuse()
    Code:java
    1. tnt.getLocation().getBlock().setType(Material.TNT);
    2. tnt.remove();
     
Thread Status:
Not open for further replies.

Share This Page