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

player.move and getBlock

Comments in 'Plugin Development' started by Falk, Nov 20, 2013.

  1. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,707
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Is the player object in player.move at $data or $data['player']?
    Also how do you use getBlock to find the info of a block at certain coords?
  2. wies
    Offline

    wies Notable Member

    Joined:
    Aug 23, 2013
    Posts:
    390
    $data, but it returns the entity object of the player, not the player object.
    Falk likes this.
  3. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,707
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Thanks, that works for what I'm trying to do
  4. wies
    Offline

    wies Notable Member

    Joined:
    Aug 23, 2013
    Posts:
    390
    To get the player object you need to use: $data->player
  5. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,707
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Okay
  6. Qub1
    Offline

    Qub1 New Member

    Joined:
    Nov 6, 2013
    Posts:
    16
    Minecraft User:
    Qub1
    For getBlock:
    PHP:
    $block $level->getBlock(new Vector3($x$y$z));
    You can store the output in a variable and use that to access block specific information. Take a look at the Block.php file in src/material folder to see what you can access from the block variable, for example you can do:
    PHP:
    $block->getID();
    $block->x;
    $block->isSolid();
    You get the idea.
    Falk likes this.
  7. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,707
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Thanks, really helpful

Share This Page

Advertisement