How do I generate certain chunks with blocks? I want to know an efficient way without doing too many checks.
I mean as in like the math. What x and z do I start with? I want to generate blocks only in certain chunks. So I'm asking how I figure out if I'm in the chunk that I want to generate a block in. I want an efficient way. The one in my mind didn't seem to efficient to me
PHP: $chunkX = $player->x >> 4;$chunkZ = $player->z >> 4;if($wantedChunk->getX() === $chunkX and $wantedChunk->getZ() === $chunkZ) // chunk found
If you're doing it in a generator, then it really depends on the pattern of how frequently you want those blocks to be generated. Without knowing exactly what you want, the best I can say is to look at some other world generators and figure out how you want to set your pattern yourself. https://github.com/jasonwynn10/MyPlot/blob/master/src/MyPlot/MyPlotGenerator.php https://github.com/jasonwynn10/Othe...rc/jasonwynn10/GlowGen/GlowstoneGenerator.php