void SunlightFlood(int[] workportion, byte[] worklight, int[] dataLightRadius, bool[] dataTransparent) { for (int xx = 0; xx < 16; xx++) { for (int yy = 0; yy < 16; yy++) { for (int zz = 0; zz < 16; zz++) { int pos = Index3d(xx, yy, zz, 16, 16); if (!dataTransparent[workportion[pos]]) { continue; } int curlight = worklight[pos]; int posXPlus1 = pos + LightFlood.XPlus; int posYPlus1 = pos + LightFlood.YPlus; if (xx + 1 < 16 && worklight[posXPlus1] != curlight && dataTransparent[workportion[posXPlus1]]) { flood.FloodLight(workportion, worklight, xx, yy, zz, dataLightRadius, dataTransparent); flood.FloodLight(workportion, worklight, xx + 1, yy, zz, dataLightRadius, dataTransparent); } if (yy + 1 < 16 && worklight[posYPlus1] != curlight && dataTransparent[workportion[posYPlus1]]) { flood.FloodLight(workportion, worklight, xx, yy, zz, dataLightRadius, dataTransparent); flood.FloodLight(workportion, worklight, xx, yy + 1, zz, dataLightRadius, dataTransparent); } } } } }
void FloodBetweenChunks(byte[][] chunksLight_, byte[] cLight, byte[] dcLight, int cx, int cy, int cz, int dcx, int dcy, int dcz, int xx, int yy, int zz, int dxx, int dyy, int dzz, int[] dataLightRadius, bool[] dataTransparent) { int sourceLight = cLight[Index3d(xx, yy, zz, 16, 16)]; int targetLight = dcLight[Index3d(dxx, dyy, dzz, 16, 16)]; if (targetLight < sourceLight - 1) { dcLight[Index3d(dxx, dyy, dzz, 16, 16)] = Game.IntToByte(sourceLight - 1); flood.FloodLight(chunksData[Index3d(dcx, dcy, dcz, 3, 3)], dcLight, dxx, dyy, dzz, dataLightRadius, dataTransparent); } }