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

61 lines
993 B
C++
Raw Normal View History

2014-03-25 18:59:33 +00:00
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "EnderCrystal.h"
#include "../ClientHandle.h"
2014-03-25 18:59:33 +00:00
#include "../Chunk.h"
2014-09-26 17:13:19 +00:00
#include "../World.h"
2014-03-25 18:59:33 +00:00
cEnderCrystal::cEnderCrystal(Vector3d a_Pos, bool a_ShowBottom):
Super(etEnderCrystal, a_Pos, 1.0, 1.0),
m_ShowBottom(a_ShowBottom)
2014-03-25 18:59:33 +00:00
{
SetMaxHealth(5);
}
void cEnderCrystal::SpawnOn(cClientHandle & a_ClientHandle)
{
2020-04-20 19:46:04 +00:00
a_ClientHandle.SendSpawnEntity(*this);
2014-03-25 18:59:33 +00:00
}
void cEnderCrystal::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
2014-03-25 18:59:33 +00:00
{
UNUSED(a_Dt);
// No further processing (physics e.t.c.) is needed
if (m_World->GetDimension() == dimEnd)
{
m_World->SetBlock(POS_TOINT.addedY(1), E_BLOCK_FIRE, 0);
}
2014-03-25 18:59:33 +00:00
}
2014-07-04 09:55:09 +00:00
void cEnderCrystal::KilledBy(TakeDamageInfo & a_TDI)
2014-03-25 18:59:33 +00:00
{
2020-04-13 16:38:06 +00:00
Super::KilledBy(a_TDI);
2014-03-25 18:59:33 +00:00
m_World->DoExplosionAt(6.0, GetPosX(), GetPosY(), GetPosZ(), true, esEnderCrystal, this);
Destroy();
2016-02-05 21:45:45 +00:00
m_World->SetBlock(POSX_TOINT, POSY_TOINT, POSZ_TOINT, E_BLOCK_FIRE, 0);
2014-03-25 18:59:33 +00:00
}