public int GetRecalatedHeight(int x, int z) { bool isInAir = true; for (int y = 255; y >= 0; y--) { { Chunk chunk = chunks[y >> 4]; if (isInAir && chunk.IsAllAir()) { if (chunk.IsDirty) { Fill <byte>(chunk.skylight.Data, 0xff); } y -= 15; continue; } isInAir = false; byte bid = GetBlock(x, y, z); if (bid == 0 || (BlockFactory.TransparentBlocks[bid] == 1 && bid != 18 && bid != 30)) { continue; } return(y + 1); } } return(0); }
public void RecalcHeight() { for (int x = 0; x < 16; x++) { for (int z = 0; z < 16; z++) { bool isInLight = true; bool isInAir = true; for (int y = 255; y >= 0; y--) { if (isInLight) { Chunk chunk = chunks[y >> 4]; if (isInAir && chunk.IsAllAir()) { if (chunk.IsDirty) { Fill <byte>(chunk.skylight.Data, 0xff); } y -= 15; continue; } isInAir = false; byte bid = GetBlock(x, y, z); if (bid == 0 || (BlockFactory.TransparentBlocks[bid] == 1 && bid != 18 && bid != 30 && bid != 8 && bid != 9)) { SetSkyLight(x, y, z, 15); } else { SetHeight(x, z, (short)(y + 1)); SetSkyLight(x, y, z, 0); isInLight = false; } } else { SetSkyLight(x, y, z, 0); } } } } }
public void RecalcHeight() { for (int x = 0; x < 16; x++) { for (int z = 0; z < 16; z++) { bool isInLight = true; bool isInAir = true; for (int y = 255; y >= 0; y--) { if (isInLight) { Chunk chunk = chunks[y >> 4]; if (isInAir && chunk.IsAllAir()) { if (chunk.IsDirty) { Fill <byte>(chunk.skylight.Data, 0xff); } y -= 15; continue; } isInAir = false; byte block = GetBlock(x, y, z); if (block == 0 || block == 20 || block == 241) { SetSkyLight(x, y, z, 15); } else { SetHeight(x, z, (short)(y + 1)); SetSkyLight(x, y, z, 0); isInLight = false; } } else { SetSkyLight(x, y, z, 0); } } } } }