Cuberite
A lightweight, fast and extensible game server for Minecraft
Monster.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include "../Entities/Pawn.h"
5 #include "../UUID.h"
6 #include "MonsterTypes.h"
7 #include "PathFinder.h"
8 
9 
10 class cItem;
11 class cClientHandle;
12 
13 
14 
15 // tolua_begin
16 class cMonster:
17  public cPawn
18 {
19 
20  // tolua_end
21 
22  using Super = cPawn;
23 
24  // tolua_begin
25 
26 public:
27 
28  enum eFamily
29  {
30  mfHostile = 0, // Spider, Zombies ...
31  mfPassive = 1, // Cows, Pigs
32  mfAmbient = 2, // Bats
33  mfWater = 3, // Squid, Guardian
34 
35  mfNoSpawn
36  } ;
37 
38  // tolua_end
39 
42 
48  cMonster(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);
49 
51 
52  virtual void OnRemoveFromWorld(cWorld & a_World) override;
53 
54  virtual void SpawnOn(cClientHandle & a_ClientHandle) override;
55 
56  virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
57 
58  virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) override;
59 
60  virtual void KilledBy(TakeDamageInfo & a_TDI) override;
61 
62  virtual void OnRightClicked(cPlayer & a_Player) override;
63 
64  virtual void HandleFalling(void) override;
65 
67  virtual void MoveToPosition(const Vector3d & a_Position); // tolua_export
68 
69  // tolua_begin
70  eMonsterType GetMobType(void) const { return m_MobType; }
71  eFamily GetMobFamily(void) const;
72  // tolua_end
73 
74  virtual void CheckEventSeePlayer(cChunk & a_Chunk);
75  virtual void EventSeePlayer(cPlayer * a_Player, cChunk & a_Chunk);
76 
77  // tolua_begin
78 
80  bool CanBeLeashed() const { return m_CanBeLeashed; }
81 
83  void SetCanBeLeashed(bool a_CanBeLeashed) { m_CanBeLeashed = a_CanBeLeashed; }
84 
86  bool IsLeashed() const { return (m_LeashedTo != nullptr); }
87 
89  void LeashTo(cEntity & a_Entity, bool a_ShouldBroadcast = true);
90 
92  void Unleash(bool a_ShouldDropLeashPickup);
93 
95  cEntity * GetLeashedTo() const { return m_LeashedTo; }
96 
97  // tolua_end
98 
100  void Unleash(bool a_ShouldDropLeashPickup, bool a_ShouldBroadcast);
101 
103  void SetLeashToPos(Vector3d * pos) { m_LeashToPos = std::unique_ptr<Vector3d>(pos); }
104 
106  Vector3d * GetLeashToPos() const { return m_LeashToPos.get(); }
107 
109  void GetMonsterConfig(const AString & a_Name);
110 
113  virtual bool IsNetherNative(void);
114 
116  virtual bool IsUndead(void);
117 
118  virtual void EventLosePlayer(void);
119  virtual void CheckEventLostPlayer(std::chrono::milliseconds a_Dt);
120 
121  virtual void InStateIdle (std::chrono::milliseconds a_Dt, cChunk & a_Chunk);
122  virtual void InStateChasing (std::chrono::milliseconds a_Dt, cChunk & a_Chunk);
123  virtual void InStateEscaping(std::chrono::milliseconds a_Dt, cChunk & a_Chunk);
124 
125  double GetAttackRate() { return m_AttackRate; }
126  void SetAttackRate(double a_AttackRate) { m_AttackRate = a_AttackRate; }
127  void SetAttackRange(double a_AttackRange) { m_AttackRange = a_AttackRange; }
128  void SetAttackDamage(int a_AttackDamage) { m_AttackDamage = a_AttackDamage; }
129  void SetSightDistance(int a_SightDistance) { m_SightDistance = a_SightDistance; }
130 
136  bool CanPickUpLoot() { return m_CanPickUpLoot; }
137  void SetDropChanceWeapon(float a_DropChanceWeapon) { m_DropChanceWeapon = a_DropChanceWeapon; }
138  void SetDropChanceHelmet(float a_DropChanceHelmet) { m_DropChanceHelmet = a_DropChanceHelmet; }
139  void SetDropChanceChestplate(float a_DropChanceChestplate) { m_DropChanceChestplate = a_DropChanceChestplate; }
140  void SetDropChanceLeggings(float a_DropChanceLeggings) { m_DropChanceLeggings = a_DropChanceLeggings; }
141  void SetDropChanceBoots(float a_DropChanceBoots) { m_DropChanceBoots = a_DropChanceBoots; }
142  void SetCanPickUpLoot(bool a_CanPickUpLoot) { m_CanPickUpLoot = a_CanPickUpLoot; }
143  void ResetAttackCooldown();
144 
145  void SetBurnsInDaylight(bool a_BurnsInDaylight) { m_BurnsInDaylight = a_BurnsInDaylight; } // tolua_export
146  bool BurnsInDaylight() const { return m_BurnsInDaylight; } // tolua_export
147 
148  double GetRelativeWalkSpeed(void) const { return m_RelativeWalkSpeed; } // tolua_export
149  void SetRelativeWalkSpeed(double a_WalkSpeed) { m_RelativeWalkSpeed = a_WalkSpeed; } // tolua_export
150 
151  // Overridables to handle ageable mobs
152  virtual bool IsTame (void) const { return false; }
153  virtual bool IsSitting (void) const { return false; }
154 
155  // tolua_begin
156  bool IsBaby (void) const { return m_Age < 0; }
157  int GetAge (void) const { return m_Age; }
158  void SetAge(int a_Age) { m_Age = a_Age; }
159  // tolua_end
160 
161 
162  // tolua_begin
163 
165  bool HasCustomName(void) const { return !m_CustomName.empty(); }
166 
168  const AString & GetCustomName(void) const { return m_CustomName; }
169 
172  void SetCustomName(const AString & a_CustomName);
173 
176 
179  void SetCustomNameAlwaysVisible(bool a_CustomNameAlwaysVisible);
180 
182  static AString MobTypeToString(eMonsterType a_MobType);
183 
185  static AString MobTypeToVanillaName(eMonsterType a_MobType);
186 
188  static eMonsterType StringToMobType(const AString & a_MobTypeName);
189 
191  static eFamily FamilyFromType(eMonsterType a_MobType);
192 
193  // tolua_end
194 
196  static cTickTime GetSpawnDelay(cMonster::eFamily a_MobFamily);
197 
199  static AString MobTypeToVanillaNBT(eMonsterType a_MobType);
200 
202  void SetTarget (cPawn * a_NewTarget);
203 
206  void UnsafeUnsetTarget();
207 
209  cPawn * GetTarget();
210 
215  static std::unique_ptr<cMonster> NewMonsterFromType(eMonsterType a_MobType);
216 
219 
220  /* the breeding processing */
221 
223  virtual void GetFollowedItems(cItems & a_Items) { }
224 
226  virtual void GetBreedingItems(cItems & a_Items) { GetFollowedItems(a_Items); }
227 
229  virtual void InheritFromParents(cMonster * a_Parent1, cMonster * a_Parent2) { }
230 
232  cMonster * GetPartner(void) const { return m_LovePartner; }
233 
235  void EngageLoveMode(cMonster * a_Partner);
236 
238  void ResetLoveMode();
239 
241  bool IsInLove() const { return (m_LoveTimer > 0); }
242 
244  bool IsInLoveCooldown() const { return (m_LoveCooldown > 0); }
245 
247  void LoveTick(void);
248 
250  void RightClickFeed(cPlayer & a_Player);
251 
252 protected:
253 
256 
259 
262 
265 
270  int FindFirstNonAirBlockPosition(double a_PosX, double a_PosZ);
271 
274 
276  bool TargetIsInRange(void)
277  {
278  ASSERT(GetTarget() != nullptr);
279  return ((GetTarget()->GetPosition() - GetPosition()).SqrLength() < (m_AttackRange * m_AttackRange));
280  }
281 
283  inline bool DoesPosYRequireJump(double a_PosY)
284  {
285  return (a_PosY > GetPosY() + 0.8); // Assume that differences up to 0.8 blocks can be walked instead of jumped
286  }
287 
289  void MoveToWayPoint(cChunk & a_Chunk);
290 
292  void StopMovingToPosition();
293 
295  void SetPitchAndYawFromDestination(bool a_IsFollowingPath);
296 
298 
299  std::chrono::milliseconds m_IdleInterval;
300  std::chrono::milliseconds m_DestroyTimer;
301 
305 
309 
310  double m_AttackRate;
315  std::chrono::milliseconds m_LoseSightAbandonTargetTimer;
316 
323  int m_TicksSinceLastDamaged; // How many ticks ago we were last damaged by a player?
324 
325  void HandleDaylightBurning(cChunk & a_Chunk, bool WouldBurn);
326  bool WouldBurnAt(Vector3d a_Location, cChunk & a_Chunk);
329 
331 
332  int m_Age;
334 
336 
339 
341  std::unique_ptr<Vector3d> m_LeashToPos;
342 
345 
348 
350  void AddRandomDropItem(cItems & a_Drops, unsigned int a_Min, unsigned int a_Max, short a_Item, short a_ItemHealth = 0);
351 
353  void AddRandomUncommonDropItem(cItems & a_Drops, float a_Chance, short a_Item, short a_ItemHealth = 0);
354 
356  void AddRandomRareDropItem(cItems & a_Drops, cItems & a_Items, unsigned int a_LootingLevel);
357 
359  void AddRandomArmorDropItem(cItems & a_Drops, unsigned int a_LootingLevel);
360 
362  void AddRandomWeaponDropItem(cItems & a_Drops, unsigned int a_LootingLevel);
363 
364  /* The breeding processing */
365 
368 
371 
374 
377 
380 
381 private:
386 
388  void CalcLeashActions(std::chrono::milliseconds a_Dt);
389 
390 } ; // tolua_export
#define CLASS_PROTODEF(classname)
Definition: Entity.h:13
std::chrono::duration< signed int, std::ratio_multiply< std::chrono::milliseconds::period, std::ratio< 50 > >> cTickTime
Definition: Globals.h:364
#define ASSERT(x)
Definition: Globals.h:276
eMonsterType
Identifies individual monster type.
Definition: MonsterTypes.h:11
#define WAYPOINT_RADIUS
Definition: PathFinder.h:5
std::string AString
Definition: StringUtils.h:11
Definition: Chunk.h:36
Definition: Entity.h:76
double GetPosY(void) const
Definition: Entity.h:196
const Vector3d & GetPosition(void) const
Exported in ManualBindings.
Definition: Entity.h:297
Definition: Pawn.h:17
cPawn(eEntityType a_EntityType, float a_Width, float a_Height)
Definition: Pawn.cpp:18
Definition: Player.h:29
Definition: Item.h:37
This class bridges a vector of cItem for safe access via Lua.
Definition: Item.h:215
void SetDropChanceBoots(float a_DropChanceBoots)
Definition: Monster.h:141
void SetCanBeLeashed(bool a_CanBeLeashed)
Sets whether the mob can be leashed, for extensibility in plugins.
Definition: Monster.h:83
cMonster(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)
Creates the mob object.
Definition: Monster.cpp:84
std::chrono::milliseconds m_IdleInterval
Definition: Monster.h:299
int m_LoveCooldown
If above 0, the monster is in cooldown mode and will refuse to breed.
Definition: Monster.h:376
int m_AmbientSoundTimer
Definition: Monster.h:330
void SetPitchAndYawFromDestination(bool a_IsFollowingPath)
Sets the body yaw and head yaw.
Definition: Monster.cpp:471
cPathFinder m_PathFinder
The pathfinder instance handles pathfinding for this monster.
Definition: Monster.h:255
virtual bool IsNetherNative(void)
Returns whether this mob spawns in the Nether in Vanilla.
Definition: Monster.cpp:988
void ResetAttackCooldown()
Definition: Monster.cpp:937
void SetCustomName(const AString &a_CustomName)
Sets the custom name of the monster.
Definition: Monster.cpp:946
double m_RelativeWalkSpeed
Definition: Monster.h:328
virtual bool IsSitting(void) const
Definition: Monster.h:153
static AString MobTypeToVanillaName(eMonsterType a_MobType)
Translates MobType enum to the vanilla name of the mob, empty string if unknown.
Definition: Monster.cpp:1025
void SetRelativeWalkSpeed(double a_WalkSpeed)
Definition: Monster.h:149
eFamily GetMobFamily(void) const
Definition: Monster.cpp:1714
void SetCanPickUpLoot(bool a_CanPickUpLoot)
Definition: Monster.h:142
void SetBurnsInDaylight(bool a_BurnsInDaylight)
Definition: Monster.h:145
virtual void InStateChasing(std::chrono::milliseconds a_Dt, cChunk &a_Chunk)
Definition: Monster.cpp:906
int m_JumpCoolDown
Definition: Monster.h:297
Vector3d m_FinalDestination
Coordinates for the ultimate, final destination.
Definition: Monster.h:264
int m_Age
Definition: Monster.h:332
cMonster * GetPartner(void) const
Returns the partner which the monster is currently mating with.
Definition: Monster.h:232
void SetDropChanceLeggings(float a_DropChanceLeggings)
Definition: Monster.h:140
void SetDropChanceHelmet(float a_DropChanceHelmet)
Definition: Monster.h:138
virtual void CheckEventLostPlayer(std::chrono::milliseconds a_Dt)
Definition: Monster.cpp:784
bool WouldBurnAt(Vector3d a_Location, cChunk &a_Chunk)
Definition: Monster.cpp:1651
bool HasCustomName(void) const
Returns true if the monster has a custom name.
Definition: Monster.h:165
int m_SightDistance
Definition: Monster.h:314
AString m_SoundHurt
Definition: Monster.h:306
virtual void GetFollowedItems(cItems &a_Items)
Returns the items that the animal of this class follows when a player holds it in hand.
Definition: Monster.h:223
static cTickTime GetSpawnDelay(cMonster::eFamily a_MobFamily)
Returns the spawn delay (number of game ticks between spawn attempts) for the given mob family.
Definition: Monster.cpp:1186
virtual bool IsTame(void) const
Definition: Monster.h:152
void LoveTick(void)
Does the whole love and breeding processing.
Definition: Monster.cpp:1354
virtual void SpawnOn(cClientHandle &a_ClientHandle) override
Descendants override this function to send a command to the specified client to spawn the entity on t...
Definition: Monster.cpp:167
void AddRandomRareDropItem(cItems &a_Drops, cItems &a_Items, unsigned int a_LootingLevel)
Adds one rare item out of the list of rare items a_Items modified by the looting level a_LootingLevel...
Definition: Monster.cpp:1549
virtual void KilledBy(TakeDamageInfo &a_TDI) override
Called when the health drops below zero.
Definition: Monster.cpp:602
cUUID m_Feeder
Remembers the player is was last fed by for statistics tracking.
Definition: Monster.h:370
static std::unique_ptr< cMonster > NewMonsterFromType(eMonsterType a_MobType)
Creates a new object of the specified mob.
Definition: Monster.cpp:1252
void SetAge(int a_Age)
Definition: Monster.h:158
void SetTarget(cPawn *a_NewTarget)
Sets the target that this mob will chase.
Definition: Monster.cpp:1204
void SetLeashToPos(Vector3d *pos)
Sets entity position to where is leashed this mob.
Definition: Monster.h:103
void GetMonsterConfig(const AString &a_Name)
Reads the monster configuration for the specified monster name and assigns it to this object.
Definition: Monster.cpp:979
cMonster * m_LovePartner
The monster's breeding partner.
Definition: Monster.h:367
const AString & GetCustomName(void) const
Gets the custom name of the monster.
Definition: Monster.h:168
bool IsInLoveCooldown() const
Returns whether the monster is tired of breeding and is in the cooldown state.
Definition: Monster.h:244
virtual void HandleFalling(void) override
Definition: Monster.cpp:533
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.
Definition: Monster.cpp:245
float m_DropChanceChestplate
Definition: Monster.h:319
float GetDropChanceChestplate()
Definition: Monster.h:133
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.
Definition: Monster.cpp:1518
void MoveToWayPoint(cChunk &a_Chunk)
Move in a straight line to the next waypoint in the path, will jump if needed.
Definition: Monster.cpp:181
void SetDropChanceWeapon(float a_DropChanceWeapon)
Definition: Monster.h:137
bool m_PathfinderActivated
Stores if pathfinder is being used - set when final destination is set, and unset when stopped moving...
Definition: Monster.h:258
static eFamily FamilyFromType(eMonsterType a_MobType)
Returns the mob family based on the type.
Definition: Monster.cpp:1102
cPawn * GetTarget()
Returns the current target.
Definition: Monster.cpp:1243
void HandleDaylightBurning(cChunk &a_Chunk, bool WouldBurn)
Definition: Monster.cpp:1621
float m_DropChanceWeapon
Definition: Monster.h:317
float GetDropChanceHelmet()
Definition: Monster.h:132
void EngageLoveMode(cMonster *a_Partner)
Start the mating process.
Definition: Monster.cpp:1329
void UnsafeUnsetTarget()
Unset the target without notifying the target entity.
Definition: Monster.cpp:1234
@ mfNoSpawn
Definition: Monster.h:35
@ mfAmbient
Definition: Monster.h:32
@ mfWater
Definition: Monster.h:33
@ mfPassive
Definition: Monster.h:31
@ mfHostile
Definition: Monster.h:30
cPawn * m_Target
A pointer to the entity this mobile is aiming to reach.
Definition: Monster.h:385
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...
Definition: Monster.h:226
virtual bool DoTakeDamage(TakeDamageInfo &a_TDI) override
Makes this entity take damage specified in the a_TDI.
Definition: Monster.cpp:572
Vector3d * GetLeashToPos() const
Gets entity position to where mob should be leashed.
Definition: Monster.h:106
bool IsCustomNameAlwaysVisible(void) const
Is the custom name of this monster always visible? If not, you only see the name when you sight the m...
Definition: Monster.h:175
virtual void InStateEscaping(std::chrono::milliseconds a_Dt, cChunk &a_Chunk)
Definition: Monster.cpp:916
bool IsLeashed() const
Returns whether the monster is leashed to an entity.
Definition: Monster.h:86
void SetAttackRate(double a_AttackRate)
Definition: Monster.h:126
float GetDropChanceWeapon()
Definition: Monster.h:131
virtual void OnRightClicked(cPlayer &a_Player) override
Called when the specified player right-clicks this entity.
Definition: Monster.cpp:697
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk &a_Chunk) override
Definition: Monster.cpp:264
float m_DropChanceBoots
Definition: Monster.h:321
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 ...
Definition: Monster.cpp:543
virtual bool IsUndead(void)
Returns whether this mob is undead (skeleton, zombie, etc.)
Definition: Monster.cpp:997
int m_AgingTimer
Definition: Monster.h:333
eMonsterType GetMobType(void) const
Definition: Monster.h:70
void SetAttackDamage(int a_AttackDamage)
Definition: Monster.h:128
double GetAttackRate()
Definition: Monster.h:125
bool IsInLove() const
Returns whether the monster has just been fed and is ready to mate.
Definition: Monster.h:241
cEntity * m_LeashedTo
Entity leashed to.
Definition: Monster.h:338
bool BurnsInDaylight() const
Definition: Monster.h:146
bool CanPickUpLoot()
Definition: Monster.h:136
cEntity * GetLeashedTo() const
Returns the entity to where this mob is leashed, returns nullptr if it's not leashed.
Definition: Monster.h:95
static AString MobTypeToString(eMonsterType a_MobType)
Translates MobType enum to a string, empty string if unknown.
Definition: Monster.cpp:1006
int m_MatingTimer
The monster is engaged in mating, once this reaches zero, a baby will be born.
Definition: Monster.h:379
bool m_CanPickUpLoot
Definition: Monster.h:322
float m_DropChanceHelmet
Definition: Monster.h:318
bool WasLastTargetAPlayer() const
Returns if this mob last target was a player to avoid destruction on player quit.
Definition: Monster.h:218
void Unleash(bool a_ShouldDropLeashPickup)
Unleash the monster.
Definition: Monster.cpp:1778
eMonsterType m_MobType
Definition: Monster.h:302
AString m_SoundAmbient
Definition: Monster.h:308
@ IDLE
Definition: Monster.h:40
@ CHASING
Definition: Monster.h:40
@ ATTACKING
Definition: Monster.h:40
@ ESCAPING
Definition: Monster.h:40
std::chrono::milliseconds m_DestroyTimer
Definition: Monster.h:300
void AddRandomWeaponDropItem(cItems &a_Drops, unsigned int a_LootingLevel)
Adds weapon that is equipped with the chance saved in m_DropChance... to the drop.
Definition: Monster.cpp:1606
AString m_CustomName
Definition: Monster.h:303
void AddRandomArmorDropItem(cItems &a_Drops, unsigned int a_LootingLevel)
Adds armor that is equipped with the chance saved in m_DropChance... to the drop.
Definition: Monster.cpp:1563
Vector3d m_NextWayPointPosition
Coordinates of the next position that should be reached.
Definition: Monster.h:261
bool m_IsLeashActionJustDone
Mob has ben leashed or unleashed in current player action.
Definition: Monster.h:344
bool DoesPosYRequireJump(double a_PosY)
Returns whether the monster needs to jump to reach a given height.
Definition: Monster.h:283
bool TargetIsInRange(void)
Returns whether or not the target is close enough for attack.
Definition: Monster.h:276
enum cMonster::MState m_EMState
void SetAttackRange(double a_AttackRange)
Definition: Monster.h:127
bool m_WasLastTargetAPlayer
Definition: Monster.h:335
virtual void EventSeePlayer(cPlayer *a_Player, cChunk &a_Chunk)
Definition: Monster.cpp:829
std::chrono::milliseconds m_LoseSightAbandonTargetTimer
Definition: Monster.h:315
double m_AttackRate
Definition: Monster.h:310
bool m_CustomNameAlwaysVisible
Definition: Monster.h:304
bool m_BurnsInDaylight
Definition: Monster.h:327
int m_TicksSinceLastDamaged
Definition: Monster.h:323
bool m_CanBeLeashed
Determines whether a monster can be leashed.
Definition: Monster.h:347
void ResetLoveMode()
Finish the mating process.
Definition: Monster.cpp:1339
virtual void EventLosePlayer(void)
Definition: Monster.cpp:839
void SetCustomNameAlwaysVisible(bool a_CustomNameAlwaysVisible)
Sets the custom name visiblity of this monster.
Definition: Monster.cpp:966
void LeashTo(cEntity &a_Entity, bool a_ShouldBroadcast=true)
Leash the monster to an entity.
Definition: Monster.cpp:1723
float GetDropChanceBoots()
Definition: Monster.h:135
int m_AttackCoolDownTicksLeft
Definition: Monster.h:313
std::unique_ptr< Vector3d > m_LeashToPos
Entity pos where this mob was leashed to.
Definition: Monster.h:341
virtual void InStateIdle(std::chrono::milliseconds a_Dt, cChunk &a_Chunk)
Definition: Monster.cpp:851
bool CanBeLeashed() const
Returns whether the mob can be leashed.
Definition: Monster.h:80
float GetDropChanceLeggings()
Definition: Monster.h:134
void SetSightDistance(int a_SightDistance)
Definition: Monster.h:129
virtual void InheritFromParents(cMonster *a_Parent1, cMonster *a_Parent2)
Called after the baby is born, allows the baby to inherit the parents' properties (color,...
Definition: Monster.h:229
double GetRelativeWalkSpeed(void) const
Definition: Monster.h:148
MPersonality
Definition: Monster.h:41
@ AGGRESSIVE
Definition: Monster.h:41
@ COWARDLY
Definition: Monster.h:41
@ PASSIVE
Definition: Monster.h:41
float m_DropChanceLeggings
Definition: Monster.h:320
bool ReachedFinalDestination(void)
Returns if the ultimate, final destination has been reached.
Definition: Monster.h:273
void RightClickFeed(cPlayer &a_Player)
Right click call to process feeding.
Definition: Monster.cpp:1474
bool IsBaby(void) const
Definition: Monster.h:156
void CalcLeashActions(std::chrono::milliseconds a_Dt)
Leash calculations inside Tick function.
Definition: Monster.cpp:403
enum cMonster::MPersonality m_EMPersonality
void AddRandomUncommonDropItem(cItems &a_Drops, float a_Chance, short a_Item, short a_ItemHealth=0)
Adds a item a_Item with the chance of a_Chance (in percent) to itemdrops a_Drops.
Definition: Monster.cpp:1537
static AString MobTypeToVanillaNBT(eMonsterType a_MobType)
Translates the MobType enum to the vanilla nbt name.
Definition: Monster.cpp:1044
void SetDropChanceChestplate(float a_DropChanceChestplate)
Definition: Monster.h:139
int m_LoveTimer
If above 0, the monster is in love mode, and will breed if a nearby monster is also in love mode.
Definition: Monster.h:373
int GetAge(void) const
Definition: Monster.h:157
double m_AttackRange
Definition: Monster.h:312
virtual void CheckEventSeePlayer(cChunk &a_Chunk)
Definition: Monster.cpp:738
AString m_SoundDeath
Definition: Monster.h:307
virtual void OnRemoveFromWorld(cWorld &a_World) override
Called when the entity is removed from a world.
Definition: Monster.cpp:139
static eMonsterType StringToMobType(const AString &a_MobTypeName)
Translates MobType string to the enum, mtInvalidType if not recognized.
Definition: Monster.cpp:1063
void StopMovingToPosition()
Stops pathfinding.
Definition: Monster.cpp:255
int m_AttackDamage
Definition: Monster.h:311
This class wraps cPath.
Definition: PathFinder.h:12
Definition: UUID.h:11
Definition: World.h:53