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

Method Check

src/Blocks/BlockHandler.cpp:437–457  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

435
436
437void cBlockHandler::Check(cChunkInterface & a_ChunkInterface, cBlockPluginInterface & a_PluginInterface, int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk)
438{
439 if (!CanBeAt(a_ChunkInterface, a_RelX, a_RelY, a_RelZ, a_Chunk))
440 {
441 if (DoesDropOnUnsuitable())
442 {
443 int BlockX = a_RelX + a_Chunk.GetPosX() * cChunkDef::Width;
444 int BlockZ = a_RelZ + a_Chunk.GetPosZ() * cChunkDef::Width;
445 DropBlock(a_ChunkInterface, *a_Chunk.GetWorld(), a_PluginInterface, NULL, BlockX, a_RelY, BlockZ);
446 }
447
448 a_Chunk.SetBlock(a_RelX, a_RelY, a_RelZ, E_BLOCK_AIR, 0);
449 }
450 else
451 {
452 // Wake up the simulators for this block:
453 int BlockX = a_RelX + a_Chunk.GetPosX() * cChunkDef::Width;
454 int BlockZ = a_RelZ + a_Chunk.GetPosZ() * cChunkDef::Width;
455 a_Chunk.GetWorld()->GetSimulatorManager()->WakeUp(BlockX, a_RelY, BlockZ, &a_Chunk);
456 }
457}
458
459
460

Callers 1

CheckBlocksMethod · 0.45

Calls 6

GetSimulatorManagerMethod · 0.80
GetPosXMethod · 0.45
GetPosZMethod · 0.45
GetWorldMethod · 0.45
SetBlockMethod · 0.45
WakeUpMethod · 0.45

Tested by

no test coverage detected