Cuberite
A lightweight, fast and extensible game server for Minecraft
ExpBottleEntity.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 "ExpBottleEntity.h"
4 #include "../World.h"
5 #include "../EffectID.h"
6 
7 
8 
9 
10 
12  super(pkExpBottle, a_Creator, a_Pos, 0.25, 0.25)
13 {
14  SetSpeed(a_Speed);
15 }
16 
17 
18 
19 
20 
22 {
23  Break(a_HitPos);
24 }
25 
26 
27 
28 
29 
30 void cExpBottleEntity::OnHitEntity(cEntity & a_EntityHit, Vector3d a_HitPos)
31 {
32  Break(a_HitPos);
33 }
34 
35 
36 
37 
38 
40 {
41  // Spawn an experience orb with a reward between 3 and 11.
44  Destroy();
45 }
double GetPosY(void) const
Definition: Entity.h:207
double GetPosX(void) const
Definition: Entity.h:206
MTRand & GetRandomProvider()
Returns the current thread's random number source.
Definition: FastRandom.cpp:20
cExpBottleEntity(cEntity *a_Creator, Vector3d a_Pos, Vector3d a_Speed)
cWorld * m_World
Definition: Entity.h:620
void Break(Vector3d a_HitPos)
Breaks the bottle, fires its particle effects and sounds.
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
UInt32 SpawnExperienceOrb(Vector3d a_Pos, int a_Reward)
Spawns an experience orb at the given location with the given reward.
Definition: World.cpp:2024
virtual void BroadcastSoundParticleEffect(const EffectID a_EffectID, Vector3i a_SrcPos, int a_Data, const cClientHandle *a_Exclude=nullptr) override
virtual void OnHitEntity(cEntity &a_EntityHit, Vector3d a_HitPos) override
Called by the physics blocktracer when the entity hits another entity.
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 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...
Definition: Entity.h:73
const Vector3d & GetPosition(void) const
Exported in ManualBindings.
Definition: Entity.h:307
double GetPosZ(void) const
Definition: Entity.h:208