mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-01-23 01:21:57 -05:00
Fix incorrect lighting when replacing slab lower with slab upper
This commit is contained in:
parent
3c9bfe6965
commit
fdd4b93fdb
1 changed files with 6 additions and 1 deletions
|
@ -126,10 +126,15 @@ namespace ClassicalSharp.Map {
|
|||
public override void UpdateLight(int x, int y, int z, BlockID oldBlock, BlockID newBlock) {
|
||||
bool didBlock = info.BlocksLight[oldBlock];
|
||||
bool nowBlocks = info.BlocksLight[newBlock];
|
||||
if (didBlock == nowBlocks) return;
|
||||
int oldOffset = (info.LightOffset[oldBlock] >> Side.Top) & 1;
|
||||
int newOffset = (info.LightOffset[newBlock] >> Side.Top) & 1;
|
||||
|
||||
// Two cases we need to handle here:
|
||||
if (didBlock == nowBlocks) {
|
||||
if (!didBlock) return; // a) both old and new block do not block light
|
||||
if (oldOffset == newOffset) return; // b) both blocks blocked light at the same Y coordinate
|
||||
}
|
||||
|
||||
int index = (z * width) + x;
|
||||
int lightH = heightmap[index];
|
||||
if (lightH == short.MaxValue) {
|
||||
|
|
Loading…
Reference in a new issue