Do you know why this code not working? PHP: for($x = 5; $x < 10; $x++){ for($z = 5; $z < 10; $z++){ $level->setBlockIdAt($vec->x + $x, 67, $vec->z + $z, Block::STONE); $wool_color1 = 6; $wool1 = Block::get(35, $wool_color1); $level->setBlockIdAt($vec->x + $x, 72, $vec->z + $z, Block::$wool1); // 72 } } And the Output: Code: 2018-12-21 [12:50:17] [Server thread/INFO]: Preparing level "sb" 2018-12-21 [12:50:17] [Server thread/NOTICE]: Spawn terrain for level "sb" is being generated in the background 2018-12-21 [12:50:18] [Asynchronous Worker #1 thread/CRITICAL]: TypeError: "Argument 4 passed to pocketmine\level\SimpleChunkManager::setBlockIdAt() must be of the type integer, object given, called in E:\PMMP\PocketMine\plugins\SkyBlock\src\SkyBlock\SkyBlockStructure.php on line 43" (EXCEPTION) in "/src/pocketmine/level/SimpleChunkManager" at line 71 2018-12-21 [12:50:18] [Server thread/CRITICAL]: Could not execute asynchronous task PopulationTask: Task crashed
PHP: var_dump(Block::$wool1) It's probably what you don't expect. Solution: Replace "Block::$wool1" with "$wool1"
setBlockIdAt only expects the block id, if you want to set the block data too: PHP: $level->setBlockIdAt($vec->x + $x, 72, $vec->z + $z, Block::WOOL);$level->setBlockDataAt($vec->x + $x, 72, $vec->z + $z, $wool_color1);
still error: Code: 2018-12-22 [17:44:41] [Server thread/CRITICAL]: Could not execute asynchronous task PopulationTask: Task crashed 2018-12-22 [17:44:41] [Server thread/INFO]: Created world called sbb 2018-12-22 [17:44:41] [Asynchronous Worker #2 thread/CRITICAL]: TypeError: "Argument 4 passed to pocketmine\level\SimpleChunkManager::setBlockIdAt() must be of the type integer, object given, called in E:\PMMP\PocketMine\plugins\SkyBlock\src\skyblock\SkyBlockStructure.php on line 43" (EXCEPTION) in "/src/pocketmine/level/SimpleChunkManager" at line 71
If you used my code it would not have this error, there is no way Block::WOOL is an object Show me the whole function that you are using at SkyBlockStructure.php on line 43 and which version of pmmp are you using
My apologies. I got confused by recent API changes. You must pass integer, which is block/item id, which is numeric. And to pass meta/variant value, You can do second call to SimpleChunkManager::setBlockDataAt(...)