summaryrefslogtreecommitdiffstats
path: root/src/Chunk.cpp
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2016-04-23 00:28:25 +0200
committerLogicParrot <LogicParrot@users.noreply.github.com>2016-04-23 00:28:25 +0200
commit932c59ee38ac29a300962ab0d2f35362a2deb485 (patch)
tree755a1e62f0b67ac4c8d059145a9e082d0cb11876 /src/Chunk.cpp
parentMerge pull request #3048 from Woazboat/minecarts (diff)
parentReduced unnecessary block updates (diff)
downloadcuberite-932c59ee38ac29a300962ab0d2f35362a2deb485.tar
cuberite-932c59ee38ac29a300962ab0d2f35362a2deb485.tar.gz
cuberite-932c59ee38ac29a300962ab0d2f35362a2deb485.tar.bz2
cuberite-932c59ee38ac29a300962ab0d2f35362a2deb485.tar.lz
cuberite-932c59ee38ac29a300962ab0d2f35362a2deb485.tar.xz
cuberite-932c59ee38ac29a300962ab0d2f35362a2deb485.tar.zst
cuberite-932c59ee38ac29a300962ab0d2f35362a2deb485.zip
Diffstat (limited to 'src/Chunk.cpp')
-rw-r--r--src/Chunk.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/Chunk.cpp b/src/Chunk.cpp
index bc0de0516..ae3d218d5 100644
--- a/src/Chunk.cpp
+++ b/src/Chunk.cpp
@@ -95,7 +95,6 @@ cChunk::cChunk(
m_WaterSimulatorData(a_World->GetWaterSimulator()->CreateChunkData()),
m_LavaSimulatorData (a_World->GetLavaSimulator ()->CreateChunkData()),
m_RedstoneSimulatorData(a_World->GetRedstoneSimulator()->CreateChunkData()),
- m_IsRedstoneDirty(false),
m_AlwaysTicked(0)
{
if (a_NeighborXM != nullptr)
@@ -1536,8 +1535,17 @@ void cChunk::FastSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockT
return;
}
- MarkDirty();
- m_IsRedstoneDirty = true;
+ bool ReplacingLiquids = (
+ ((OldBlockType == E_BLOCK_STATIONARY_WATER) && (a_BlockType == E_BLOCK_WATER)) || // Replacing stationary water with water
+ ((OldBlockType == E_BLOCK_WATER) && (a_BlockType == E_BLOCK_STATIONARY_WATER)) || // Replacing water with stationary water
+ ((OldBlockType == E_BLOCK_STATIONARY_LAVA) && (a_BlockType == E_BLOCK_LAVA)) || // Replacing stationary lava with lava
+ ((OldBlockType == E_BLOCK_LAVA) && (a_BlockType == E_BLOCK_STATIONARY_LAVA)) // Replacing lava with stationary lava
+ );
+
+ if (!ReplacingLiquids)
+ {
+ MarkDirty();
+ }
m_ChunkData.SetBlock(a_RelX, a_RelY, a_RelZ, a_BlockType);
@@ -1550,13 +1558,7 @@ void cChunk::FastSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockT
((OldBlockType == E_BLOCK_NEW_LEAVES) && (a_BlockType == E_BLOCK_NEW_LEAVES))
) && // ... AND ...
(
- (OldBlockMeta != a_BlockMeta) || // ... the meta value is different OR ...
- !( // ... the old and new blocktypes AREN'T liquids (because client doesn't need to distinguish betwixt them):
- ((OldBlockType == E_BLOCK_STATIONARY_WATER) && (a_BlockType == E_BLOCK_WATER)) || // Replacing stationary water with water
- ((OldBlockType == E_BLOCK_WATER) && (a_BlockType == E_BLOCK_STATIONARY_WATER)) || // Replacing water with stationary water
- ((OldBlockType == E_BLOCK_STATIONARY_LAVA) && (a_BlockType == E_BLOCK_LAVA)) || // Replacing stationary water with water
- ((OldBlockType == E_BLOCK_LAVA) && (a_BlockType == E_BLOCK_STATIONARY_LAVA)) // Replacing water with stationary water
- )
+ (OldBlockMeta != a_BlockMeta) || (!ReplacingLiquids)
)
)
)