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

Method GetBiome

Tools/BiomeVisualiser/BiomeCache.cpp:75–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73
74
75cBiomeSource::eAvailability cBiomeCache::GetBiome(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_Biomes)
76{
77 if (m_Source == NULL)
78 {
79 return baNever;
80 }
81
82 // Look up using the cache:
83 int x = a_ChunkX - m_BaseX;
84 int z = a_ChunkZ - m_BaseZ;
85 if ((x < 0) || (x >= m_Width) || (z < 0) || (z >= m_Height))
86 {
87 // Outside the cached region
88 return baNever;
89 }
90
91 cCSLock Lock(m_CS);
92 cItem * Item = m_Available[x + m_Width * z];
93 if (Item == NULL)
94 {
95 // Item hasn't been processed yet
96 return baLater;
97 }
98 if (Item->m_IsValid)
99 {
100 memcpy(a_Biomes, Item->m_Biomes, sizeof(a_Biomes));
101 return baNow;
102 }
103
104 // Item has been processed, but the underlying source refused to give the data to us
105 return baNever;
106}
107
108
109

Callers 2

thrProcessQueueItemMethod · 0.45
RenderMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected