15 Super(a_ConfigName, a_MobType, a_SoundHurt, a_SoundDeath, a_SoundAmbient, a_Width, a_Height)
53 auto MinimumDistance =
static_cast<double>(a_SightDistance * a_SightDistance);
55 class cCallback :
public cBlockTracer::cCallbacks
64 auto Callbacks = cCallback();
69 if (!a_Entity.IsMob())
74 auto & Other =
dynamic_cast<cMonster &
>(a_Entity);
75 if (Other.GetMobType() != a_MobType)
81 Vector3d TargetPosition = Other.GetPosition().
addedY(Other.GetHeight());
82 double TargetDistance = (MyHeadPosition - TargetPosition).SqrLength();
85 (MinimumDistance > TargetDistance) &&
86 (TargetDistance < (a_SightDistance * a_SightDistance))
89 FoundTarget = & Other;
154 double KnockbackAmount = 9;
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
unsigned char BLOCKTYPE
The datatype used by blockdata.
eBlockFace
Block face constants, used in PlayerDigging and PlayerBlockPlacement packets and bbox collision calc.
eMonsterType
Identifies individual monster type.
Represents two sets of coords, minimum and maximum for each direction.
bool IsTicking(void) const
Returns true if the entity is valid and ticking.
void TakeDamage(cEntity &a_Attacker)
Makes this pawn take damage from an attack by a_Attacker.
float GetHeight(void) const
float GetHealth(void) const
Returns the health of this entity.
const Vector3d & GetPosition(void) const
Exported in ManualBindings.
cWorld * GetWorld(void) const
static bool LineOfSightTrace(cWorld &a_World, const Vector3d &a_Start, const Vector3d &a_End, int a_Sight)
Returns true if the two positions are within line of sight (not obscured by blocks).
virtual void EventSeePlayer(cPlayer *a_Player, cChunk &a_Chunk) override
virtual bool Attack(std::chrono::milliseconds a_Dt)
Try to perform attack returns true if attack was deemed successful (hit player, fired projectile,...
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk &a_Chunk) override
virtual void InStateChasing(std::chrono::milliseconds a_Dt, cChunk &a_Chunk) override
cMonster * GetMonsterOfTypeInSight(eMonsterType a_mobtype, unsigned int SightDistance=16)
Check if a monster of certain type is in sight.
cAggressiveMonster(const AString &a_ConfigName, eMonsterType a_MobType, const AString &a_SoundHurt, const AString &a_SoundDeath, const AString &a_SoundAmbient, float a_Width, float a_Height)
virtual bool IsNetherNative(void)
Returns whether this mob spawns in the Nether in Vanilla.
void ResetAttackCooldown()
virtual void InStateChasing(std::chrono::milliseconds a_Dt, cChunk &a_Chunk)
virtual void CheckEventLostPlayer(std::chrono::milliseconds a_Dt)
virtual void MoveToPosition(const Vector3d &a_Position)
Engage pathfinder and tell it to calculate a path to a given position, and move the mob accordingly.
cPawn * GetTarget()
Returns the current target.
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk &a_Chunk) override
bool TargetIsInRange(void)
Returns whether or not the target is close enough for attack.
enum cMonster::MState m_EMState
virtual void EventSeePlayer(cPlayer *a_Player, cChunk &a_Chunk)
int m_AttackCoolDownTicksLeft
enum cMonster::MPersonality m_EMPersonality
virtual void CheckEventSeePlayer(cChunk &a_Chunk)
Vector3< T > addedY(T a_AddY) const
Returns a copy of this vector moved by the specified amount on the y axis.
virtual bool ForEachEntityInBox(const cBoundingBox &a_Box, cEntityCallback a_Callback) override
Calls the callback for each entity that has a nonempty intersection with the specified boundingbox.