summaryrefslogtreecommitdiffstats
path: root/src/Chunk.h
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2016-04-16 19:40:35 +0200
committerLogicParrot <LogicParrot@users.noreply.github.com>2016-04-16 19:40:35 +0200
commit032ce6b95ee83be1c853006834c34aef95782e53 (patch)
tree40d0ee18885a94081859f48d9e2ff31d54ee3387 /src/Chunk.h
parentMerge pull request #3144 from cuberite/issue-template (diff)
parentUpdated cChunk::SetMeta, fixed grass growth, reduced markDirty/setMeta usage (diff)
downloadcuberite-032ce6b95ee83be1c853006834c34aef95782e53.tar
cuberite-032ce6b95ee83be1c853006834c34aef95782e53.tar.gz
cuberite-032ce6b95ee83be1c853006834c34aef95782e53.tar.bz2
cuberite-032ce6b95ee83be1c853006834c34aef95782e53.tar.lz
cuberite-032ce6b95ee83be1c853006834c34aef95782e53.tar.xz
cuberite-032ce6b95ee83be1c853006834c34aef95782e53.tar.zst
cuberite-032ce6b95ee83be1c853006834c34aef95782e53.zip
Diffstat (limited to 'src/Chunk.h')
-rw-r--r--src/Chunk.h17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/Chunk.h b/src/Chunk.h
index 557fe332a..9b9a26f03 100644
--- a/src/Chunk.h
+++ b/src/Chunk.h
@@ -392,15 +392,24 @@ public:
{
return m_ChunkData.GetMeta(a_RelX, a_RelY, a_RelZ);
}
- inline void SetMeta(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_Meta)
+
+ /** Set a meta value, with the option of not informing the client and / or not marking dirty.
+ Used for setting metas that are of little value for saving to disk and / or for sending to the client,
+ such as leaf decay flags. */
+ inline void SetMeta(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_Meta, bool a_ShouldMarkDirty = true, bool a_ShouldInformClient = true)
{
bool hasChanged = m_ChunkData.SetMeta(a_RelX, a_RelY, a_RelZ, a_Meta);
if (hasChanged)
{
- MarkDirty();
m_IsRedstoneDirty = true;
-
- m_PendingSendBlocks.push_back(sSetBlock(m_PosX, m_PosZ, a_RelX, a_RelY, a_RelZ, GetBlock(a_RelX, a_RelY, a_RelZ), a_Meta));
+ if (a_ShouldMarkDirty)
+ {
+ MarkDirty();
+ }
+ if (a_ShouldInformClient)
+ {
+ m_PendingSendBlocks.push_back(sSetBlock(m_PosX, m_PosZ, a_RelX, a_RelY, a_RelZ, GetBlock(a_RelX, a_RelY, a_RelZ), a_Meta));
+ }
}
}