summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2013-12-13 20:55:08 +0100
committerMattes D <github@xoft.cz>2013-12-13 20:55:08 +0100
commit8033abe8ce94ad737c71e7a378ebeed26e9a3feb (patch)
tree4789492b6bbd4c8d5d00acd7cea4387c021e2401 /src
parentFixed threading issues affecting cProtocol172. (diff)
parentImproved redstone loading performance (diff)
downloadcuberite-8033abe8ce94ad737c71e7a378ebeed26e9a3feb.tar
cuberite-8033abe8ce94ad737c71e7a378ebeed26e9a3feb.tar.gz
cuberite-8033abe8ce94ad737c71e7a378ebeed26e9a3feb.tar.bz2
cuberite-8033abe8ce94ad737c71e7a378ebeed26e9a3feb.tar.lz
cuberite-8033abe8ce94ad737c71e7a378ebeed26e9a3feb.tar.xz
cuberite-8033abe8ce94ad737c71e7a378ebeed26e9a3feb.tar.zst
cuberite-8033abe8ce94ad737c71e7a378ebeed26e9a3feb.zip
Diffstat (limited to 'src')
-rw-r--r--src/Chunk.cpp19
-rw-r--r--src/World.h1
2 files changed, 17 insertions, 3 deletions
diff --git a/src/Chunk.cpp b/src/Chunk.cpp
index 9c195fdf8..42969bf6d 100644
--- a/src/Chunk.cpp
+++ b/src/Chunk.cpp
@@ -706,8 +706,7 @@ void cChunk::ProcessQueuedSetBlocks(void)
{
// 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);
+ SetBlock(itr->m_RelX, itr->m_RelY, itr->m_RelZ, itr->m_BlockType, itr->m_BlockMeta); // SetMeta doesn't send to client
itr = m_SetBlockQueue.erase(itr);
LOGD("Successfully set queued block - previous and current types matched");
}
@@ -1335,6 +1334,7 @@ void cChunk::WakeUpSimulators(void)
{
cSimulator * WaterSimulator = m_World->GetWaterSimulator();
cSimulator * LavaSimulator = m_World->GetLavaSimulator();
+ cSimulator * RedstoneSimulator = m_World->GetRedstoneSimulator();
int BaseX = m_PosX * cChunkDef::Width;
int BaseZ = m_PosZ * cChunkDef::Width;
for (int x = 0; x < Width; x++)
@@ -1345,7 +1345,16 @@ void cChunk::WakeUpSimulators(void)
int BlockZ = z + BaseZ;
for (int y = GetHeight(x, z); y >= 0; y--)
{
- switch (cChunkDef::GetBlock(m_BlockTypes, x, y, z))
+ BLOCKTYPE Block = cChunkDef::GetBlock(m_BlockTypes, x, y, z);
+
+ // The redstone sim takes multiple blocks, use the inbuilt checker
+ if (RedstoneSimulator->IsAllowedBlock(Block))
+ {
+ RedstoneSimulator->AddBlock(BlockX, y, BlockZ, this);
+ continue;
+ }
+
+ switch (Block)
{
case E_BLOCK_WATER:
{
@@ -1357,6 +1366,10 @@ void cChunk::WakeUpSimulators(void)
LavaSimulator->AddBlock(BlockX, y, BlockZ, this);
break;
}
+ default:
+ {
+ break;
+ }
} // switch (BlockType)
} // for y
} // for z
diff --git a/src/World.h b/src/World.h
index b6ab321fb..fc821a68a 100644
--- a/src/World.h
+++ b/src/World.h
@@ -392,6 +392,7 @@ public:
inline cFluidSimulator * GetWaterSimulator(void) { return m_WaterSimulator; }
inline cFluidSimulator * GetLavaSimulator (void) { return m_LavaSimulator; }
+ inline cRedstoneSimulator * GetRedstoneSimulator(void) { return m_RedstoneSimulator; }
/// Calls the callback for each block entity in the specified chunk; returns true if all block entities processed, false if the callback aborted by returning true
bool ForEachBlockEntityInChunk(int a_ChunkX, int a_ChunkZ, cBlockEntityCallback & a_Callback); // Exported in ManualBindings.cpp