Spawning primedtnt accurate?

Discussion in 'Plugin Development' started by Didi1150, Aug 27, 2020.

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

    Didi1150

    I'm trying to spawn primedtnt on the BlockPlaceEvent when tnt is placed. However, although it spawns, it spawns very inaccurate, so it is nearly inpossible to place two tnts next to each other. I already tried spawning it on int coords.

    Is there any way to make the spawning more accurate?
     
  2. Offline

    CraftCreeper6

    You don't want integer coordinates, you want to use the values that Bukkit gives you in the first place. Just pass the location of the original TNT to the new primed TNT.
     
  3. Offline

    Didi1150

    okay, I'll try

    it still doesn't spawn properly. In Hypixel it doesn't always try to bug forward

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
  4. Offline

    CraftCreeper6

    @Didi1150
    What do you mean by "bug forward"?
     
  5. Offline

    Didi1150

    the x and z coords are always bigger than the placed block
     
  6. Offline

    johnny boy

    i think the issue is you need to spawn it in the centre of the block so add 0.5 to x and z as getX() and getZ() is from the bottom left of the block
     
  7. Offline

    Didi1150

    ok

    it worked!!

    Btw, do u know how to make them boosting players on explosion like on hypixel bedwars? because I rly like tnt boosting, and I can't get the right velocity

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Aug 27, 2020
  8. Offline

    CraftCreeper6

    @Didi1150
    Just get the players velocity and multiply it.
     
  9. Offline

    Didi1150

    okay

    Edit: wait, which factor?
     
  10. Offline

    CraftCreeper6

    @Didi1150
    However much you want.

    EDIT:
    Multiply the whole velocity by a factor. You can use Player#setVelocity paired with Player#getVelocity to achieve this.
     
  11. Offline

    Didi1150

Thread Status:
Not open for further replies.

Share This Page