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

Method TryToSpawnHere

src/MobSpawner.cpp:301–335  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

299
300
301cMonster* cMobSpawner::TryToSpawnHere(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ, EMCSBiome a_Biome, int& a_MaxPackSize)
302{
303 cMonster* toReturn = NULL;
304 if (m_NewPack)
305 {
306 m_MobType = ChooseMobType(a_Biome);
307 if (m_MobType == cMonster::mtInvalidType)
308 {
309 return toReturn;
310 }
311 if (m_MobType == cMonster::mtWolf)
312 {
313 a_MaxPackSize = 8;
314 }
315 else if (m_MobType == cMonster::mtGhast)
316 {
317 a_MaxPackSize = 1;
318 }
319 m_NewPack = false;
320 }
321
322 // Make sure we are looking at the right chunk to spawn in
323 a_Chunk = a_Chunk->GetRelNeighborChunkAdjustCoords(a_RelX, a_RelZ);
324
325 if (CanSpawnHere(a_Chunk, a_RelX, a_RelY, a_RelZ, m_MobType, a_Biome))
326 {
327 cMonster * newMob = cMonster::NewMonsterFromType(m_MobType);
328 if (newMob)
329 {
330 m_Spawned.insert(newMob);
331 }
332 toReturn = newMob;
333 }
334 return toReturn;
335}
336
337
338

Callers 1

SpawnMobsMethod · 0.80

Calls 1

Tested by

no test coverage detected