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

getBlockIdAt Error

Comments in 'Plugin Development' started by GamesLoad, May 20, 2016.

  1. GamesLoad
    Offline

    GamesLoad Active Member

    Joined:
    Jun 28, 2014
    Posts:
    106
    Minecraft User:
    GamesLoad
    Hello guys I have to be able to clear all the blocks in 6 y
    of endstone but I can not someone can help me out?

    Error : Call to a member function getBlockIdAt() on null
    Code:
    PHP:
                                            $lv $this->$arenas;
                                                for (
    $x = -999$x <= 1000$x++){
                                                   for (
    $z = -999$z <= 100$z++){
                                                     if (
    $lv->getBlockIdAt($x,6,$z) == Block::END_STONE){
                                                      
    $lv->setBlock(new Vector3($x,$y,$z), Block::get(0));
                                                      
    $pl->sendMessage("debug");
                                                        }
                                                       }
                                                     }      
  2. HotFireyDeath
    Offline

    HotFireyDeath Notable Member Plugin Developer

    Joined:
    Mar 19, 2015
    Posts:
    328
    Plugins:
    1
    Minecraft User:
    HotFireyDeath
    $lv is null. Check that variable and make sure it's a Level object.
  3. GamesLoad
    Offline

    GamesLoad Active Member

    Joined:
    Jun 28, 2014
    Posts:
    106
    Minecraft User:
    GamesLoad
    can i load level?
  4. Tim // robske Büba
    Offline

    Tim // robske Büba Notable Member

    Joined:
    Feb 26, 2014
    Posts:
    606
    Minecraft User:
    robske_110
    And $this->$arenas looks weird to me
  5. MikkiMCPE
    Offline

    MikkiMCPE Active Member

    Joined:
    May 16, 2015
    Posts:
    125
    Minecraft User:
    MikkiMC
    can we see your full code? we want help you :)
    you should change $this->$arenas; to $this->arenas;

    for getBlockIdAt, i give you one example :
    PHP:
    $player $ev->getPlayer();
    $direction $player->getDirectionVector();
    $x $direction->getX();
    $z $direction->getZ();
    $block $player->getLevel()->getBlockIdAt($player->getX(), ($player->getY() - 0.1), $player->getZ());

Share This Page

Advertisement