Update height map before trying to access it
Only if not already populated
This commit is contained in:
parent
314e49eed5
commit
a2f7f62a67
@ -181,7 +181,13 @@ namespace TrueCraft.Core.Lighting
|
||||
byte emissiveness = provider.Luminance;
|
||||
if (op.SkyLight)
|
||||
{
|
||||
var height = HeightMaps[chunk.Coordinates][adjustedCoords.X, adjustedCoords.Z];
|
||||
byte[,] map;
|
||||
if (!HeightMaps.TryGetValue(chunk.Coordinates, out map))
|
||||
{
|
||||
GenerateHeightMap(chunk);
|
||||
map = HeightMaps[chunk.Coordinates];
|
||||
}
|
||||
var height = map[adjustedCoords.X, adjustedCoords.Z];
|
||||
// For skylight, the emissiveness is 15 if y >= height
|
||||
if (y >= height)
|
||||
emissiveness = 15;
|
||||
|
Reference in New Issue
Block a user