setFuseTicks for TNT not working?

Discussion in 'Plugin Development' started by thepaperboy99, Nov 17, 2013.

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

    thepaperboy99

    Hello Bukkit, So I tried to set the fuse ticks for primed TNT that I spawn, but it only works a bit. What I mean by that is, the TNT will do its little animation were it it will explode, but not do block damage, then will explode later. You can see what I mean by my code:

    Code:java
    1. @EventHandler
    2. public void onBombPlace(BlockPlaceEvent event){
    3. Player player = event.getPlayer();
    4. Block block = event.getBlock();
    5.  
    6. if(block.getType() == Material.STONE) {
    7. player.sendMessage("Placed tnt");
    8.  
    9. block.setType(Material.AIR);
    10. player.sendMessage("Set it to air");
    11.  
    12. TNTPrimed tnt = block.getWorld().spawn(block.getLocation(), TNTPrimed.class);
    13. tnt.setFuseTicks(1000);
    14. tnt.setIsIncendiary(false);
    15. player.sendMessage("Spawned it and set fuse ticks");
    16.  
    17.  
    18.  
    19. }
    20.  
    21. }
     
  2. Offline

    pope_on_dope

    it's because the TNT explosion animation is handled client side. while it looks like it blew up, it was not actually blowing up, it just preformed the animation that the server told your client to do.
     
  3. Offline

    Gater12

    thepaperboy99 Yeah the animation is client sided. You told the server to spawn the PrimedTNT --> Go does it's animation handled on the client side --> Explosion happens at somepoint which you told the plugin to tell the server to tell the PrimedTNT when to explode.
     
  4. Offline

    thepaperboy99

    Oh, I didn't know the primed TNT was client side. Thanks for telling me though. :)
     
Thread Status:
Not open for further replies.

Share This Page