36a67df105
* fixed network fixed explosion fixed ticking added network broadcast to Setter method added nullptr protection using macros in 1.10 Protocol_1_10.cpp revealed functions to LUA API small fixups, typos, less functions used fixed more doc readded info that saving is done only if the beam is displayed made the constructor transfer all needed members fixed wrong commit removed default parameters on SpawnEnderCrystal fixed wrong metadata moved call to destroy in the right place fixed some typos Fixed Ender Crystal * fixed documentation * fixed doc and added proper error message * Parameters, arrows * Parameters Co-authored-by: 12xx12 <12xx12100@gmail.com> Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
102 lines
1.6 KiB
C++
102 lines
1.6 KiB
C++
|
|
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
|
|
|
|
#include "EnderCrystal.h"
|
|
#include "../ClientHandle.h"
|
|
#include "../Chunk.h"
|
|
#include "../World.h"
|
|
|
|
|
|
|
|
|
|
|
|
cEnderCrystal::cEnderCrystal(Vector3d a_Pos, bool a_ShowBottom) :
|
|
cEnderCrystal(a_Pos, {}, false, a_ShowBottom)
|
|
{
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
cEnderCrystal::cEnderCrystal(Vector3d a_Pos, Vector3i a_BeamTarget, bool a_DisplayBeam, bool a_ShowBottom) :
|
|
Super(etEnderCrystal, a_Pos, 1.0, 1.0),
|
|
m_BeamTarget(a_BeamTarget),
|
|
m_DisplayBeam(a_DisplayBeam),
|
|
m_ShowBottom(a_ShowBottom)
|
|
{
|
|
SetMaxHealth(5);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void cEnderCrystal::SetShowBottom(bool a_ShowBottom)
|
|
{
|
|
m_ShowBottom = a_ShowBottom;
|
|
m_World->BroadcastEntityMetadata(*this);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void cEnderCrystal::SetBeamTarget(Vector3i a_BeamTarget)
|
|
{
|
|
m_BeamTarget = a_BeamTarget;
|
|
m_World->BroadcastEntityMetadata(*this);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void cEnderCrystal::SetDisplayBeam(bool a_DisplayBeam)
|
|
{
|
|
m_DisplayBeam = a_DisplayBeam;
|
|
m_World->BroadcastEntityMetadata(*this);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void cEnderCrystal::SpawnOn(cClientHandle & a_ClientHandle)
|
|
{
|
|
a_ClientHandle.SendSpawnEntity(*this);
|
|
a_ClientHandle.SendEntityMetadata(*this);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void cEnderCrystal::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
|
|
{
|
|
UNUSED(a_Dt);
|
|
if ((m_World->GetDimension() == dimEnd) && (m_World->GetBlock(POS_TOINT) != E_BLOCK_FIRE))
|
|
{
|
|
m_World->SetBlock(POS_TOINT, E_BLOCK_FIRE, 0);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void cEnderCrystal::KilledBy(TakeDamageInfo & a_TDI)
|
|
{
|
|
Super::KilledBy(a_TDI);
|
|
|
|
m_World->DoExplosionAt(6.0, GetPosX(), GetPosY() + (GetHeight() / 2.0), GetPosZ(), true, esEnderCrystal, this);
|
|
|
|
Destroy();
|
|
|
|
m_World->SetBlock(POS_TOINT, E_BLOCK_FIRE, 0);
|
|
}
|
|
|
|
|
|
|
|
|