[Solved] Get all of the generated blocks/chunks?

Is there a way I can retrieve all of the generated blocks in a world? Or chunks?

You can get an iterable of chunks by calling World.getLoadedChunks()
You definitely shouldn’t be getting all the generated blocks at one time, but here’s a simple loop:

for (Chunk chunk : world.getLoadedChunks()) {
    Vector3i min = chunk.getBlockMin();
    Vector3i max = chunk.getBlockMax();
    for (int x = min.getX(); x < max.getX(); x++) {
        for (int y = min.getY(); y < max.getY(); y++) {
            for (int z = min.getZ(); z < max.getZ(); z++) {
                BlockState block = chunk.getBlock(x, y, z);
            }
        }
    }
}

World also has getBlockMin() and getBlockMax() so you can loop over the entire range of a world (if you do this you’re doing something wrong).

Thanks, I’ll use the getLoadedChunks() method!

Before I posted, I was testing with the World.getBlockMin() and World.getBlockMax(). Let’s just say that didn’t go too well :grimacing:

One more quick question: Is it possible to make it snow, without changing the biome?

I think that’s controlled purely on the biome.

Ah ok, thanks for letting me know!