Solved Spawn TNTPrimed glitch

Discussion in 'Plugin Development' started by Elytes, Jan 26, 2019.

Thread Status:
Not open for further replies.
  1. Hello !
    I have a problem with the TNTPRIMED, when I spawn the TNT, it is between several blocks, while the position is exact and is an integer(for example the position X:15 Y:10 Z:15 will be transformed to X:15.5 Y:10 Z:15.5 when the tnt appears).
    I tried to teleport it to the desired location but it doesn't seem to work, do you have a solution?
    Here is the code :
    World world = Bukkit.getWorld("world");
    TNTPrimed tnt = world.spawn(event.getBlock().getLocation(), TNTPrimed.class);
    Thanks :)
     
  2. Offline

    MightyOne

    So... What exactly is so difficult about subtractIng or adding x:0.5 y:0 z:0.5 to the location you use? A block has of course only int coordinates since it can't move that much. But an entity can be everywhere and will of course be spawned at the junction of 4 blocks when you just use the block location
     
  3. Oh thanks, it's working, thinked it was better to take an integer cause the block will be at the exact
    coordinates ^^, thanks for your answer :D
     
    MightyOne likes this.
Thread Status:
Not open for further replies.

Share This Page