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.3125f, 0.3125f)
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();
47 }
48 
49 
50 
51 
@ dtRangedAttack
Definition: Defines.h:247
eBlockFace
Block face constants, used in PlayerDigging and PlayerBlockPlacement packets and bbox collision calc.
Definition: Defines.h:38
Definition: Entity.h:76
void SetGravity(float a_Gravity)
Definition: Entity.h:282
void SetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ)
Sets the speed of the entity, measured in m / sec.
Definition: Entity.cpp:2157
void Destroy()
Destroys the entity, schedules it for memory freeing and broadcasts the DestroyEntity packet.
Definition: Entity.cpp:243
void TakeDamage(cEntity &a_Attacker)
Makes this pawn take damage from an attack by a_Attacker.
Definition: Entity.cpp:272
void SetAirDrag(float a_AirDrag)
Definition: Entity.h:286
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...
virtual void OnHitEntity(cEntity &a_EntityHit, Vector3d a_HitPos) override
Called by the physics blocktracer when the entity hits another entity.
cWitherSkullEntity(cEntity *a_Creator, Vector3d a_Pos, Vector3d a_Speed)