From 961d5eb420182add0b6cb4d92f260b885563389c Mon Sep 17 00:00:00 2001 From: 12xx12 <44411062+12xx12@users.noreply.github.com> Date: Thu, 29 Oct 2020 21:47:20 +0100 Subject: Add beam target, configurable base visibility to Ender Crystals (#5010) * Fixes #4990 Co-authored-by: 12xx12 <12xx12100@gmail.com> --- src/Entities/EnderCrystal.cpp | 12 ++++++++---- src/Entities/EnderCrystal.h | 19 ++++++++++++++++++- 2 files changed, 26 insertions(+), 5 deletions(-) (limited to 'src/Entities') diff --git a/src/Entities/EnderCrystal.cpp b/src/Entities/EnderCrystal.cpp index 4f2bd857f..269714b58 100644 --- a/src/Entities/EnderCrystal.cpp +++ b/src/Entities/EnderCrystal.cpp @@ -10,8 +10,9 @@ -cEnderCrystal::cEnderCrystal(Vector3d a_Pos): - Super(etEnderCrystal, a_Pos, 1.0, 1.0) +cEnderCrystal::cEnderCrystal(Vector3d a_Pos, bool a_ShowBottom): + Super(etEnderCrystal, a_Pos, 1.0, 1.0), + m_ShowBottom(a_ShowBottom) { SetMaxHealth(5); } @@ -33,6 +34,10 @@ void cEnderCrystal::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) { 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); + } } @@ -47,8 +52,7 @@ void cEnderCrystal::KilledBy(TakeDamageInfo & a_TDI) 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); + m_World->SetBlock(POSX_TOINT, POSY_TOINT, POSZ_TOINT, E_BLOCK_FIRE, 0); } diff --git a/src/Entities/EnderCrystal.h b/src/Entities/EnderCrystal.h index f29927549..b2a28c517 100644 --- a/src/Entities/EnderCrystal.h +++ b/src/Entities/EnderCrystal.h @@ -18,10 +18,27 @@ public: CLASS_PROTODEF(cEnderCrystal) - cEnderCrystal(Vector3d a_Pos); + cEnderCrystal(Vector3d a_Pos, bool a_ShowBottom); + + // Getters and Setters + bool ShowsBottom() const { return m_ShowBottom; } + void SetShowBottom(bool a_ShowBottom) { m_ShowBottom = a_ShowBottom; } + + Vector3i GetBeamTarget() const { return m_BeamTarget; } + void SetBeamTarget(Vector3i a_BeamTarget) { m_BeamTarget = a_BeamTarget; } + + /** If the EnderCrystal should send it's beam to the client and store to disk. */ + bool DisplaysBeam() const { return m_DisplayBeam; } + void SetDisplayBeam(bool a_DisplayBeam) { m_DisplayBeam = a_DisplayBeam; } private: + // If the bedrock base should be displayed + bool m_ShowBottom; + + Vector3i m_BeamTarget; + bool m_DisplayBeam; + // cEntity overrides: virtual void SpawnOn(cClientHandle & a_ClientHandle) override; virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override; -- cgit v1.2.3