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

[Solved] call to function on null error

Discussion in 'Development' started by jasonwynn10, Dec 31, 2016.

  1. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    I keep receiving this error when I run my plugin to generate a new world.
    Code:
     [Asynchronous Worker #1 thread/CRITICAL]: Error: "Call to a member function getLevel() on null" (EXCEPTION) in "/src/pocketmine/tile/Tile" at line 124
    I know that the chunk doesn't return a null because the tree is properly generated, but it still gives that error output. Anyone know what could be causing this? I am using the mcpe-1.0 branch for the server.
    PHP:
    $chunk $this->level->getChunk($chunkX$chunkZ);
    Tree::growTree($this->level$chunkX 364$chunkZ 3$this->randomSapling::OAK);
    $chunk->setBlock($chunkX 264$chunkZ 3Block::CHEST0);
    $nbt = new CompoundTag("", [
        new 
    ListTag("Items", [
            
    Item::get(Item::ICE,0,2),
            
    Item::get(Item::MELON),
            
    Item::get(Item::TORCH,0,2),
            
    Item::get(Item::BONE),
            
    Item::get(Item::BUCKET,1),
            
    Item::get(Item::PUMPKIN_SEEDS),
            
    Item::get(Item::SUGAR_CANE),
            
    Item::get(Item::RED_MUSHROOM),
            
    Item::get(Item::BROWN_MUSHROOM),
            
    Item::get(Item::CACTUS),
            
    Item::get(Item::BREAD),
            
    Item::get(Item::WHEAT),
            
    Item::get(Item::LEATHER_BOOTS),
            
    Item::get(Item::LEATHER_CAP),
            
    Item::get(Item::LEATHER_TUNIC),
            
    Item::get(Item::LEATHER_PANTS)
        ]),
        new 
    IntTag("x"$chunkX 2),
        new 
    IntTag("y"64),
        new 
    IntTag("z"$chunkX 3),
    ]);
    $tile = new Chest($chunk$nbt);
    $chunk->addTile($tile);
     
  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.