Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Jump Boost Player

Comments in 'Plugin Development' started by cake23, Mar 30, 2016.

  1. cake23
    Offline

    cake23 Active Member

    Joined:
    Aug 10, 2015
    Posts:
    124
    Minecraft User:
    TheEnd
    Hey! :D I need help with my plugin. I dont know how to give the player a jump boost, if he stands on a sponge block! I tried already this:
    PHP:
    public function onMove(PlayerMoveEvent $event) {
            
    $player $event->getPlayer();
            if(
    $player->getLevel()->getFolderName() === "Testworld") {
                
    $block1 $player->getLevel()->getBlock($player->floor()->subtract(01));
                if(
    $block1->getId() === Block::SPONGE) {
                    
    $player->setMotion(new Vector3($player->getX(), $player->getY()+2$player->getZ()));
                }
            }
        }
    Can anyone help me or explain me how can I make that? :'D Thanks!!
  2. MyNameIsTriXz
    Offline

    MyNameIsTriXz Notable Member

    Joined:
    Aug 17, 2015
    Posts:
    538
    Minecraft User:
    MyNameIsTriXz
    Do:
    PHP:
    $player->setMotion($player->getMotion()->multiply($x));
    Last edited: Mar 30, 2016
  3. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Isn't ... ?
    Code:
    3 * 1 = 3
    
    Try Entity::knockBack()
    applqpak likes this.
  4. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    just use $player->knockBack();
    applqpak likes this.
  5. cake23
    Offline

    cake23 Active Member

    Joined:
    Aug 10, 2015
    Posts:
    124
    Minecraft User:
    TheEnd
    knockBack($attacker, $damage, $x, $z) has not y, and I need y :(
  6. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    there is another paramater called base i think, and depending on what u set it as the higher the player goes. Try something like knockback($damage, $x, $z, 0.10);
    applqpak and Primus like this.
  7. MyNameIsTriXz
    Offline

    MyNameIsTriXz Notable Member

    Joined:
    Aug 17, 2015
    Posts:
    538
    Minecraft User:
    MyNameIsTriXz
    Simply use my method?
    PEMapModder likes this.

Share This Page

Advertisement