1
0
cuberite-2a/src/Entities/EnderCrystal.cpp

57 lines
997 B
C++
Raw Normal View History

2014-03-25 14:59:33 -04:00
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "EnderCrystal.h"
#include "ClientHandle.h"
#include "../Chunk.h"
2014-09-26 13:13:19 -04:00
#include "../World.h"
2014-03-25 14:59:33 -04:00
cEnderCrystal::cEnderCrystal(double a_X, double a_Y, double a_Z)
: cEntity(etEnderCrystal, a_X, a_Y, a_Z, 1.0, 1.0)
{
SetMaxHealth(5);
}
void cEnderCrystal::SpawnOn(cClientHandle & a_ClientHandle)
{
a_ClientHandle.SendSpawnObject(*this, 51, 0, (Byte)GetYaw(), (Byte)GetPitch());
}
void cEnderCrystal::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
2014-03-25 14:59:33 -04:00
{
UNUSED(a_Dt);
// No further processing (physics e.t.c.) is needed
}
2014-07-04 05:55:09 -04:00
void cEnderCrystal::KilledBy(TakeDamageInfo & a_TDI)
2014-03-25 14:59:33 -04:00
{
2014-07-04 05:55:09 -04:00
super::KilledBy(a_TDI);
2014-03-25 14:59:33 -04:00
m_World->DoExplosionAt(6.0, GetPosX(), GetPosY(), GetPosZ(), true, esEnderCrystal, this);
Destroy();
m_World->SetBlock(POSX_TOINT, POSY_TOINT, POSZ_TOINT, E_BLOCK_BEDROCK, 0);
m_World->SetBlock(POSX_TOINT, POSY_TOINT + 1, POSZ_TOINT, E_BLOCK_FIRE, 0);
2014-03-25 14:59:33 -04:00
}