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

Method GetChunk

src/ChunkMap.cpp:137–159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

135
136
137cChunkPtr cChunkMap::GetChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ)
138{
139 // No need to lock m_CSLayers, since it's already locked by the operation that called us
140 ASSERT(m_CSLayers.IsLockedByCurrentThread());
141
142 cChunkLayer * Layer = GetLayerForChunk( a_ChunkX, a_ChunkZ );
143 if (Layer == NULL)
144 {
145 // An error must have occurred, since layers are automatically created if they don't exist
146 return NULL;
147 }
148
149 cChunkPtr Chunk = Layer->GetChunk(a_ChunkX, a_ChunkY, a_ChunkZ);
150 if (Chunk == NULL)
151 {
152 return NULL;
153 }
154 if (!(Chunk->IsValid()))
155 {
156 m_World->GetStorage().QueueLoadChunk(a_ChunkX, a_ChunkY, a_ChunkZ, true);
157 }
158 return Chunk;
159}
160
161
162

Callers 2

GetChunkNoGenMethod · 0.80
GetChunkNoLoadMethod · 0.80

Calls 5

QueueLoadChunkMethod · 0.80
FindChunkMethod · 0.80
IsValidMethod · 0.45
GetWorldMethod · 0.45

Tested by

no test coverage detected