Merge pull request #419 from mc-server/redstoneloading
Redstone data is now loaded on chunk load
This commit is contained in:
commit
8033abe8ce
@ -706,8 +706,7 @@ void cChunk::ProcessQueuedSetBlocks(void)
|
|||||||
{
|
{
|
||||||
// Current world age is bigger than/equal to target world age - delay time reached AND
|
// 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)
|
// 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
|
SetBlock(itr->m_RelX, itr->m_RelY, itr->m_RelZ, itr->m_BlockType, itr->m_BlockMeta); // SetMeta doesn't send to client
|
||||||
SetMeta(itr->m_RelX, itr->m_RelY, itr->m_RelZ, itr->m_BlockMeta);
|
|
||||||
itr = m_SetBlockQueue.erase(itr);
|
itr = m_SetBlockQueue.erase(itr);
|
||||||
LOGD("Successfully set queued block - previous and current types matched");
|
LOGD("Successfully set queued block - previous and current types matched");
|
||||||
}
|
}
|
||||||
@ -1335,6 +1334,7 @@ void cChunk::WakeUpSimulators(void)
|
|||||||
{
|
{
|
||||||
cSimulator * WaterSimulator = m_World->GetWaterSimulator();
|
cSimulator * WaterSimulator = m_World->GetWaterSimulator();
|
||||||
cSimulator * LavaSimulator = m_World->GetLavaSimulator();
|
cSimulator * LavaSimulator = m_World->GetLavaSimulator();
|
||||||
|
cSimulator * RedstoneSimulator = m_World->GetRedstoneSimulator();
|
||||||
int BaseX = m_PosX * cChunkDef::Width;
|
int BaseX = m_PosX * cChunkDef::Width;
|
||||||
int BaseZ = m_PosZ * cChunkDef::Width;
|
int BaseZ = m_PosZ * cChunkDef::Width;
|
||||||
for (int x = 0; x < Width; x++)
|
for (int x = 0; x < Width; x++)
|
||||||
@ -1345,7 +1345,16 @@ void cChunk::WakeUpSimulators(void)
|
|||||||
int BlockZ = z + BaseZ;
|
int BlockZ = z + BaseZ;
|
||||||
for (int y = GetHeight(x, z); y >= 0; y--)
|
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:
|
case E_BLOCK_WATER:
|
||||||
{
|
{
|
||||||
@ -1357,6 +1366,10 @@ void cChunk::WakeUpSimulators(void)
|
|||||||
LavaSimulator->AddBlock(BlockX, y, BlockZ, this);
|
LavaSimulator->AddBlock(BlockX, y, BlockZ, this);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
} // switch (BlockType)
|
} // switch (BlockType)
|
||||||
} // for y
|
} // for y
|
||||||
} // for z
|
} // for z
|
||||||
|
@ -392,6 +392,7 @@ public:
|
|||||||
|
|
||||||
inline cFluidSimulator * GetWaterSimulator(void) { return m_WaterSimulator; }
|
inline cFluidSimulator * GetWaterSimulator(void) { return m_WaterSimulator; }
|
||||||
inline cFluidSimulator * GetLavaSimulator (void) { return m_LavaSimulator; }
|
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
|
/// 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
|
bool ForEachBlockEntityInChunk(int a_ChunkX, int a_ChunkZ, cBlockEntityCallback & a_Callback); // Exported in ManualBindings.cpp
|
||||||
|
Loading…
Reference in New Issue
Block a user