summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Enderman.cpp
diff options
context:
space:
mode:
authorSTRWarrior <niels.breuker@hotmail.nl>2014-07-30 19:18:11 +0200
committerSTRWarrior <niels.breuker@hotmail.nl>2014-07-30 19:18:11 +0200
commitc4e6a1423506c253974c7512a4b9b854a1e41b54 (patch)
tree667c563e244cdcd8e761fee58bb3e15f97d62484 /src/Mobs/Enderman.cpp
parentRemoved lighting code in cEnderman::CheckEventSeePlayer (diff)
downloadcuberite-c4e6a1423506c253974c7512a4b9b854a1e41b54.tar
cuberite-c4e6a1423506c253974c7512a4b9b854a1e41b54.tar.gz
cuberite-c4e6a1423506c253974c7512a4b9b854a1e41b54.tar.bz2
cuberite-c4e6a1423506c253974c7512a4b9b854a1e41b54.tar.lz
cuberite-c4e6a1423506c253974c7512a4b9b854a1e41b54.tar.xz
cuberite-c4e6a1423506c253974c7512a4b9b854a1e41b54.tar.zst
cuberite-c4e6a1423506c253974c7512a4b9b854a1e41b54.zip
Diffstat (limited to '')
-rw-r--r--src/Mobs/Enderman.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Mobs/Enderman.cpp b/src/Mobs/Enderman.cpp
index 9c1cb7ce3..f1f366d3b 100644
--- a/src/Mobs/Enderman.cpp
+++ b/src/Mobs/Enderman.cpp
@@ -116,6 +116,23 @@ void cEnderman::CheckEventSeePlayer()
ASSERT(Callback.GetPlayer() != NULL);
+ int ChunkX, ChunkZ;
+ cChunkDef::BlockToChunk(POSX_TOINT, POSZ_TOINT, ChunkX, ChunkZ);
+
+ // 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
+ if (m_World->GetBlockSkyLight(POSX_TOINT, POSY_TOINT, POSZ_TOINT) <= 7)
+ {
+ // TODO: Teleport the enderman to a random spot.
+ return;
+ }
+
if (!Callback.GetPlayer()->IsGameModeCreative())
{
super::EventSeePlayer(Callback.GetPlayer());