summaryrefslogtreecommitdiffstats
path: root/src/Section.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Section.cpp')
-rw-r--r--src/Section.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Section.cpp b/src/Section.cpp
index 9b4292b..554cdbf 100644
--- a/src/Section.cpp
+++ b/src/Section.cpp
@@ -93,17 +93,17 @@ BlockId Section::GetBlockId(Vector pos) const {
return blockId;
}
-unsigned char Section::GetBlockLight(Vector pos)
+unsigned char Section::GetBlockLight(Vector pos) const
{
int blockNumber = pos.y * 256 + pos.z * 16 + pos.x;
- unsigned char lightValue = this->light[blockNumber];
+ unsigned char lightValue = this->light[blockNumber / 2];
return (blockNumber % 2 == 0) ? (lightValue & 0xF) : (lightValue >> 4);
}
-unsigned char Section::GetBlockSkyLight(Vector pos)
+unsigned char Section::GetBlockSkyLight(Vector pos) const
{
int blockNumber = pos.y * 256 + pos.z * 16 + pos.x;
- unsigned char skyValue = this->sky[blockNumber];
+ unsigned char skyValue = this->sky[blockNumber / 2];
return (blockNumber % 2 == 0) ? (skyValue & 0xF) : (skyValue >> 4);
}