summaryrefslogtreecommitdiffstats
path: root/source/Chunk.cpp
diff options
context:
space:
mode:
authorSamuel Barney <samjbarney@gmail.com>2013-10-28 16:49:06 +0100
committerSamuel Barney <samjbarney@gmail.com>2013-10-28 16:49:06 +0100
commit16bac5ace9a2388cee3fd0d9192b7cd69a06152d (patch)
treeec59166cffd2fa6ade2f3754dbf76e000d387608 /source/Chunk.cpp
parentDisabling Endermen and spiders until I rework the CanSpawnHere to take a chunk and a position. (diff)
downloadcuberite-16bac5ace9a2388cee3fd0d9192b7cd69a06152d.tar
cuberite-16bac5ace9a2388cee3fd0d9192b7cd69a06152d.tar.gz
cuberite-16bac5ace9a2388cee3fd0d9192b7cd69a06152d.tar.bz2
cuberite-16bac5ace9a2388cee3fd0d9192b7cd69a06152d.tar.lz
cuberite-16bac5ace9a2388cee3fd0d9192b7cd69a06152d.tar.xz
cuberite-16bac5ace9a2388cee3fd0d9192b7cd69a06152d.tar.zst
cuberite-16bac5ace9a2388cee3fd0d9192b7cd69a06152d.zip
Diffstat (limited to '')
-rw-r--r--source/Chunk.cpp52
1 files changed, 20 insertions, 32 deletions
diff --git a/source/Chunk.cpp b/source/Chunk.cpp
index 0892020e2..637b72b2b 100644
--- a/source/Chunk.cpp
+++ b/source/Chunk.cpp
@@ -519,42 +519,30 @@ 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 : check that "Level" really means Y
-
- NIBBLETYPE SkyLight = 0;
+ // MG TODO : check that "Level" really means Y
+
+ NIBBLETYPE SkyLight = 0;
- NIBBLETYPE BlockLight = 0;
+ NIBBLETYPE BlockLight = 0;
- if (IsLightValid() && (UnboundedRelGetBlockBlockLight(Try_X, Try_Y, Try_Z, BlockLight)) && (UnboundedRelGetBlockSkyLight(Try_X, Try_Y, Try_Z, SkyLight)))
+ if (IsLightValid())
+ {
+ cEntity* newMob = a_MobSpawner.TryToSpawnHere(this, Try_X, Try_Y, Try_Z, Biome, MaxNbOfSuccess);
+ if (newMob)
{
- cEntity* newMob = a_MobSpawner.TryToSpawnHere(BlockType, BlockMeta, BlockType_below, BlockMeta_below, BlockType_above, BlockMeta_above, SkyLight, BlockLight, Biome, Try_Y, MaxNbOfSuccess);
- if (newMob)
- {
- int WorldX, WorldY, WorldZ;
- PositionToWorldPosition(Try_X, Try_Y, Try_Z, 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++;
- }
+ int WorldX, WorldY, WorldZ;
+ PositionToWorldPosition(Try_X, Try_Y, Try_Z, 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++;
}
}