diff options
author | Tiger Wang <ziwei.tiger@outlook.com> | 2020-07-29 00:39:55 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@outlook.com> | 2020-08-02 16:52:06 +0200 |
commit | fd5191854df621402cfe1203daceb68851c88af7 (patch) | |
tree | 42c85d35e600cff359aaa18b70624c9d0a80fb34 /src | |
parent | Ensure updating relatives calls the correct base case (diff) | |
download | cuberite-fd5191854df621402cfe1203daceb68851c88af7.tar cuberite-fd5191854df621402cfe1203daceb68851c88af7.tar.gz cuberite-fd5191854df621402cfe1203daceb68851c88af7.tar.bz2 cuberite-fd5191854df621402cfe1203daceb68851c88af7.tar.lz cuberite-fd5191854df621402cfe1203daceb68851c88af7.tar.xz cuberite-fd5191854df621402cfe1203daceb68851c88af7.tar.zst cuberite-fd5191854df621402cfe1203daceb68851c88af7.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/Blocks/BlockHandler.cpp | 20 | ||||
-rw-r--r-- | src/Chunk.cpp | 4 |
2 files changed, 12 insertions, 12 deletions
diff --git a/src/Blocks/BlockHandler.cpp b/src/Blocks/BlockHandler.cpp index 5d6609836..b7e746418 100644 --- a/src/Blocks/BlockHandler.cpp +++ b/src/Blocks/BlockHandler.cpp @@ -585,22 +585,18 @@ void cBlockHandler::Check( cChunk & a_Chunk ) { - if (!CanBeAt(a_ChunkInterface, a_RelPos, a_Chunk)) + if (CanBeAt(a_ChunkInterface, a_RelPos, a_Chunk)) { - if (DoesDropOnUnsuitable()) - { - a_ChunkInterface.DropBlockAsPickups(a_Chunk.RelativeToAbsolute(a_RelPos)); - } - else - { - a_Chunk.SetBlock(a_RelPos, E_BLOCK_AIR, 0); - } + return; + } + + if (DoesDropOnUnsuitable()) + { + a_ChunkInterface.DropBlockAsPickups(a_Chunk.RelativeToAbsolute(a_RelPos)); } else { - // Wake up the simulators for this block: - auto absPos = a_Chunk.RelativeToAbsolute(a_RelPos); - a_Chunk.GetWorld()->GetSimulatorManager()->WakeUp(absPos, &a_Chunk); + a_Chunk.SetBlock(a_RelPos, E_BLOCK_AIR, 0); } } diff --git a/src/Chunk.cpp b/src/Chunk.cpp index fb37ce3b3..9544899f7 100644 --- a/src/Chunk.cpp +++ b/src/Chunk.cpp @@ -1314,6 +1314,10 @@ void cChunk::SetBlock(Vector3i a_RelPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_Blo m_ToTickBlocks.push_back(a_RelPos); QueueTickBlockNeighbors(a_RelPos); + // TODO: use relative coordinates, cChunk reference + // Wake up the simulators for this block: + GetWorld()->GetSimulatorManager()->WakeUp(RelativeToAbsolute(a_RelPos), this); + // If there was a block entity, remove it: cBlockEntity * BlockEntity = GetBlockEntityRel(a_RelPos); if (BlockEntity != nullptr) |