summaryrefslogtreecommitdiffstats
path: root/source/Chunk.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/Chunk.cpp')
-rw-r--r--source/Chunk.cpp37
1 files changed, 17 insertions, 20 deletions
diff --git a/source/Chunk.cpp b/source/Chunk.cpp
index c9d457af3..c419cf7f2 100644
--- a/source/Chunk.cpp
+++ b/source/Chunk.cpp
@@ -519,32 +519,29 @@ void cChunk::SpawnMobs(cMobSpawner& a_MobSpawner)
ASSERT(Try_Y > 0);
ASSERT(Try_Y < cChunkDef::Height-1);
- BLOCKTYPE BlockType;
- NIBBLETYPE BlockMeta;
- BLOCKTYPE BlockType_below;
- NIBBLETYPE BlockMeta_below;
- BLOCKTYPE BlockType_above;
- NIBBLETYPE BlockMeta_above;
- if (UnboundedRelGetBlock(Try_X, Try_Y , Try_Z, BlockType, BlockMeta) &&
- UnboundedRelGetBlock(Try_X, Try_Y-1, Try_Z, BlockType_below, BlockMeta_below)&&
- UnboundedRelGetBlock(Try_X, Try_Y+1, Try_Z, BlockType_above, BlockMeta_above)
- )
- {
- EMCSBiome Biome = m_ChunkMap->GetBiomeAt (Try_X, Try_Z);
- // MG TODO :
- // Moon cycle (for slime)
- // check player and playerspawn presence < 24 blocks
- // check mobs presence on the block
+ EMCSBiome Biome = m_ChunkMap->GetBiomeAt (Try_X, Try_Z);
+ // MG TODO :
+ // Moon cycle (for slime)
+ // check player and playerspawn presence < 24 blocks
+ // check mobs presence on the block
- // MG TODO: fix the "light" thing, I'm pretty sure that UnboundedRelGetBlock s not returning the right thing
+ // MG TODO : check that "Level" really means Y
+
+ NIBBLETYPE SkyLight = 0;
- // MG TODO : check that "Level" really means Y
- cEntity* newMob = a_MobSpawner.TryToSpawnHere(BlockType, BlockMeta, BlockType_below, BlockMeta_below, BlockType_above, BlockMeta_above, Biome, Try_Y, MaxNbOfSuccess);
+ NIBBLETYPE BlockLight = 0;
+
+ if (IsLightValid())
+ {
+ int TimeOfDay = m_World->GetTimeOfDay();
+ cEntity* newMob = a_MobSpawner.TryToSpawnHere(this, Try_X, Try_Y, Try_Z, Biome, TimeOfDay, MaxNbOfSuccess);
if (newMob)
{
int WorldX, WorldY, WorldZ;
PositionToWorldPosition(Try_X, Try_Y, Try_Z, WorldX, WorldY, WorldZ);
- newMob->SetPosition(WorldX, WorldY, WorldZ);
+ double ActualX = WorldX + 0.5;
+ double ActualZ = WorldZ + 0.5;
+ newMob->SetPosition(ActualX, WorldY, ActualZ);
LOGD("Spawning %s #%i at %d,%d,%d",newMob->GetClass(),newMob->GetUniqueID(),WorldX, WorldY, WorldZ);
NumberOfSuccess++;
}