1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Help with knockback

Discussion in 'Development' started by minijaham, Jul 9, 2020.

  1. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    PHP:
    if(!($keytype $this->plugin->isCrateKey($item)) || $keytype !== $type){
      
    $player->sendTip(str_replace(["%TYPE%"], [ucfirst($type)], Lang::$no_key));
      
    $player->getLevel()->addSound(new EndermanTeleportSound($player));
      
    $player->knockBack($player1011); #this part

      
    return;
    Is there a way to change the direction the player knocks back to?
     
  2. Primus

    Primus Zombie Pigman

    Messages:
    749
    Yes you can. One of those method parameters must be direction vector.
     
  3. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    Could you tell me which one :(
     
  4. David

    David Creeper

    Messages:
    2
    PHP:
    $dirvector=$player->getDirectionVector();
    $dx=$dirvector->getX();
    $dz=$dirvector->getZ();
     
    minijaham likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.