5 #include "../EffectID.h"
6 #include "../Entities/Player.h"
7 #include "../UI/HorseWindow.h"
14 Super(
"Horse",
mtHorse,
"entity.horse.hurt",
"entity.horse.death",
"entity.horse.ambient", 1.4f, 1.6f),
19 m_bIsMouthOpen(false),
24 m_TimesToTame(TameTimes),
25 m_TameAttemptTimes(0),
44 bool MetadataDirty =
false;
49 if (Random.RandBool(0.02))
57 if (Random.RandBool(0.10))
68 if (Random.RandBool(0.02))
116 if (Window !=
nullptr)
118 Window->OwnerDestroyed();
261 unsigned int LootingLevel = 0;
262 if (a_Killer !=
nullptr)
309 if (Window ==
nullptr)
@ E_ITEM_IRON_HORSE_ARMOR
@ E_ITEM_GOLD_HORSE_ARMOR
@ E_ITEM_DIAMOND_HORSE_ARMOR
MTRand & GetRandomProvider()
Returns the current thread's random number source.
bool IsHorseArmor(short a_ItemType)
unsigned int GetLevel(int a_EnchantmentID) const
Returns the level for the specified enchantment; 0 if not stored.
bool IsPlayer(void) const
cEntity * m_Attachee
The entity which is attached to this entity (rider), nullptr if none.
void Detach(void)
Detaches from the currently attached entity, if any.
bool IsTicking(void) const
Returns true if the entity is valid and ticking.
virtual void HandleSpeedFromAttachee(float a_Forward, float a_Sideways)
UInt32 GetUniqueID(void) const
virtual cItem GetEquippedWeapon(void) const
Returns the curently equipped weapon; empty item if none.
const Vector3d & GetPosition(void) const
Exported in ManualBindings.
void AttachTo(cEntity &a_AttachTo)
Attaches to the specified entity; detaches from any previous one first.
const cItem & GetEquippedItem(void) const
void OpenWindow(cWindow &a_Window)
Opens the specified window; closes the current one first using CloseWindow()
virtual bool IsCrouched(void) const override
cEnchantments m_Enchantments
bool IsEmpty(void) const
Returns true if the item represents an empty stack - either the type is invalid, or count is zero.
This class bridges a vector of cItem for safe access via Lua.
int GetHorseArmour(void) const
void SetHorseSaddle(cItem a_SaddleItem)
Set the horse's saddle to the given item.
bool IsSaddled(void) const
virtual void InStateIdle(std::chrono::milliseconds a_Dt, cChunk &a_Chunk) override
void PlayerOpenWindow(cPlayer &a_Player)
virtual void OnRemoveFromWorld(cWorld &a_World) override
Called when the entity is removed from a world.
virtual void HandleSpeedFromAttachee(float a_Forward, float a_Sideways) override
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk &a_Chunk) override
void SetHorseArmor(cItem a_ArmorItem)
Set the horse's armor slot to the given item.
cHorse(int Type, int Color, int Style, int TameTimes)
virtual void OnRightClicked(cPlayer &a_Player) override
Called when the specified player right-clicks this entity.
virtual void GetDrops(cItems &a_Drops, cEntity *a_Killer=nullptr) override
Returns the list of drops for this pawn when it is killed.
void AddRandomDropItem(cItems &a_Drops, unsigned int a_Min, unsigned int a_Max, short a_Item, short a_ItemHealth=0)
Adds a random number of a_Item between a_Min and a_Max to itemdrops a_Drops.
bool m_IsLeashActionJustDone
Mob has ben leashed or unleashed in current player action.
virtual void InStateIdle(std::chrono::milliseconds a_Dt, cChunk &a_Chunk)
virtual void OnRemoveFromWorld(cWorld &a_World) override
Called when the entity is removed from a world.
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.
cWindow * GetWindow(void) const
void OpenWindow(cWindow *a_Window)
Window owner that is associated with an entity (chest minecart etc.)
virtual void BroadcastEntityMetadata(const cEntity &a_Entity, const cClientHandle *a_Exclude=nullptr) override
virtual void BroadcastParticleEffect(const AString &a_ParticleName, Vector3f a_Src, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, const cClientHandle *a_Exclude=nullptr) override
virtual void BroadcastSoundParticleEffect(const EffectID a_EffectID, Vector3i a_SrcPos, int a_Data, const cClientHandle *a_Exclude=nullptr) override
virtual void BroadcastSoundEffect(const AString &a_SoundName, Vector3d a_Position, float a_Volume, float a_Pitch, const cClientHandle *a_Exclude=nullptr) override