6 #include "../Entities/Player.h" 7 #include "../BoundingBox.h" 8 #include "../Items/ItemSpawnEgg.h" 14 super(a_ConfigName, a_MobType, a_SoundHurt, a_SoundDeath, a_Width, a_Height),
15 m_LovePartner(nullptr),
137 if (FollowedItems.
Size() > 0)
171 if (PotentialPartner.GetMobType() != Me.GetMobType())
178 if ((!PotentialPartner.IsInLove()) || (PotentialPartner.GetPartner() !=
nullptr))
185 Me.EngageLoveMode(&PotentialPartner);
double GetPosY(void) const
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...
virtual UInt32 SpawnMob(double a_PosX, double a_PosY, double a_PosZ, eMonsterType a_MonsterType, bool a_Baby=false) override
Spawns a mob of the specified type.
double GetPosX(void) const
virtual void Destroyed() override
eEntityType GetEntityType(void) const
eMonsterType GetMobType(void) const
bool RemoveOneEquippedItem(void)
Removes one item out of the currently equipped item stack, returns true if successful, false if empty-handed.
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk &a_Chunk) override
MTRand & GetRandomProvider()
Returns the current thread's random number source.
virtual void BroadcastEntityMetadata(const cEntity &a_Entity, const cClientHandle *a_Exclude=nullptr) override
virtual void Destroyed(void) override
virtual bool DoTakeDamage(TakeDamageInfo &a_TDI) override
When hit by someone, run away.
const cItem & GetEquippedItem(void) const
void EngageLoveMode(cPassiveMonster *a_Partner)
Start the mating process.
bool IsInLove() const
Returns whether the monster has just been fed and is ready to mate.
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...
Represents two sets of coords, minimum and maximum for each direction.
bool DoWithEntityByID(UInt32 a_UniqueID, cEntityCallback a_Callback)
Calls the callback if the entity with the specified ID is found, with the entity object as the callba...
enum cMonster::MState m_EMState
eMonsterType
Identifies individual monster type, as well as their network type-ID.
static eMonsterType ItemDamageToMonsterType(short a_ItemDamage)
Converts the Spawn egg item damage to the monster type to spawn.
UInt32 SpawnExperienceOrb(Vector3d a_Pos, int a_Reward)
Spawns an experience orb at the given location with the given reward.
cPassiveMonster(const AString &a_ConfigName, eMonsterType a_MobType, const AString &a_SoundHurt, const AString &a_SoundDeath, double a_Width, double a_Height)
virtual void CheckEventLostPlayer(void)
int m_LoveTimer
If above 0, the monster is in love mode, and will breed if a nearby monster is also in love mode...
bool IsTicking(void) const
Returns true if the entity is valid and ticking.
virtual bool DoTakeDamage(TakeDamageInfo &a_TDI) override
Makes this entity take damage specified in the a_TDI.
bool DoWithNearestPlayer(Vector3d a_Pos, double a_RangeLimit, cPlayerListCallback a_Callback, bool a_CheckLineOfSight=true, bool a_IgnoreSpectator=true)
Calls the callback for nearest player for given position, Returns false if player not found...
bool ContainsType(const cItem &a_Item)
void ResetLoveMode()
Finish the mating process.
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk &a_Chunk) override
virtual void GetBreedingItems(cItems &a_Items)
Returns the items that make the animal breed - this is usually the same as the ones that make the ani...
virtual void InheritFromParents(cPassiveMonster *a_Parent1, cPassiveMonster *a_Parent2)
Called after the baby is born, allows the baby to inherit the parents' properties (color...
virtual void GetFollowedItems(cItems &a_Items)
Returns the items that the animal of this class follows when a player holds it in hand...
cPassiveMonster * m_LovePartner
The monster's breeding partner.
int m_LoveCooldown
If above 0, the monster is in cooldown mode and will refuse to breed.
int m_MatingTimer
The monster is engaged in mating, once this reaches zero, a baby will be born.
const Vector3d & GetPosition(void) const
Exported in ManualBindings.
virtual void OnRightClicked(cPlayer &a_Player) override
Called when the specified player right-clicks this entity.
double GetPosZ(void) const
bool IsGameModeCreative(void) const
Returns true if the player is in Creative mode, either explicitly, or by inheriting from current worl...
virtual void OnRightClicked(cPlayer &a_Player) override
Called when the specified player right-clicks this entity.
cInventory & GetInventory(void)
static const UInt32 INVALID_ID
Special ID that is considered an "invalid value", signifying no entity.
enum cMonster::MPersonality m_EMPersonality
virtual void BroadcastEntityStatus(const cEntity &a_Entity, Int8 a_Status, const cClientHandle *a_Exclude=nullptr) override
This class bridges a vector of cItem for safe access via Lua.