Tnt knockback

Discussion in 'Plugin Development' started by HelloThereItsMe, Jun 13, 2015.

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

    HelloThereItsMe

    Can you please help me about making tnt explosions knock back entities? Thanks:)
     
  2. Offline

    TheDiamond06

    @HelloThereItsMe
    EntityExplodeEvent
    if Entity is Tnt:
    Loop through players and see if they are in X radius of the tnt
    Set the Velocity of the players and knock them back.
     
  3. Offline

    Zombie_Striker

    @HelloThereItsMe
    Code:
    int xPos = TNT#getLocation().getBlockX() -  Player#getLocation().getBlockX();
    int zPos = TNT#getLocation().getBlockZ() -  Player#getLocation().getBlockX();
    
    int redux = 10; // You don't want the player flying thousands of blocks
    
    Player#.setVelocity(New Velocity(xPos/redux, 0.5, zPos/redux));
    
     
Thread Status:
Not open for further replies.

Share This Page