Cuberite
A lightweight, fast and extensible game server for Minecraft
WitherSkullEntity.cpp
Go to the documentation of this file.
1 
2 // WitherSkullEntity.cpp
3 
4 // Implements the cWitherSkullEntity class representing the entity used by both blue and black wither skulls
5 
6 #include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
7 
8 #include "WitherSkullEntity.h"
9 #include "../World.h"
10 
11 
12 
13 
14 
16  super(pkWitherSkull, a_Creator, a_Pos, 0.25, 0.25)
17 {
18  SetSpeed(a_Speed);
19  SetGravity(0);
20  SetAirDrag(0);
21 }
22 
23 
24 
25 
26 
28 {
29  // TODO: Explode
30  // TODO: Apply wither effect to entities nearby
31  Destroy();
32 }
33 
34 
35 
36 
37 
38 void cWitherSkullEntity::OnHitEntity(cEntity & a_EntityHit, Vector3d a_HitPos)
39 {
40  // TODO: If entity is Ender Crystal, destroy it
41  a_EntityHit.TakeDamage(dtRangedAttack, this, 0, 1);
42 
43  // TODO: Explode
44  // TODO: Apply wither effect to entity and others nearby
45 
46  Destroy(true);
47 }
48 
49 
50 
51 
cWitherSkullEntity(cEntity *a_Creator, Vector3d a_Pos, Vector3d a_Speed)
virtual void Destroy(bool a_ShouldBroadcast=true)
Destroys the entity and schedules it for memory freeing; if a_ShouldBroadcast is set to true...
Definition: Entity.cpp:219
virtual void OnHitEntity(cEntity &a_EntityHit, Vector3d a_HitPos) override
Called by the physics blocktracer when the entity hits another entity.
virtual void OnHitSolidBlock(Vector3d a_HitPos, eBlockFace a_HitFace) override
Called by the physics blocktracer when the entity hits a solid block, the hit position and the face h...
void SetGravity(float a_Gravity)
Definition: Entity.h:288
void SetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ)
Sets the speed of the entity, measured in m / sec.
Definition: Entity.cpp:2091
void TakeDamage(cEntity &a_Attacker)
Makes this pawn take damage from an attack by a_Attacker.
Definition: Entity.cpp:269
eBlockFace
Block face constants, used in PlayerDigging and PlayerBlockPlacement packets and bbox collision calc...
Definition: Defines.h:29
Definition: Entity.h:73
void SetAirDrag(float a_AirDrag)
Definition: Entity.h:292