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.25f, 0.25f)
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 }
eBlockFace
Block face constants, used in PlayerDigging and PlayerBlockPlacement packets and bbox collision calc.
Definition: Defines.h:38
@ PARTICLE_SPLASH_POTION
MTRand & GetRandomProvider()
Returns the current thread's random number source.
Definition: FastRandom.cpp:12
Definition: Entity.h:76
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
double GetPosX(void) const
Definition: Entity.h:195
cWorld * m_World
Definition: Entity.h:624
double GetPosZ(void) const
Definition: Entity.h:197
void Destroy()
Destroys the entity, schedules it for memory freeing and broadcasts the DestroyEntity packet.
Definition: Entity.cpp:243
double GetPosY(void) const
Definition: Entity.h:196
const Vector3d & GetPosition(void) const
Exported in ManualBindings.
Definition: Entity.h:297
cExpBottleEntity(cEntity *a_Creator, Vector3d a_Pos, Vector3d a_Speed)
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 Break(Vector3d a_HitPos)
Breaks the bottle, fires its particle effects and sounds.
virtual void OnHitEntity(cEntity &a_EntityHit, Vector3d a_HitPos) override
Called by the physics blocktracer when the entity hits another entity.
UInt32 SpawnExperienceOrb(Vector3d a_Pos, int a_Reward)
Spawns an experience orb at the given location with the given reward.
Definition: World.cpp:1894
virtual void BroadcastSoundParticleEffect(const EffectID a_EffectID, Vector3i a_SrcPos, int a_Data, const cClientHandle *a_Exclude=nullptr) override