summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2020-07-25 21:59:12 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2020-07-25 21:59:12 +0200
commit6d650d5f3c59663c94da8b269d9e5cc3979c3da4 (patch)
treea2c557d1e09b0872e14055c13c0672b6b6cff9e4 /src
parentUse relative vectors in cChunk::DoWith (diff)
downloadcuberite-6d650d5f3c59663c94da8b269d9e5cc3979c3da4.tar
cuberite-6d650d5f3c59663c94da8b269d9e5cc3979c3da4.tar.gz
cuberite-6d650d5f3c59663c94da8b269d9e5cc3979c3da4.tar.bz2
cuberite-6d650d5f3c59663c94da8b269d9e5cc3979c3da4.tar.lz
cuberite-6d650d5f3c59663c94da8b269d9e5cc3979c3da4.tar.xz
cuberite-6d650d5f3c59663c94da8b269d9e5cc3979c3da4.tar.zst
cuberite-6d650d5f3c59663c94da8b269d9e5cc3979c3da4.zip
Diffstat (limited to '')
-rw-r--r--src/Chunk.cpp29
-rw-r--r--src/Simulator/Simulator.cpp12
2 files changed, 22 insertions, 19 deletions
diff --git a/src/Chunk.cpp b/src/Chunk.cpp
index d354448ce..fb37ce3b3 100644
--- a/src/Chunk.cpp
+++ b/src/Chunk.cpp
@@ -1374,19 +1374,34 @@ void cChunk::QueueTickBlock(Vector3i a_RelPos)
void cChunk::QueueTickBlockNeighbors(Vector3i a_RelPos)
{
- static const Vector3i neighborOfs[] =
+ // Contains our direct adjacents
+ // and one block above and below the laterals (for redstone components)
+ static const Vector3i Offsets[] =
{
+ { 1, 1, 0},
{ 1, 0, 0},
+ { 1, -1, 0},
+
+ {-1, 1, 0},
{-1, 0, 0},
- { 0, 1, 0},
- { 0, -1, 0},
+ {-1, -1, 0},
+
+ { 0, 1, 1},
{ 0, 0, 1},
+ { 0, -1, 1},
+
+ { 0, 1, -1},
{ 0, 0, -1},
- } ;
- for (const auto & ofs: neighborOfs)
+ { 0, -1, -1},
+
+ { 0, 1, 0},
+ { 0, -1, 0},
+ };
+
+ for (const auto & Offset : Offsets)
{
- UnboundedQueueTickBlock(a_RelPos + ofs);
- } // for i - Coords[]
+ UnboundedQueueTickBlock(a_RelPos + Offset);
+ }
}
diff --git a/src/Simulator/Simulator.cpp b/src/Simulator/Simulator.cpp
index 9dbdd6a07..ac2e757e4 100644
--- a/src/Simulator/Simulator.cpp
+++ b/src/Simulator/Simulator.cpp
@@ -21,18 +21,6 @@
void cSimulator::WakeUp(Vector3i a_Block, cChunk * a_Chunk)
{
AddBlock(a_Block, a_Chunk);
- AddBlock(a_Block + Vector3i(-1, 0, 0), a_Chunk->GetNeighborChunk(a_Block.x - 1, a_Block.z));
- AddBlock(a_Block + Vector3i( 1, 0, 0), a_Chunk->GetNeighborChunk(a_Block.x + 1, a_Block.z));
- AddBlock(a_Block + Vector3i(0, 0, -1), a_Chunk->GetNeighborChunk(a_Block.x, a_Block.z - 1));
- AddBlock(a_Block + Vector3i(0, 0, 1), a_Chunk->GetNeighborChunk(a_Block.x, a_Block.z + 1));
- if (a_Block.y > 0)
- {
- AddBlock(a_Block + Vector3i(0, -1, 0), a_Chunk);
- }
- if (a_Block.y < cChunkDef::Height - 1)
- {
- AddBlock(a_Block + Vector3i(0, 1, 0), a_Chunk);
- }
}