summaryrefslogtreecommitdiffstats
path: root/src/Chunk.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Chunk.cpp')
-rw-r--r--src/Chunk.cpp37
1 files changed, 30 insertions, 7 deletions
diff --git a/src/Chunk.cpp b/src/Chunk.cpp
index 5f6eb1205..4386ffcb8 100644
--- a/src/Chunk.cpp
+++ b/src/Chunk.cpp
@@ -701,9 +701,30 @@ void cChunk::ProcessQueuedSetBlocks(void)
{
if (itr->m_Tick <= CurrTick)
{
- // Current world age is bigger than/equal to target world age - delay time reached
- SetBlock(itr->m_RelX, itr->m_RelY, itr->m_RelZ, itr->m_BlockType, itr->m_BlockMeta);
- itr = m_SetBlockQueue.erase(itr);
+ if (itr->m_PreviousType != E_BLOCK_AIR) // PreviousType defaults to -1 if not specified
+ {
+ if (GetBlock(itr->m_RelX, itr->m_RelY, itr->m_RelZ) == itr->m_PreviousType)
+ {
+ // Current world age is bigger than/equal to target world age - delay time reached AND
+ // Previous block type was the same as current block type (to prevent duplication)
+ // Since blocktypes were the same, we just need to set the meta
+ SetMeta(itr->m_RelX, itr->m_RelY, itr->m_RelZ, itr->m_BlockMeta);
+ itr = m_SetBlockQueue.erase(itr);
+ LOGD("Successfully set queued block - previous and current types matched");
+ }
+ else
+ {
+ itr = m_SetBlockQueue.erase(itr);
+ LOGD("Failure setting queued block - previous and current blocktypes didn't match");
+ }
+ }
+ else
+ {
+ // Current world age is bigger than/equal to target world age - delay time reached
+ SetBlock(itr->m_RelX, itr->m_RelY, itr->m_RelZ, itr->m_BlockType, itr->m_BlockMeta);
+ itr = m_SetBlockQueue.erase(itr);
+ LOGD("Successfully set queued block - previous type ignored");
+ }
}
else
{
@@ -1280,6 +1301,7 @@ void cChunk::CreateBlockEntities(void)
case E_BLOCK_CHEST:
case E_BLOCK_DISPENSER:
case E_BLOCK_DROPPER:
+ case E_BLOCK_ENDER_CHEST:
case E_BLOCK_LIT_FURNACE:
case E_BLOCK_FURNACE:
case E_BLOCK_HOPPER:
@@ -1392,6 +1414,7 @@ void cChunk::SetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType,
case E_BLOCK_CHEST:
case E_BLOCK_DISPENSER:
case E_BLOCK_DROPPER:
+ case E_BLOCK_ENDER_CHEST:
case E_BLOCK_LIT_FURNACE:
case E_BLOCK_FURNACE:
case E_BLOCK_HOPPER:
@@ -1410,9 +1433,9 @@ void cChunk::SetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType,
-void cChunk::QueueSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Int64 a_Tick)
+void cChunk::QueueSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Int64 a_Tick, BLOCKTYPE a_PreviousBlockType)
{
- m_SetBlockQueue.push_back(sSetBlockQueueItem(a_RelX, a_RelY, a_RelZ, a_BlockType, a_BlockMeta, a_Tick));
+ m_SetBlockQueue.push_back(sSetBlockQueueItem(a_RelX, a_RelY, a_RelZ, a_BlockType, a_BlockMeta, a_Tick, a_PreviousBlockType));
}
@@ -2647,7 +2670,7 @@ void cChunk::BroadcastEntityVelocity(const cEntity & a_Entity, const cClientHand
-void cChunk::BroadcastPlayerAnimation(const cPlayer & a_Player, char a_Animation, const cClientHandle * a_Exclude)
+void cChunk::BroadcastEntityAnimation(const cEntity & a_Entity, char a_Animation, const cClientHandle * a_Exclude)
{
for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr )
{
@@ -2655,7 +2678,7 @@ void cChunk::BroadcastPlayerAnimation(const cPlayer & a_Player, char a_Animation
{
continue;
}
- (*itr)->SendPlayerAnimation(a_Player, a_Animation);
+ (*itr)->SendEntityAnimation(a_Entity, a_Animation);
} // for itr - LoadedByClient[]
}