for (int xx = xs; xx <= xi; xx++) {
for (int yy = ys; yy <= yi; yy++) {
int zOld = 0;
ChunkSnapshot chunk = null;
VanillaCuboidLightBuffer blockLight = null;
VanillaCuboidLightBuffer skyLight = null;
for (int zz = zs; zz <= zi; zz++) {
int zChunk = zz >> Chunk.BLOCKS.BITS;
if (zChunk != zOld || chunk == null) {
chunk = chunkModel.getChunkFromBlock(xx, yy, zz);
if (chunk == null) {
continue;
}
blockLight = (VanillaCuboidLightBuffer) chunk.getLightBuffer(VanillaLighting.BLOCK_LIGHT.getId());
skyLight = (VanillaCuboidLightBuffer) chunk.getLightBuffer(VanillaLighting.SKY_LIGHT.getId());
zOld = zChunk;
}
BlockMaterial m = chunk.getBlockMaterial(xx, yy, zz);
if (!m.isOpaque()) {
light += blockLight.get(xx, yy, zz);
skylight += skyLight.get(xx, yy, zz); //use the SkyLightRaw, the real sky state would be apply by the shader
count++;
}
}
}
}