summaryrefslogtreecommitdiffstats
path: root/src/BlockEntities/BeaconEntity.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-10-21 18:12:40 +0200
committerMattes D <github@xoft.cz>2014-10-21 18:12:40 +0200
commitbcb839d07bd9b0cea4cd8af021db76ae0822f7a9 (patch)
tree1970b9d1650e63ed5bec88308d70736d13463e09 /src/BlockEntities/BeaconEntity.cpp
parentUpdated ProtectionAreas (diff)
parentfix std:min call, include algorithm and compare same type (diff)
downloadcuberite-bcb839d07bd9b0cea4cd8af021db76ae0822f7a9.tar
cuberite-bcb839d07bd9b0cea4cd8af021db76ae0822f7a9.tar.gz
cuberite-bcb839d07bd9b0cea4cd8af021db76ae0822f7a9.tar.bz2
cuberite-bcb839d07bd9b0cea4cd8af021db76ae0822f7a9.tar.lz
cuberite-bcb839d07bd9b0cea4cd8af021db76ae0822f7a9.tar.xz
cuberite-bcb839d07bd9b0cea4cd8af021db76ae0822f7a9.tar.zst
cuberite-bcb839d07bd9b0cea4cd8af021db76ae0822f7a9.zip
Diffstat (limited to 'src/BlockEntities/BeaconEntity.cpp')
-rw-r--r--src/BlockEntities/BeaconEntity.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/BlockEntities/BeaconEntity.cpp b/src/BlockEntities/BeaconEntity.cpp
index 02f45a097..fe5bcf143 100644
--- a/src/BlockEntities/BeaconEntity.cpp
+++ b/src/BlockEntities/BeaconEntity.cpp
@@ -2,6 +2,7 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "BeaconEntity.h"
+#include <algorithm>
#include "../BlockArea.h"
#include "../Entities/Player.h"
@@ -227,10 +228,7 @@ void cBeaconEntity::GiveEffects(void)
virtual bool Item(cPlayer * a_Player)
{
Vector3d PlayerPosition = Vector3d(a_Player->GetPosition());
- if (PlayerPosition.y > (double)m_PosY)
- {
- PlayerPosition.y = (double)m_PosY;
- }
+ PlayerPosition.y = std::min(static_cast<double>(m_PosY), PlayerPosition.y);
// TODO: Vanilla minecraft uses an AABB check instead of a radius one
Vector3d BeaconPosition = Vector3d(m_PosX, m_PosY, m_PosZ);
@@ -255,7 +253,7 @@ void cBeaconEntity::GiveEffects(void)
, m_PrimaryEffect(a_PrimaryEffect)
, m_SecondaryEffect(a_SecondaryEffect)
, m_EffectLevel(a_EffectLevel)
- {};
+ {}
} PlayerCallback(Radius, m_PosX, m_PosY, m_PosZ, m_PrimaryEffect, SecondaryEffect, EffectLevel);
GetWorld()->ForEachPlayer(PlayerCallback);
@@ -288,7 +286,7 @@ void cBeaconEntity::UsedBy(cPlayer * a_Player)
OpenWindow(new cBeaconWindow(m_PosX, m_PosY, m_PosZ, this));
Window = GetWindow();
}
-
+
if (Window != NULL)
{
// if (a_Player->GetWindow() != Window)
@@ -307,7 +305,3 @@ void cBeaconEntity::SendTo(cClientHandle & a_Client)
{
a_Client.SendUpdateBlockEntity(*this);
}
-
-
-
-