Cuberite
A lightweight, fast and extensible game server for Minecraft
GhastFireballEntity.cpp
Go to the documentation of this file.
1 #include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
2 
3 #include "GhastFireballEntity.h"
4 #include "../World.h"
5 
6 
7 
8 
9 
11  super(pkGhastFireball, a_Creator, a_Pos, 1, 1)
12 {
13  SetSpeed(a_Speed);
14  SetGravity(0);
15  SetAirDrag(0);
16 }
17 
18 
19 
20 
21 
23 {
24  m_World->DoExplosionAt(1, a_Block.x, a_Block.y, a_Block.z, true, esGhastFireball, this);
25 }
26 
27 
28 
29 
30 
32 {
33  Destroy();
34  Explode(a_HitPos.Floor());
35 }
36 
37 
38 
39 
40 
41 void cGhastFireballEntity::OnHitEntity(cEntity & a_EntityHit, Vector3d a_HitPos)
42 {
43  Destroy();
44  Explode(a_HitPos.Floor());
45 }
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...
T x
Definition: Vector3.h:17
Vector3< int > Floor(void) const
Returns a new Vector3i with coords set to std::floor() of this vector&#39;s coords.
Definition: Vector3.h:172
void Explode(Vector3i a_Block)
cWorld * m_World
Definition: Entity.h:620
virtual void OnHitEntity(cEntity &a_EntityHit, Vector3d a_HitPos) override
Called by the physics blocktracer when the entity hits another entity.
T y
Definition: Vector3.h:17
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
T z
Definition: Vector3.h:17
cGhastFireballEntity(cEntity *a_Creator, Vector3d a_Pos, Vector3d a_Speed)
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
eBlockFace
Block face constants, used in PlayerDigging and PlayerBlockPlacement packets and bbox collision calc...
Definition: Defines.h:29
virtual void DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_BlockY, double a_BlockZ, bool a_CanCauseFire, eExplosionSource a_Source, void *a_SourceData) override
Does an explosion with the specified strength at the specified coordinates.
Definition: World.cpp:1399
Definition: Entity.h:73
void SetAirDrag(float a_AirDrag)
Definition: Entity.h:292