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

The fastest way to check blocks around player

Comments in 'Plugin Development' started by Creeperface, Oct 23, 2015.

  1. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    Hi i want to check some blocks around player so what should i use?

    $player->getChunk()->getBlockId();
    or
    $player->getLevel()->getBlockIdAt();

    or any other way?
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    $player->getLevel()->getBlock()->getId(). It is the one that plugins are expected to use.
    But for fastest, I guess $player->getChunk is fastest, although when the player is at margin areas of a chunk, you will need to fetch another chunk, which makes it slower.

Share This Page

Advertisement