summaryrefslogtreecommitdiffstats
path: root/src/Chunk.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-04-03 20:18:34 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-04-03 20:18:34 +0200
commite1ba51e6ca1cdff477279b7064fc0e0b5117c085 (patch)
treeeaad9f451838b75cd990b548b93f8287fbd75865 /src/Chunk.cpp
parentFixed some bugs (diff)
parentFixed a few MSVC type warnings. (diff)
downloadcuberite-e1ba51e6ca1cdff477279b7064fc0e0b5117c085.tar
cuberite-e1ba51e6ca1cdff477279b7064fc0e0b5117c085.tar.gz
cuberite-e1ba51e6ca1cdff477279b7064fc0e0b5117c085.tar.bz2
cuberite-e1ba51e6ca1cdff477279b7064fc0e0b5117c085.tar.lz
cuberite-e1ba51e6ca1cdff477279b7064fc0e0b5117c085.tar.xz
cuberite-e1ba51e6ca1cdff477279b7064fc0e0b5117c085.tar.zst
cuberite-e1ba51e6ca1cdff477279b7064fc0e0b5117c085.zip
Diffstat (limited to 'src/Chunk.cpp')
-rw-r--r--src/Chunk.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/Chunk.cpp b/src/Chunk.cpp
index d80e93702..6e6b7ed20 100644
--- a/src/Chunk.cpp
+++ b/src/Chunk.cpp
@@ -942,7 +942,7 @@ void cChunk::ApplyWeatherToTop()
FastSetBlock(X, Height, Z, E_BLOCK_SNOW, TopMeta - 1);
}
}
- else if (cBlockInfo::IsSnowable(TopBlock))
+ else if (cBlockInfo::IsSnowable(TopBlock) && (Height + 1 < cChunkDef::Height))
{
SetBlock(X, Height + 1, Z, E_BLOCK_SNOW, 0);
}
@@ -2589,6 +2589,17 @@ cChunk * cChunk::GetNeighborChunk(int a_BlockX, int a_BlockZ)
cChunk * cChunk::GetRelNeighborChunk(int a_RelX, int a_RelZ)
{
+ // If the relative coords are too far away, use the parent's chunk lookup instead:
+ if ((a_RelX < 128) || (a_RelX > 128) || (a_RelZ < -128) || (a_RelZ > 128))
+ {
+ int BlockX = m_PosX * cChunkDef::Width + a_RelX;
+ int BlockZ = m_PosZ * cChunkDef::Width + a_RelZ;
+ int BlockY, ChunkX, ChunkZ;
+ AbsoluteToRelative(BlockX, BlockY, BlockZ, ChunkX, ChunkZ);
+ return m_ChunkMap->GetChunkNoLoad(ChunkX, ZERO_CHUNK_Y, ChunkZ);
+ }
+
+ // Walk the neighbors:
bool ReturnThis = true;
if (a_RelX < 0)
{