summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Enderman.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Mobs/Enderman.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/Mobs/Enderman.cpp b/src/Mobs/Enderman.cpp
index ac749e36a..4a30a0acd 100644
--- a/src/Mobs/Enderman.cpp
+++ b/src/Mobs/Enderman.cpp
@@ -28,32 +28,32 @@ public:
{
return false;
}
-
+
Vector3d Direction = m_EndermanPos - a_Player->GetPosition();
-
+
// Don't check players who are more then SightDistance (64) blocks away
if (Direction.Length() > m_SightDistance)
{
return false;
}
-
+
// Don't check if the player has a pumpkin on his head
if (a_Player->GetEquippedHelmet().m_ItemType == E_BLOCK_PUMPKIN)
{
return false;
}
-
+
Vector3d LookVector = a_Player->GetLookVector();
double dot = Direction.Dot(LookVector);
-
+
// 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;
}
-
+
cTracer LineOfSight(a_Player->GetWorld());
if (LineOfSight.Trace(m_EndermanPos, Direction, static_cast<int>(Direction.Length())))
{
@@ -64,7 +64,7 @@ public:
m_Player = a_Player;
return true;
}
-
+
cPlayer * GetPlayer(void) const { return m_Player; }
protected:
@@ -102,7 +102,7 @@ void cEnderman::GetDrops(cItems & a_Drops, cEntity * a_Killer)
-void cEnderman::CheckEventSeePlayer()
+void cEnderman::CheckEventSeePlayer(cChunk & a_Chunk)
{
if (m_Target != nullptr)
{
@@ -114,7 +114,7 @@ void cEnderman::CheckEventSeePlayer()
{
return;
}
-
+
ASSERT(Callback.GetPlayer() != nullptr);
if (!CheckLight())
@@ -126,7 +126,7 @@ void cEnderman::CheckEventSeePlayer()
if (!Callback.GetPlayer()->IsGameModeCreative())
{
- cMonster::EventSeePlayer(Callback.GetPlayer());
+ cMonster::EventSeePlayer(Callback.GetPlayer(), a_Chunk);
m_EMState = CHASING;
m_bIsScreaming = true;
GetWorld()->BroadcastEntityMetadata(*this);
@@ -145,7 +145,7 @@ void cEnderman::CheckEventLostPlayer(void)
EventLosePlayer();
}
}
-
+