6 #include "../Entities/Player.h"
7 #include "../Items/ItemHandler.h"
8 #include "../BoundingBox.h"
24 Super(
"Ocelot",
mtOcelot,
"entity.cat.hurt",
"entity.cat.death",
"entity.cat.ambient", 0.6f, 0.7f),
28 m_CatType(ctWildOcelot),
29 m_CheckPlayerTickCount(),
103 bool OwnerFlying =
false;
104 auto Callback = [&](
cPlayer & a_Player)
106 OwnerPos = a_Player.GetPosition();
107 OwnerFlying = a_Player.IsFlying();
161 if (Random.RandBool(1.0 / 3.0))
203 (a_Entity.GetEntityType() == cEntity::etMonster) &&
204 (static_cast<cMonster &>(a_Entity).GetMobType() == eMonsterType::mtOcelot) &&
205 (static_cast<cOcelot &>(a_Entity).IsSitting())
MTRand & GetRandomProvider()
Returns the current thread's random number source.
Vector3< double > Vector3d
unsigned char Distance(const BlockState Block)
Represents two sets of coords, minimum and maximum for each direction.
virtual void TeleportToCoords(double a_PosX, double a_PosY, double a_PosZ)
Teleports to the coordinates specified.
bool IsTicking(void) const
Returns true if the entity is valid and ticking.
void SetMaxHealth(float a_MaxHealth)
Sets the maximum value for the health.
const Vector3d & GetPosition(void) const
Exported in ManualBindings.
const AString & GetName(void) const
const cUUID & GetUUID(void) const
Returns the UUID that has been read from the client, or nil if not available.
const cItem & GetEquippedItem(void) const
bool IsGameModeCreative(void) const
Returns true if the player is in Creative mode, either explicitly, or by inheriting from current worl...
cInventory & GetInventory(void)
bool RemoveOneEquippedItem(void)
Removes one item out of the currently equipped item stack, returns true if successful,...
This class bridges a vector of cItem for safe access via Lua.
bool ContainsType(const cItem &a_Item)
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.
int FindFirstNonAirBlockPosition(double a_PosX, double a_PosZ)
Finds the lowest non-air block position (not the highest, as cWorld::GetHeight does) If current Y is ...
void StopMovingToPosition()
Stops pathfinding.
bool IsBegging(void) const
static bool IsCatSittingOnBlock(cWorld *a_World, Vector3d a_BlockPosition)
Returns true if there's a cat sitting above the given position.
virtual void TickFollowPlayer()
void SetIsTame(bool a_IsTame)
void SetOwner(const AString &a_NewOwnerName, const cUUID &a_NewOwnerUUID)
void SetIsBegging(bool a_IsBegging)
bool IsSitting(void) const override
virtual void GetBreedingItems(cItems &a_Items) override
Returns the items that make the animal breed - this is usually the same as the ones that make the ani...
void SetCatType(eCatType a_CatType)
virtual void OnRightClicked(cPlayer &a_Player) override
Called when the specified player right-clicks this entity.
int m_CheckPlayerTickCount
Only check for a nearby player holding the breeding items every 23 ticks.
virtual bool DoTakeDamage(TakeDamageInfo &a_TDI) override
When hit by someone, run away.
bool IsTame(void) const override
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk &a_Chunk) override
void SetIsSitting(bool a_IsSitting)
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk &a_Chunk) override
virtual void OnRightClicked(cPlayer &a_Player) override
Called when the specified player right-clicks this entity.
virtual bool DoTakeDamage(TakeDamageInfo &a_TDI) override
When hit by someone, run away.
bool DoWithPlayerByUUID(const cUUID &a_PlayerUUID, cPlayerListCallback a_Callback)
Finds the player over his uuid and calls the callback.
virtual void BroadcastEntityMetadata(const cEntity &a_Entity, const cClientHandle *a_Exclude=nullptr) override
virtual void BroadcastEntityAnimation(const cEntity &a_Entity, EntityAnimation a_Animation, const cClientHandle *a_Exclude=nullptr) override
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.
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,...