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

Method GetHeight

src/ChunkMap.cpp:1018–1040  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1016
1017
1018int cChunkMap::GetHeight(int a_BlockX, int a_BlockZ)
1019{
1020 for (;;)
1021 {
1022 cCSLock Lock(m_CSLayers);
1023 int ChunkX, ChunkZ, BlockY = 0;
1024 cChunkDef::AbsoluteToRelative(a_BlockX, BlockY, a_BlockZ, ChunkX, ChunkZ);
1025 cChunkPtr Chunk = GetChunk(ChunkX, ZERO_CHUNK_Y, ChunkZ);
1026 if (Chunk == NULL)
1027 {
1028 return 0;
1029 }
1030
1031 if (Chunk->IsValid())
1032 {
1033 return Chunk->GetHeight(a_BlockX, a_BlockZ);
1034 }
1035
1036 // The chunk is not valid, wait for it to become valid:
1037 cCSUnlock Unlock(Lock);
1038 m_evtChunkValid.Wait();
1039 } // while (true)
1040}
1041
1042
1043

Callers 2

TryGetHeightMethod · 0.45
ItemMethod · 0.45

Calls 2

IsValidMethod · 0.45
WaitMethod · 0.45

Tested by

no test coverage detected