WorldEdit

WorldEdit

43M Downloads

CuboidRegion.get[Chunk]Cubes() needs a more efficient loop

LadyCailinBot opened this issue ยท 1 comments

commented

WORLDEDIT-3108 - Reported by sk89q

The loop currently needlessly loops over every block.

commented

I think the current algorithm is efficient:

for (int x = min.getBlockX() >> ChunkStore.CHUNK_SHIFTS; x <= max.getBlockX() >> ChunkStore.CHUNK_SHIFTS; ++x) {
    for (int z = min.getBlockZ() >> ChunkStore.CHUNK_SHIFTS; z <= max.getBlockZ() >> ChunkStore.CHUNK_SHIFTS; ++z) {
        for (int y = min.getBlockY() >> ChunkStore.CHUNK_SHIFTS; y <= max.getBlockY() >> ChunkStore.CHUNK_SHIFTS; ++y) {
            chunks.add(BlockVector3.at(x, y, z));
        }
    }
}