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

[NEW API] Get block coords.

Comments in 'Plugin Development' started by Killman2, Jun 30, 2014.

  1. Killman2
    Offline

    Killman2 Active Member Plugin Developer

    Joined:
    May 5, 2014
    Posts:
    81
    Plugins:
    1
    Minecraft User:
    Killman2
    How do you get the coordinates of a block in the new API?

    Like $event->getBlock()->getX(); ?
  2. Darunia18
    Offline

    Darunia18 Staff Member Sectional Moderator

    Joined:
    Aug 23, 2013
    Posts:
    754
    Plugins:
    2
    Minecraft User:
    Darunia18
    I think that's correct, but I may be wrong. If you're looking for a bit more complex stuff with coordinates, you can check out this. Also, if you're trying to get the coordinates of an entity, you'd have to do $event->getEntity()->getX(); and the like.
  3. Killman2
    Offline

    Killman2 Active Member Plugin Developer

    Joined:
    May 5, 2014
    Posts:
    81
    Plugins:
    1
    Minecraft User:
    Killman2
    I am just making a port of "WorldGuard" from PC. And in my plugin, to select the positions you use the wooden axe, not commands like /pos1 , /pos2 and etc…in those commands, you just get the coordinates of the sender, that's easy, but in this case I need to get the coords of the block.
  4. PluginMastered
    Offline

    PluginMastered Active Member

    Joined:
    Mar 1, 2014
    Posts:
    161
    Minecraft User:
    Flexa33
    make it iron sword bcz people in creative would have to switch gamemodes
  5. Killman2
    Offline

    Killman2 Active Member Plugin Developer

    Joined:
    May 5, 2014
    Posts:
    81
    Plugins:
    1
    Minecraft User:
    Killman2
    No, because I already added the commands /rg pos1, /rg pos2, for people in creative mode :)
  6. Dutok
    Offline

    Dutok Notable Member Plugin Developer

    Joined:
    Jun 20, 2014
    Posts:
    371
    Plugins:
    3
    Minecraft User:
    Dutok
    $event->getBlock()->x;
    $event->getBlock()->y;
    $event->getBlock()->z;
    $event->getBlock()->getLevel()->getName();
    Darunia18 likes this.
  7. Killman2
    Offline

    Killman2 Active Member Plugin Developer

    Joined:
    May 5, 2014
    Posts:
    81
    Plugins:
    1
    Minecraft User:
    Killman2
    Oh, so I was right then. Thanks :)
    Dutok likes this.
  8. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder

Share This Page

Advertisement