diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-07-31 19:17:21 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-07-31 19:17:21 +0200 |
commit | ffd6797fe106c805646e2acfe5320594cc59ece4 (patch) | |
tree | 032bba61fa8edda02e4cad6587ac691299b24142 /src/Mobs | |
parent | Added lighting code and added comments (diff) | |
download | cuberite-ffd6797fe106c805646e2acfe5320594cc59ece4.tar cuberite-ffd6797fe106c805646e2acfe5320594cc59ece4.tar.gz cuberite-ffd6797fe106c805646e2acfe5320594cc59ece4.tar.bz2 cuberite-ffd6797fe106c805646e2acfe5320594cc59ece4.tar.lz cuberite-ffd6797fe106c805646e2acfe5320594cc59ece4.tar.xz cuberite-ffd6797fe106c805646e2acfe5320594cc59ece4.tar.zst cuberite-ffd6797fe106c805646e2acfe5320594cc59ece4.zip |
Diffstat (limited to 'src/Mobs')
-rw-r--r-- | src/Mobs/Enderman.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/Mobs/Enderman.cpp b/src/Mobs/Enderman.cpp index f1f366d3b..a32e4e175 100644 --- a/src/Mobs/Enderman.cpp +++ b/src/Mobs/Enderman.cpp @@ -22,7 +22,7 @@ public: virtual bool Item(cPlayer * a_Player) override { - // Don't check players who are in creative gamemode. + // Don't check players who are in creative gamemode if (a_Player->IsGameModeCreative()) { return false; @@ -30,13 +30,13 @@ public: Vector3d Direction = m_EndermanPos - a_Player->GetPosition(); - // Don't check players who are more then 64 blocks away. + // Don't check players who are more then 64 blocks away if (Direction.SqrLength() > 64) { return false; } - // Don't check if the player has a pumpkin on his head. + // Don't check if the player has a pumpkin on his head if (a_Player->GetEquippedHelmet().m_ItemType == E_BLOCK_PUMPKIN) { return false; @@ -46,9 +46,8 @@ public: Vector3d LookVector = a_Player->GetLookVector(); double dot = Direction.Dot(LookVector); - // 0.09 rad ~ 5 degrees. - // If the players crosshair is within 5 degrees of the endermen - // It counts as looking. + // 0.09 rad ~ 5 degrees + // If the player's crosshair is within 5 degrees of the enderman, it counts as looking if (dot > cos(0.09)) { return false; @@ -119,17 +118,17 @@ void cEnderman::CheckEventSeePlayer() int ChunkX, ChunkZ; cChunkDef::BlockToChunk(POSX_TOINT, POSZ_TOINT, ChunkX, ChunkZ); - // Check if the chunk the enderman is in is lit. + // Check if the chunk the enderman is in is lit if (!m_World->IsChunkLighted(ChunkX, ChunkZ)) { m_World->QueueLightChunk(ChunkX, ChunkZ); return; } - // Enderman only attack if the skylight is higher than 6 + // Enderman only attack if the skylight is higher than 7 if (m_World->GetBlockSkyLight(POSX_TOINT, POSY_TOINT, POSZ_TOINT) <= 7) { - // TODO: Teleport the enderman to a random spot. + // TODO: Teleport the enderman to a random spot return; } |