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

How to check what block a player's standing on?

Discussion in 'Development' started by Zayd, Apr 24, 2017.

  1. Zayd

    Zayd Witch

    Messages:
    55
    GitHub:
    ZaydPE
    I googled and found it on the old pocketmine forum, but shoghicp forgot to renew the SSL Certificate... :shoghi:

    How can I do this?
     
  2. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    get block (playerX,playerY-1,playerZ)
    this only works if you want exactly -1
    if you are expecting players to fly you would need more work like intreatrate from -1 to -(infinity)
     
    Zayd likes this.
  3. Aviv

    Aviv Baby Zombie

    Messages:
    156
    PHP:
    $block $player->getLevel()->getBlock($player->add(0, -0.5));
     
    Zayd 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.