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

Setting blocks over a large area

Discussion in 'Development' started by DiamondGamer30, Apr 19, 2019.

  1. DiamondGamer30

    DiamondGamer30 Baby Zombie

    Messages:
    175
    GitHub:
    diamondgamermcpe
    I'm trying to set blocks over a large area using async tasks but I keep getting one error with this.

    Code:
    [00:49:55] [Asynchronous Worker #0 thread/CRITICAL]: ErrorException: "Uninitialized string offset: 79872" (EXCEPTION) in "src/pocketmine/level/format/SubChunk" at line 106
    [00:49:55] [Asynchronous Worker #0 thread/DEBUG]: #0 src/pocketmine/level/format/SubChunk(106): pocketmine\utils\Utils::errorExceptionHandler(integer 8, string Uninitialized string offset: 79872, string phar:///home/servers/tests/PocketMine-MP.phar/src/pocketmine/level/format/SubChunk.php, integer 106, array Array())
    [00:49:55] [Asynchronous Worker #0 thread/DEBUG]: #1 src/pocketmine/level/format/Chunk(201): pocketmine\level\format\SubChunk->setBlock(integer 312, integer 0, integer 0, integer 169, NULL )
    [00:49:55] [Asynchronous Worker #0 thread/DEBUG]: #2 plugins/HCFCore/src/hcf/road/task/BuildRoadTask(54): pocketmine\level\format\Chunk->setBlock(integer 312, integer 64, integer 0, integer 169)
    [00:49:55] [Asynchronous Worker #0 thread/DEBUG]: #3 src/pocketmine/scheduler/AsyncTask(75): hcf\road\task\BuildRoadTask->onRun()
    [00:49:55] [Asynchronous Worker #0 thread/DEBUG]: #4 (): pocketmine\scheduler\AsyncTask->run()
    
    Code I used:
    PHP:
    /** @var Chunk $chunk */ 
    $chunk->setBlock(intintintBlock::SEA_LANTERN);
     
  2. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    X and Z coordinates of a chunk are bounded to 0-15, you're passing x=312 and z=169.
     
    HimbeersaftLP and Levi like this.
  3. DiamondGamer30

    DiamondGamer30 Baby Zombie

    Messages:
    175
    GitHub:
    diamondgamermcpe
    I had my mind over the chunk's x and chunk's z for some reason lol. Thank you!
     
    Muqsit likes this.
  4. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Use
    PHP:
    $chunk->setBlock(int 0x0fintint 0x0f, ...);
    ¯\_(ツ)_/¯
     
    HimbeersaftLP likes this.
  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.