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

Method SetBlock

src/ChunkMap.cpp:1262–1281  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1260
1261
1262void cChunkMap::SetBlock(cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, BLOCKTYPE a_BlockMeta)
1263{
1264 cChunkInterface ChunkInterface(this);
1265 if (a_BlockType == E_BLOCK_AIR)
1266 {
1267 BlockHandler(GetBlock(a_BlockX, a_BlockY, a_BlockZ))->OnDestroyed(ChunkInterface, a_WorldInterface, a_BlockX, a_BlockY, a_BlockZ);
1268 }
1269
1270 int ChunkX, ChunkZ, X = a_BlockX, Y = a_BlockY, Z = a_BlockZ;
1271 cChunkDef::AbsoluteToRelative( X, Y, Z, ChunkX, ChunkZ );
1272
1273 cCSLock Lock(m_CSLayers);
1274 cChunkPtr Chunk = GetChunk( ChunkX, ZERO_CHUNK_Y, ChunkZ );
1275 if ((Chunk != NULL) && Chunk->IsValid())
1276 {
1277 Chunk->SetBlock(X, Y, Z, a_BlockType, a_BlockMeta );
1278 m_World->GetSimulatorManager()->WakeUp(a_BlockX, a_BlockY, a_BlockZ, Chunk);
1279 }
1280 BlockHandler(a_BlockType)->OnPlaced(ChunkInterface, a_WorldInterface, a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta);
1281}
1282
1283
1284

Callers 4

LockedSetBlockMethod · 0.45
ReplaceBlocksMethod · 0.45
ReplaceTreeBlocksMethod · 0.45
DigBlockMethod · 0.45

Calls 6

BlockHandlerFunction · 0.85
GetSimulatorManagerMethod · 0.80
OnDestroyedMethod · 0.45
IsValidMethod · 0.45
WakeUpMethod · 0.45
OnPlacedMethod · 0.45

Tested by

no test coverage detected