Cuberite
A lightweight, fast and extensible game server for Minecraft
Entity.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include "../Item.h"
5 
6 
7 
8 
9 
10 // Place this macro in the public section of each cEntity descendant class and you're done :)
11 #define CLASS_PROTODEF(classname) \
12  virtual bool IsA(const char * a_ClassName) const override\
13  { \
14  return ((a_ClassName != nullptr) && ((strcmp(a_ClassName, #classname) == 0) || super::IsA(a_ClassName))); \
15  } \
16  virtual const char * GetClass(void) const override \
17  { \
18  return #classname; \
19  } \
20  static const char * GetClassStatic(void) \
21  { \
22  return #classname; \
23  } \
24  virtual const char * GetParentClass(void) const override \
25  { \
26  return super::GetClass(); \
27  }
28 
29 #define POSX_TOINT FloorC(GetPosX())
30 #define POSY_TOINT FloorC(GetPosY())
31 #define POSZ_TOINT FloorC(GetPosZ())
32 #define POS_TOINT GetPosition().Floor()
33 
34 #define GET_AND_VERIFY_CURRENT_CHUNK(ChunkVarName, X, Z) \
35  cChunk * ChunkVarName = a_Chunk.GetNeighborChunk(X, Z); \
36  do { \
37  if ((ChunkVarName == nullptr) || !ChunkVarName->IsValid()) \
38  { \
39  return; \
40  } \
41  } while (false)
42 
43 
44 
45 
46 class cWorld;
47 class cClientHandle;
48 class cPlayer;
49 class cChunk;
50 class cMonster;
51 
52 
53 
54 
55 
56 // tolua_begin
58 {
59  eDamageType DamageType; // Where does the damage come from? Being hit / on fire / contact with cactus / ...
60  cEntity * Attacker; // The attacking entity; valid only for dtAttack
61  int RawDamage; // What damage would the receiver get without any armor. Usually: attacker mob type + weapons
62  float FinalDamage; // What actual damage will be received. Usually: m_RawDamage minus armor
63  Vector3d Knockback; // The amount and direction of knockback received from the damage
64  // TODO: Effects - list of effects that the hit is causing. Unknown representation yet
65 } ;
66 // tolua_end
67 
68 
69 
70 
71 
72 // tolua_begin
73 class cEntity
74 {
75 public:
76 
78  {
79  etEntity, // For all other types
94 
95  // Common variations
96  etMob = etMonster, // DEPRECATED, use etMonster instead!
97  } ;
98 
99  // tolua_end
100 
102  {
103  // TODO: Investigate 0, 1, and 5 as Wiki.vg is not certain
104 
105  // Entity becomes coloured red
106  esGenericHurt = 2,
107  // Entity plays death animation (entity falls to ground)
108  esGenericDead = 3,
109  // Iron Golem plays attack animation (arms lift and fall)
110  esIronGolemAttacking = 4,
111  // Wolf taming particles spawn (smoke)
112  esWolfTaming = 6,
113  // Wolf tamed particles spawn (hearts)
114  esWolfTamed = 7,
115  // Wolf plays water removal animation (shaking and water particles)
116  esWolfDryingWater = 8,
117  // Informs client that eating was accepted
118  esPlayerEatingAccepted = 9,
119  // Sheep plays eating animation (head lowers to ground)
120  esSheepEating = 10,
121  // Iron Golem holds gift to villager children
122  esIronGolemGivingPlant = 11,
123  // Villager spawns heart particles
124  esVillagerBreeding = 12,
125  // Villager spawns thunderclound particles
126  esVillagerAngry = 13,
127  // Villager spawns green crosses
128  esVillagerHappy = 14,
129  // Witch spawns magic particle (TODO: investigation into what this is)
130  esWitchMagicking = 15,
131 
132  // It seems 16 (zombie conversion) is now done with metadata
133 
134  // Informs client to explode a firework based on its metadata
135  esFireworkExploding = 17,
136  // Passive mob is in "love mode"
137  esMobInLove = 18,
138  } ;
139 
140  static const int FIRE_TICKS_PER_DAMAGE = 10;
141  static const int FIRE_DAMAGE = 1;
142  static const int LAVA_TICKS_PER_DAMAGE = 10;
143  static const int LAVA_DAMAGE = 4;
144  static const int BURN_TICKS_PER_DAMAGE = 20;
145  static const int BURN_DAMAGE = 1;
146 
147  static const int BURN_TICKS = 160;
148 
149  static const int MAX_AIR_LEVEL = 300;
150  static const int DROWNING_TICKS = 20;
151 
152  static const int VOID_BOUNDARY = -64;
153  static const int FALL_DAMAGE_HEIGHT = 4;
154 
156  static const UInt32 INVALID_ID = 0; // Exported to Lua in ManualBindings.cpp, ToLua doesn't parse initialized constants.
157 
158 
159  cEntity(eEntityType a_EntityType, Vector3d a_Pos, double a_Width, double a_Height);
160  virtual ~cEntity();
161 
164  virtual bool Initialize(OwnedEntity a_Self, cWorld & a_EntityWorld);
165 
166  // tolua_begin
167 
168  eEntityType GetEntityType(void) const { return m_EntityType; }
169 
170  bool IsEnderCrystal(void) const { return (m_EntityType == etEnderCrystal); }
171  bool IsPlayer (void) const { return (m_EntityType == etPlayer); }
172  bool IsPickup (void) const { return (m_EntityType == etPickup); }
173  bool IsMob (void) const { return (m_EntityType == etMonster); }
174  bool IsPawn (void) const { return (IsMob() || IsPlayer()); }
175  bool IsFallingBlock(void) const { return (m_EntityType == etFallingBlock); }
176  bool IsMinecart (void) const { return (m_EntityType == etMinecart); }
177  bool IsBoat (void) const { return (m_EntityType == etBoat); }
178  bool IsTNT (void) const { return (m_EntityType == etTNT); }
179  bool IsProjectile (void) const { return (m_EntityType == etProjectile); }
180  bool IsExpOrb (void) const { return (m_EntityType == etExpOrb); }
181  bool IsFloater (void) const { return (m_EntityType == etFloater); }
182  bool IsItemFrame (void) const { return (m_EntityType == etItemFrame); }
183  bool IsLeashKnot (void) const { return (m_EntityType == etLeashKnot); }
184  bool IsPainting (void) const { return (m_EntityType == etPainting); }
185 
187  virtual bool IsA(const char * a_ClassName) const;
188 
190  static const char * GetClassStatic(void);
191 
193  virtual const char * GetClass(void) const;
194 
196  virtual const char * GetParentClass(void) const;
197 
199  virtual bool DoesPreventBlockPlacement(void) const { return true; }
200 
201  cWorld * GetWorld(void) const { return m_World; }
202 
203  double GetHeadYaw (void) const { return m_HeadYaw; } // In degrees
204  double GetHeight (void) const { return m_Height; }
205  double GetMass (void) const { return m_Mass; }
206  double GetPosX (void) const { return m_Position.x; }
207  double GetPosY (void) const { return m_Position.y; }
208  double GetPosZ (void) const { return m_Position.z; }
209  double GetYaw (void) const { return m_Rot.x; } // In degrees, [-180, +180)
210  double GetPitch (void) const { return m_Rot.y; } // In degrees, [-180, +180), but normal client clips to [-90, +90]
211  double GetRoll (void) const { return m_Rot.z; } // In degrees, unused in current client
212  Vector3d GetLookVector(void) const;
213  double GetSpeedX (void) const { return m_Speed.x; }
214  double GetSpeedY (void) const { return m_Speed.y; }
215  double GetSpeedZ (void) const { return m_Speed.z; }
216  double GetWidth (void) const { return m_Width; }
217 
218  int GetChunkX(void) const { return FloorC(m_Position.x / cChunkDef::Width); }
219  int GetChunkZ(void) const { return FloorC(m_Position.z / cChunkDef::Width); }
220 
221  void SetHeadYaw (double a_HeadYaw);
222  void SetMass (double a_Mass);
223  void SetPosX (double a_PosX) { SetPosition({a_PosX, m_Position.y, m_Position.z}); }
224  void SetPosY (double a_PosY) { SetPosition({m_Position.x, a_PosY, m_Position.z}); }
225  void SetPosZ (double a_PosZ) { SetPosition({m_Position.x, m_Position.y, a_PosZ}); }
226  void SetPosition(double a_PosX, double a_PosY, double a_PosZ) { SetPosition({a_PosX, a_PosY, a_PosZ}); }
227  void SetPosition(const Vector3d & a_Position);
228  void SetYaw (double a_Yaw); // In degrees, normalizes to [-180, +180)
229  void SetPitch (double a_Pitch); // In degrees, normalizes to [-180, +180)
230  void SetRoll (double a_Roll); // In degrees, normalizes to [-180, +180)
231 
233  void SetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ);
234 
236  void SetSpeed(Vector3d a_Speed) { SetSpeed(a_Speed.x, a_Speed.y, a_Speed.z); }
237 
239  void SetSpeedX(double a_SpeedX);
240 
242  void SetSpeedY(double a_SpeedY);
243 
245  void SetSpeedZ(double a_SpeedZ);
246 
247  void AddPosX (double a_AddPosX) { AddPosition(a_AddPosX, 0, 0); }
248  void AddPosY (double a_AddPosY) { AddPosition(0, a_AddPosY, 0); }
249  void AddPosZ (double a_AddPosZ) { AddPosition(0, 0, a_AddPosZ); }
250  void AddPosition(double a_AddPosX, double a_AddPosY, double a_AddPosZ) { SetPosition(m_Position + Vector3d(a_AddPosX, a_AddPosY, a_AddPosZ)); }
251  void AddPosition(const Vector3d & a_AddPos) { AddPosition(a_AddPos.x, a_AddPos.y, a_AddPos.z); }
252  void AddSpeed (double a_AddSpeedX, double a_AddSpeedY, double a_AddSpeedZ);
253  void AddSpeed (const Vector3d & a_AddSpeed) { AddSpeed(a_AddSpeed.x, a_AddSpeed.y, a_AddSpeed.z); }
254  void AddSpeedX (double a_AddSpeedX);
255  void AddSpeedY (double a_AddSpeedY);
256  void AddSpeedZ (double a_AddSpeedZ);
257 
258  virtual void HandleSpeedFromAttachee(float a_Forward, float a_Sideways);
259  void SteerVehicle(float a_Forward, float a_Sideways);
260 
261  inline UInt32 GetUniqueID(void) const { return m_UniqueID; }
262 
264  inline bool IsDestroyed() const {return !IsTicking();}
265 
269  bool IsTicking(void) const;
270 
272  virtual void Destroy(bool a_ShouldBroadcast = true);
273 
275  void TakeDamage(cEntity & a_Attacker);
276 
278  void TakeDamage(eDamageType a_DamageType, cEntity * a_Attacker, int a_RawDamage, double a_KnockbackAmount);
279 
281  void TakeDamage(eDamageType a_DamageType, UInt32 a_Attacker, int a_RawDamage, double a_KnockbackAmount);
282 
284  void TakeDamage(eDamageType a_DamageType, cEntity * a_Attacker, int a_RawDamage, float a_FinalDamage, double a_KnockbackAmount);
285 
286  float GetGravity(void) const { return m_Gravity; }
287 
288  void SetGravity(float a_Gravity) { m_Gravity = a_Gravity; }
289 
290  float GetAirDrag(void) const { return m_AirDrag; }
291 
292  void SetAirDrag(float a_AirDrag) { m_AirDrag = a_AirDrag; }
293 
295  void SetYawFromSpeed(void);
296 
298  void SetPitchFromSpeed(void);
299 
300  // tolua_end
301 
302  void SetHeight(double a_Height);
303 
304  void SetWidth(double a_Width);
305 
307  const Vector3d & GetPosition(void) const { return m_Position; }
308 
310  const Vector3d & GetSpeed(void) const { return m_Speed; }
311 
314  Vector3d GetLastSentPos(void) const { return m_LastSentPosition; }
315 
317  void DestroyNoScheduling(bool a_ShouldBroadcast);
318 
322  virtual bool DoTakeDamage(TakeDamageInfo & a_TDI);
323 
324  // tolua_begin
325 
327  virtual int GetRawDamageAgainst(const cEntity & a_Receiver);
328 
330  virtual bool ArmorCoversAgainst(eDamageType a_DamageType);
331 
333  virtual int GetArmorCoverAgainst(const cEntity * a_Attacker, eDamageType a_DamageType, int a_RawDamage);
334 
336  virtual int GetEnchantmentCoverAgainst(const cEntity * a_Attacker, eDamageType a_DamageType, int a_Damage);
337 
340  virtual float GetEnchantmentBlastKnockbackReduction();
341 
343  virtual double GetKnockbackAmountAgainst(const cEntity & a_Receiver);
344 
346  virtual cItem GetEquippedWeapon(void) const { return cItem(); }
347 
349  virtual cItem GetEquippedHelmet(void) const { return cItem(); }
350 
352  virtual cItem GetEquippedChestplate(void) const { return cItem(); }
353 
355  virtual cItem GetEquippedLeggings(void) const { return cItem(); }
356 
358  virtual cItem GetEquippedBoots(void) const { return cItem(); }
359 
361  virtual cItem GetOffHandEquipedItem(void) const { return cItem(); }
362 
364  virtual void ApplyArmorDamage(int DamageBlocked);
365 
366  // tolua_end
367 
369  virtual void KilledBy(TakeDamageInfo & a_TDI);
370 
371  // tolua_begin
372 
374  virtual void Killed(cEntity * a_Victim) {}
375 
377  virtual void Heal(int a_HitPoints);
378 
380  float GetHealth(void) const { return m_Health; }
381 
383  void SetHealth(float a_Health);
384 
385  // tolua_end
386 
387  virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk);
388 
390  virtual void HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a_Chunk);
391 
393  virtual void TickBurning(cChunk & a_Chunk);
394 
396  virtual void DetectCacti(void);
397 
401  virtual bool DetectPortal(void);
402 
404  virtual void TickInVoid(cChunk & a_Chunk);
405 
407  virtual void OnStartedBurning(void);
408 
410  virtual void OnFinishedBurning(void);
411 
412  // tolua_begin
413 
415  void SetMaxHealth(float a_MaxHealth);
416 
417  float GetMaxHealth(void) const { return m_MaxHealth; }
418 
420  void SetIsFireproof(bool a_IsFireproof);
421 
422  virtual bool IsFireproof(void) const { return m_IsFireproof; }
423 
425  void StartBurning(int a_TicksLeftBurning);
426 
428  void StopBurning(void);
429 
430  // tolua_end
431 
434  virtual void SpawnOn(cClientHandle & a_Client) = 0;
435 
436  // tolua_begin
437 
439  virtual void TeleportToEntity(cEntity & a_Entity);
440 
442  virtual void TeleportToCoords(double a_PosX, double a_PosY, double a_PosZ);
443 
445  void ScheduleMoveToWorld(cWorld * a_World, Vector3d a_NewPosition, bool a_ShouldSetPortalCooldown = false, bool a_ShouldSendRespawn = false);
446 
447  bool MoveToWorld(cWorld * a_World, bool a_ShouldSendRespawn, Vector3d a_NewPosition);
448 
450  bool MoveToWorld(cWorld * a_World, bool a_ShouldSendRespawn = true);
451 
453  bool MoveToWorld(const AString & a_WorldName, bool a_ShouldSendRespawn = true);
454 
455  // tolua_end
456 
457  virtual bool DoMoveToWorld(cWorld * a_World, bool a_ShouldSendRespawn, Vector3d a_NewPosition);
458 
460  virtual void BroadcastMovementUpdate(const cClientHandle * a_Exclude = nullptr);
461 
463  cEntity * GetAttached();
464 
466  virtual void AttachTo(cEntity * a_AttachTo);
467 
469  virtual void Detach(void);
470 
472  bool IsAttachedTo(const cEntity * a_Entity) const;
473 
475  void WrapHeadYaw();
476 
478  void WrapRotation();
479 
481  void WrapSpeed();
482 
483  // tolua_begin
484 
485  // COMMON metadata flags; descendants may override the defaults:
486  virtual bool IsOnFire (void) const {return (m_TicksLeftBurning > 0); }
487  virtual bool IsCrouched (void) const {return false; }
488  virtual bool IsRiding (void) const {return false; }
489  virtual bool IsSprinting(void) const {return false; }
490  virtual bool IsRclking (void) const {return false; }
491  virtual bool IsInvisible(void) const { return false; }
492 
494  virtual bool IsInFire(void) const { return m_IsInFire; }
495 
497  virtual bool IsInLava(void) const { return m_IsInLava; }
498 
500  virtual bool IsInWater(void) const { return m_IsInWater; }
501 
503  virtual bool IsHeadInWater(void) const { return m_IsHeadInWater; }
504 
506  int GetAirLevel(void) const { return m_AirLevel; }
507 
509  long int GetTicksAlive(void) const { return m_TicksAlive; }
510 
512  int GetInvulnerableTicks(void) const { return m_InvulnerableTicks; }
513 
515  void SetInvulnerableTicks(int a_InvulnerableTicks) { m_InvulnerableTicks = a_InvulnerableTicks; }
516 
518  virtual bool IsOnGround(void) const { return m_bOnGround; }
519 
520  // tolua_end
521 
523  virtual void OnRightClicked(cPlayer & a_Player) {}
524 
526  virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = nullptr)
527  {
528  UNUSED(a_Drops);
529  UNUSED(a_Killer);
530  }
531 
533  void SetWorld(cWorld * a_World) { m_World = a_World; }
534 
537  void SetParentChunk(cChunk * a_Chunk);
538 
540  cChunk * GetParentChunk() { return m_ParentChunk; }
541  const cChunk * GetParentChunk() const { return m_ParentChunk; }
542 
544  void SetIsTicking(bool a_IsTicking);
545 
547  void AddLeashedMob(cMonster * a_Monster);
548 
550  void RemoveLeashedMob(cMonster * a_Monster);
551 
553  bool HasAnyMobLeashed() const { return m_LeashedMobs.size() > 0; }
554 
559  virtual float GetExplosionExposureRate(Vector3d a_ExplosionPosition, float a_ExlosionPower);
560 
561 
562 protected:
563 
566  {
568  unsigned short m_TicksDelayed;
569 
573  };
574 
575 
578 
583 
584  float m_Health;
585  float m_MaxHealth;
586 
589 
592 
595 
598 
602 
605 
608  float m_Gravity;
609 
614  float m_AirDrag;
615 
617 
619 
621 
628 
631 
634 
637 
640 
643 
646 
649 
652 
655 
658 
662 
665 
667  long int m_TicksAlive;
668 
669 
672  virtual void DoSetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ);
673 
674  virtual void Destroyed(void) {} // Called after the entity has been destroyed
675 
679  static void ApplyFriction(Vector3d & a_Speed, double a_SlowdownMultiplier, float a_Dt);
680 
682  virtual void HandleAir(void);
683 
686  virtual void SetSwimState(cChunk & a_Chunk);
687 
690  virtual void ResetPosition(Vector3d a_NewPos);
691 
692 
693 private:
694 
697 
700 
702  double m_HeadYaw;
703 
706 
709 
713 
716 
718  double m_Mass;
719 
721  double m_Width;
722 
724  double m_Height;
725 
729 
730  typedef std::list<cMonster *> cMonsterList;
731 
733  cMonsterList m_LeashedMobs;
734 } ; // tolua_export
int GetChunkZ(void) const
Definition: Entity.h:219
virtual bool IsHeadInWater(void) const
Returns true if any part of the entity is in a water block.
Definition: Entity.h:503
double GetPosY(void) const
Definition: Entity.h:207
virtual bool IsRiding(void) const
Definition: Entity.h:488
bool IsFloater(void) const
Definition: Entity.h:181
double GetPitch(void) const
Definition: Entity.h:210
Vector3d m_LastSentPosition
Last position sent to client via the Relative Move or Teleport packets (not Velocity) Only updated if...
Definition: Entity.h:712
double GetPosX(void) const
Definition: Entity.h:206
bool m_IsHeadInWater
If the entity&#39;s head is in a water block.
Definition: Entity.h:657
T x
Definition: Vector3.h:17
eEntityType GetEntityType(void) const
Definition: Entity.h:168
int m_TicksSinceLastLavaDamage
Time, in ticks, since the last damage dealt by standing in lava.
Definition: Entity.h:636
sPortalCooldownData m_PortalCooldownData
Portal delay timer and cooldown boolean data.
Definition: Entity.h:664
int GetAirLevel(void) const
Gets remaining air of a monster.
Definition: Entity.h:506
cMonsterList m_LeashedMobs
List of leashed mobs to this entity.
Definition: Entity.h:733
virtual bool DoesPreventBlockPlacement(void) const
Returns whether blocks can be placed intersecting this entities&#39; hitbox.
Definition: Entity.h:199
std::list< cMonster * > cMonsterList
Definition: Entity.h:730
cChunk * GetParentChunk()
Returns the chunk responsible for ticking this entity.
Definition: Entity.h:540
double GetHeadYaw(void) const
Definition: Entity.h:203
bool IsTNT(void) const
Definition: Entity.h:178
double GetSpeedX(void) const
Definition: Entity.h:213
void SetInvulnerableTicks(int a_InvulnerableTicks)
Set the invulnerable ticks from the entity.
Definition: Entity.h:515
virtual cItem GetOffHandEquipedItem(void) const
Returns the currently offhand equipped item; empty item if none.
Definition: Entity.h:361
virtual cItem GetEquippedHelmet(void) const
Returns the currently equipped helmet; empty item if none.
Definition: Entity.h:349
Vector3d m_WaterSpeed
Measured in meter / second.
Definition: Entity.h:715
bool m_WorldChangeSendRespawn
Definition: Entity.h:625
bool HasAnyMobLeashed() const
Returs whether the entity has any mob leashed to.
Definition: Entity.h:553
void SetPosition(double a_PosX, double a_PosY, double a_PosZ)
Definition: Entity.h:226
static const int Width
Definition: ChunkDef.h:134
cWorld * m_World
Definition: Entity.h:620
int m_TicksLeftBurning
Time, in ticks, until the entity extinguishes its fire.
Definition: Entity.h:642
Definition: Player.h:27
bool m_IsInLava
If any part of the entity is in a lava block.
Definition: Entity.h:651
unsigned short m_TicksDelayed
Ticks since entry of portal, used to delay teleportation.
Definition: Entity.h:568
long int GetTicksAlive(void) const
Gets number of ticks this entity has existed for.
Definition: Entity.h:509
bool IsEnderCrystal(void) const
Definition: Entity.h:170
cWorld * m_NewWorld
Definition: Entity.h:626
virtual bool IsOnFire(void) const
Definition: Entity.h:486
bool m_ShouldPreventTeleportation
Whether the entity has just exited the portal, and should therefore not be teleported again...
Definition: Entity.h:572
const Vector3d & GetSpeed(void) const
Exported in ManualBindings.
Definition: Entity.h:310
virtual cItem GetEquippedBoots(void) const
Returns the currently equipped boots; empty item if none.
Definition: Entity.h:358
bool IsMob(void) const
Definition: Entity.h:173
bool m_IsTicking
Whether the entity is ticking or not.
Definition: Entity.h:696
bool m_bHasSentNoSpeed
Stores whether we have sent a Velocity packet with a speed of zero (no speed) to the client Ensures t...
Definition: Entity.h:601
eDamageType DamageType
Definition: Entity.h:59
bool IsProjectile(void) const
Definition: Entity.h:179
double m_Width
Width of the entity, in the XZ plane.
Definition: Entity.h:721
virtual bool IsInWater(void) const
Returns true if any part of the entity is in a water block.
Definition: Entity.h:500
UInt32 m_UniqueID
The ID of the entity that is guaranteed to be unique within a single run of the server.
Definition: Entity.h:582
virtual bool IsCrouched(void) const
Definition: Entity.h:487
void AddSpeed(const Vector3d &a_AddSpeed)
Definition: Entity.h:253
double GetSpeedZ(void) const
Definition: Entity.h:215
virtual void Destroyed(void)
Definition: Entity.h:674
float m_Health
Definition: Entity.h:584
cChunk * m_ParentChunk
The chunk which is responsible for ticking this entity.
Definition: Entity.h:699
double GetWidth(void) const
Definition: Entity.h:216
Vector3d m_NewWorldPosition
Definition: Entity.h:627
Definition: Chunk.h:49
double GetRoll(void) const
Definition: Entity.h:211
virtual bool IsInvisible(void) const
Definition: Entity.h:491
float GetAirDrag(void) const
Definition: Entity.h:290
T y
Definition: Vector3.h:17
void SetPosY(double a_PosY)
Definition: Entity.h:224
int GetInvulnerableTicks(void) const
Gets the invulnerable ticks from the entity.
Definition: Entity.h:512
double GetHeight(void) const
Definition: Entity.h:204
bool m_bDirtyHead
Stores whether head yaw has been set manually.
Definition: Entity.h:594
T z
Definition: Vector3.h:17
float m_AirDrag
Stores the air drag that is applied to the entity every tick, measured in speed ratio per tick Acts a...
Definition: Entity.h:614
Vector3d m_LastPosition
Definition: Entity.h:616
int m_InvulnerableTicks
If a player hit a entity, the entity receive a invulnerable of 10 ticks.
Definition: Entity.h:728
bool IsPawn(void) const
Definition: Entity.h:174
bool m_bDirtyOrientation
Stores whether our yaw / pitch / roll (body orientation) has been set manually.
Definition: Entity.h:597
bool m_IsFireproof
Whether the entity is capable of taking fire or lava damage.
Definition: Entity.h:630
double m_Height
Height of the entity (Y axis)
Definition: Entity.h:724
bool m_IsInFire
If any part of the entity is in a fire block.
Definition: Entity.h:648
virtual bool IsInFire(void) const
Returns true if any part of the entity is in a fire block.
Definition: Entity.h:494
int m_TicksSinceLastFireDamage
Time, in ticks, since the last damage dealt by standing in fire.
Definition: Entity.h:639
eDamageType
Damage type, used in the TakeDamageInfo structure and related functions.
Definition: BlockID.h:1140
void AddPosition(double a_AddPosX, double a_AddPosY, double a_AddPosZ)
Definition: Entity.h:250
virtual bool IsOnGround(void) const
Returns whether the entity is on ground or not.
Definition: Entity.h:518
bool m_WorldChangeSetPortalCooldown
Definition: Entity.h:624
float FinalDamage
Definition: Entity.h:62
virtual cItem GetEquippedLeggings(void) const
Returns the currently equipped leggings; empty item if none.
Definition: Entity.h:355
Definition: World.h:65
int m_TicksSinceLastBurnDamage
Time, in ticks, since the last damage dealt by being on fire.
Definition: Entity.h:633
bool IsMinecart(void) const
Definition: Entity.h:176
Structure storing the portal delay timer and cooldown boolean.
Definition: Entity.h:565
Vector3d m_Rot
Measured in degrees, [-180, +180)
Definition: Entity.h:705
Vector3< double > Vector3d
Definition: Vector3.h:445
double m_Mass
Measured in Kilograms (Kg)
Definition: Entity.h:718
bool IsExpOrb(void) const
Definition: Entity.h:180
bool IsDestroyed() const
Deprecated.
Definition: Entity.h:264
Vector3d Knockback
Definition: Entity.h:63
void AddPosZ(double a_AddPosZ)
Definition: Entity.h:249
float GetHealth(void) const
Returns the health of this entity.
Definition: Entity.h:380
float GetGravity(void) const
Definition: Entity.h:286
bool IsItemFrame(void) const
Definition: Entity.h:182
Vector3d GetLastSentPos(void) const
Returns the last position we sent to all the clients.
Definition: Entity.h:314
int m_AirTickTimer
Definition: Entity.h:661
void SetWorld(cWorld *a_World)
Sets the internal world pointer to a new cWorld, doesn&#39;t update anything else.
Definition: Entity.h:533
virtual void GetDrops(cItems &a_Drops, cEntity *a_Killer=nullptr)
Returns the list of drops for this pawn when it is killed.
Definition: Entity.h:526
float GetMaxHealth(void) const
Definition: Entity.h:417
void AddPosition(const Vector3d &a_AddPos)
Definition: Entity.h:251
int m_AirLevel
Air level of a mobile.
Definition: Entity.h:660
#define UNUSED
Definition: Globals.h:152
eEntityType
Definition: Entity.h:77
float m_MaxHealth
Definition: Entity.h:585
void SetGravity(float a_Gravity)
Definition: Entity.h:288
virtual void OnRightClicked(cPlayer &a_Player)
Called when the specified player right-clicks this entity.
Definition: Entity.h:523
double m_HeadYaw
Measured in degrees, [-180, +180)
Definition: Entity.h:702
double GetYaw(void) const
Definition: Entity.h:209
int m_TicksSinceLastVoidDamage
Time, in ticks, since the last damage dealt by the void.
Definition: Entity.h:645
virtual bool IsSprinting(void) const
Definition: Entity.h:489
cEntity * m_AttachedTo
The entity to which this entity is attached (vehicle), nullptr if none.
Definition: Entity.h:588
std::string AString
Definition: StringUtils.h:13
bool IsPlayer(void) const
Definition: Entity.h:171
double GetSpeedY(void) const
Definition: Entity.h:214
int RawDamage
Definition: Entity.h:61
int GetChunkX(void) const
Definition: Entity.h:218
eEntityStatus
Definition: Entity.h:101
virtual cItem GetEquippedWeapon(void) const
Returns the curently equipped weapon; empty item if none.
Definition: Entity.h:346
Definition: Entity.h:73
virtual void Killed(cEntity *a_Victim)
Called when the entity kills another entity.
Definition: Entity.h:374
const Vector3d & GetPosition(void) const
Exported in ManualBindings.
Definition: Entity.h:307
bool IsPickup(void) const
Definition: Entity.h:172
Vector3d m_Position
Position of the entity&#39;s XZ center and Y bottom.
Definition: Entity.h:708
float m_Gravity
Stores gravity that is applied to an entity every tick For realistic effects, this should be negative...
Definition: Entity.h:608
unsigned int UInt32
Definition: Globals.h:113
std::unique_ptr< cEntity > OwnedEntity
Definition: ChunkDef.h:32
void SetAirDrag(float a_AirDrag)
Definition: Entity.h:292
cEntity * m_Attachee
The entity which is attached to this entity (rider), nullptr if none.
Definition: Entity.h:591
virtual bool IsRclking(void) const
Definition: Entity.h:490
bool m_bOnGround
Stores if the entity is on the ground.
Definition: Entity.h:604
bool m_IsInWater
If any part of the entity is in a water block.
Definition: Entity.h:654
double GetPosZ(void) const
Definition: Entity.h:208
void AddPosY(double a_AddPosY)
Definition: Entity.h:248
virtual bool IsFireproof(void) const
Definition: Entity.h:422
void AddPosX(double a_AddPosX)
Definition: Entity.h:247
Vector3d m_Speed
Measured in meters / second (m / s)
Definition: Entity.h:577
void SetPosX(double a_PosX)
Definition: Entity.h:223
bool IsFallingBlock(void) const
Definition: Entity.h:175
std::enable_if< std::is_arithmetic< T >::value, C >::type FloorC(T a_Value)
Floors a value, then casts it to C (an int by default)
Definition: Globals.h:362
void SetSpeed(Vector3d a_Speed)
Sets the speed of the entity, measured in m / sec.
Definition: Entity.h:236
virtual cItem GetEquippedChestplate(void) const
Returns the currently equipped chestplate; empty item if none.
Definition: Entity.h:352
void SetPosZ(double a_PosZ)
Definition: Entity.h:225
long int m_TicksAlive
The number of ticks this entity has been alive for.
Definition: Entity.h:667
Definition: Item.h:36
bool m_IsWorldChangeScheduled
State variables for ScheduleMoveToWorld.
Definition: Entity.h:623
bool IsLeashKnot(void) const
Definition: Entity.h:183
cEntity * Attacker
Definition: Entity.h:60
eEntityType m_EntityType
Definition: Entity.h:618
UInt32 GetUniqueID(void) const
Definition: Entity.h:261
cWorld * GetWorld(void) const
Definition: Entity.h:201
This class bridges a vector of cItem for safe access via Lua.
Definition: Item.h:234
double GetMass(void) const
Definition: Entity.h:205
bool IsPainting(void) const
Definition: Entity.h:184
virtual bool IsInLava(void) const
Returns true if any part of the entity is in a lava block.
Definition: Entity.h:497
bool IsBoat(void) const
Definition: Entity.h:177
const cChunk * GetParentChunk() const
Definition: Entity.h:541