How to get all the chunks around a player, like 3x3 around the player, paint on the support below: ') And are the chunks different on pocketmine or do they do 16x16 as on Java? For the paint the player is in the red zone somewhere and I want the chunks around him in 3x3 to be able to recover their number of tileentity.
try out this PHP: $x =$player->getFloorX(); $z =$player->getFloorZ(); $player->getLevel()->getChunk($x,$z,false);
Thank you for the help test but it does not help me much x) I finally found it myself, you have to get the player's current chunk and then make loops to recover all those around thanks to the X Z of the chunk. PHP: $chunks = []; $level = $player->getLevel(); $chunk = $player->getLevel()->getChunkAtPosition($player->getPosition()); $baseX = $chunk->getX(); #base chunk x $baseZ = $chunk->getZ(); #base chunk z for($x = -1; $x <= 1; $x++) { #do a loop with the chunk before and the chunk after in x for ($z = -1; $z <= 1; $z++) { #same but with z $chunks[] = $level->getChunk($x + $baseX, $z + $baseZ); #get chunk with the $x from the for + the $baseX from the base chunk } }
true or u could just subtract the distance between each chunk like a 16 by 16 area and get that chunk ,but a loop works way better.