From 365cbc6e1cea96741e26c9ce912b003f8fd2c62c Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sun, 29 Sep 2019 14:59:24 +0200 Subject: Refactored more of Entities and BlockEntities to use Vector3. (#4403) --- src/BlockEntities/BeaconEntity.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/BlockEntities/BeaconEntity.cpp') diff --git a/src/BlockEntities/BeaconEntity.cpp b/src/BlockEntities/BeaconEntity.cpp index f1f7341b7..4c830fb61 100644 --- a/src/BlockEntities/BeaconEntity.cpp +++ b/src/BlockEntities/BeaconEntity.cpp @@ -11,8 +11,8 @@ -cBeaconEntity::cBeaconEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World): - Super(a_BlockType, a_BlockMeta, a_BlockX, a_BlockY, a_BlockZ, 1, 1, a_World), +cBeaconEntity::cBeaconEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World): + super(a_BlockType, a_BlockMeta, a_Pos, 1, 1, a_World), m_IsActive(false), m_BeaconLevel(0), m_PrimaryEffect(cEntityEffect::effNoEffect), @@ -138,9 +138,9 @@ bool cBeaconEntity::SetSecondaryEffect(cEntityEffect::eType a_Effect) bool cBeaconEntity::IsBeaconBlocked(void) { - for (int Y = m_PosY; Y < cChunkDef::Height; ++Y) + for (int Y = m_Pos.y; Y < cChunkDef::Height; ++Y) { - BLOCKTYPE Block = m_World->GetBlock(m_PosX, Y, m_PosZ); + BLOCKTYPE Block = m_World->GetBlock({m_Pos.x, Y, m_Pos.z}); if (!cBlockInfo::IsTransparent(Block)) { return true; @@ -195,7 +195,7 @@ void cBeaconEntity::UpdateBeacon(void) GetWindow()->SetProperty(0, m_BeaconLevel); } - Vector3d BeaconPosition(m_PosX, m_PosY, m_PosZ); + Vector3d BeaconPosition(m_Pos); GetWorld()->ForEachPlayer([=](cPlayer & a_Player) { Vector3d Distance = BeaconPosition - a_Player.GetPosition(); @@ -233,7 +233,7 @@ void cBeaconEntity::GiveEffects(void) bool HasSecondaryEffect = (m_BeaconLevel >= 4) && (m_PrimaryEffect != m_SecondaryEffect) && (m_SecondaryEffect > 0); - Vector3d BeaconPosition(m_PosX, m_PosY, m_PosZ); + Vector3d BeaconPosition(m_Pos); GetWorld()->ForEachPlayer([=](cPlayer & a_Player) { auto PlayerPosition = a_Player.GetPosition(); @@ -263,7 +263,7 @@ void cBeaconEntity::GiveEffects(void) void cBeaconEntity::CopyFrom(const cBlockEntity & a_Src) { - Super::CopyFrom(a_Src); + super::CopyFrom(a_Src); auto & src = static_cast(a_Src); m_BeaconLevel = src.m_BeaconLevel; m_Contents.CopyFrom(src.m_Contents); @@ -305,7 +305,7 @@ bool cBeaconEntity::UsedBy(cPlayer * a_Player) cWindow * Window = GetWindow(); if (Window == nullptr) { - OpenWindow(new cBeaconWindow(m_PosX, m_PosY, m_PosZ, this)); + OpenWindow(new cBeaconWindow(this)); Window = GetWindow(); } -- cgit v1.2.3