MCPcopy Create free account
hub / github.com/cuberite/cuberite / WakeUpSimulators

Method WakeUpSimulators

src/Chunk.cpp:1336–1380  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1334
1335
1336void cChunk::WakeUpSimulators(void)
1337{
1338 cSimulator * WaterSimulator = m_World->GetWaterSimulator();
1339 cSimulator * LavaSimulator = m_World->GetLavaSimulator();
1340 cSimulator * RedstoneSimulator = m_World->GetRedstoneSimulator();
1341 int BaseX = m_PosX * cChunkDef::Width;
1342 int BaseZ = m_PosZ * cChunkDef::Width;
1343 for (int x = 0; x < Width; x++)
1344 {
1345 int BlockX = x + BaseX;
1346 for (int z = 0; z < Width; z++)
1347 {
1348 int BlockZ = z + BaseZ;
1349 for (int y = GetHeight(x, z); y >= 0; y--)
1350 {
1351 BLOCKTYPE Block = cChunkDef::GetBlock(m_BlockTypes, x, y, z);
1352
1353 // The redstone sim takes multiple blocks, use the inbuilt checker
1354 if (RedstoneSimulator->IsAllowedBlock(Block))
1355 {
1356 RedstoneSimulator->AddBlock(BlockX, y, BlockZ, this);
1357 continue;
1358 }
1359
1360 switch (Block)
1361 {
1362 case E_BLOCK_WATER:
1363 {
1364 WaterSimulator->AddBlock(BlockX, y, BlockZ, this);
1365 break;
1366 }
1367 case E_BLOCK_LAVA:
1368 {
1369 LavaSimulator->AddBlock(BlockX, y, BlockZ, this);
1370 break;
1371 }
1372 default:
1373 {
1374 break;
1375 }
1376 } // switch (BlockType)
1377 } // for y
1378 } // for z
1379 } // for x
1380}
1381
1382
1383

Callers

nothing calls this directly

Calls 5

GetWaterSimulatorMethod · 0.80
GetLavaSimulatorMethod · 0.80
GetRedstoneSimulatorMethod · 0.80
IsAllowedBlockMethod · 0.45
AddBlockMethod · 0.45

Tested by

no test coverage detected