diff options
author | madmaxoft <github@xoft.cz> | 2014-03-27 18:13:52 +0100 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2014-03-27 18:13:52 +0100 |
commit | bbebb3a2cdbd888e63e4a40b1bcc730105c11377 (patch) | |
tree | 4597232dcb5c732b1a70649c725caec07e59bde5 /src | |
parent | Prefabs support connectors, rotations and merge strategy. (diff) | |
download | cuberite-bbebb3a2cdbd888e63e4a40b1bcc730105c11377.tar cuberite-bbebb3a2cdbd888e63e4a40b1bcc730105c11377.tar.gz cuberite-bbebb3a2cdbd888e63e4a40b1bcc730105c11377.tar.bz2 cuberite-bbebb3a2cdbd888e63e4a40b1bcc730105c11377.tar.lz cuberite-bbebb3a2cdbd888e63e4a40b1bcc730105c11377.tar.xz cuberite-bbebb3a2cdbd888e63e4a40b1bcc730105c11377.tar.zst cuberite-bbebb3a2cdbd888e63e4a40b1bcc730105c11377.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/Chunk.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Chunk.cpp b/src/Chunk.cpp index 957d7d575..bd4cb9937 100644 --- a/src/Chunk.cpp +++ b/src/Chunk.cpp @@ -2510,6 +2510,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) { |