summaryrefslogtreecommitdiffstats
path: root/src/BlockEntities/HopperEntity.cpp
diff options
context:
space:
mode:
authorpeterbell10 <peterbell10@live.co.uk>2017-09-11 23:20:49 +0200
committerMattes D <github@xoft.cz>2017-09-11 23:20:49 +0200
commite225b7f8262df48ad4d7094bc295add3007b0649 (patch)
treea42e9afcc88cfe6e9d1258458e3ad42764083d0e /src/BlockEntities/HopperEntity.cpp
parentcBlockArea: change MakeIndex to return size_t (diff)
downloadcuberite-e225b7f8262df48ad4d7094bc295add3007b0649.tar
cuberite-e225b7f8262df48ad4d7094bc295add3007b0649.tar.gz
cuberite-e225b7f8262df48ad4d7094bc295add3007b0649.tar.bz2
cuberite-e225b7f8262df48ad4d7094bc295add3007b0649.tar.lz
cuberite-e225b7f8262df48ad4d7094bc295add3007b0649.tar.xz
cuberite-e225b7f8262df48ad4d7094bc295add3007b0649.tar.zst
cuberite-e225b7f8262df48ad4d7094bc295add3007b0649.zip
Diffstat (limited to '')
-rw-r--r--src/BlockEntities/HopperEntity.cpp21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/BlockEntities/HopperEntity.cpp b/src/BlockEntities/HopperEntity.cpp
index 0467685af..2fac188b1 100644
--- a/src/BlockEntities/HopperEntity.cpp
+++ b/src/BlockEntities/HopperEntity.cpp
@@ -193,8 +193,7 @@ bool cHopperEntity::MovePickupsIn(cChunk & a_Chunk, Int64 a_CurrentTick)
{
UNUSED(a_CurrentTick);
- class cHopperPickupSearchCallback :
- public cEntityCallback
+ class cHopperPickupSearchCallback
{
public:
cHopperPickupSearchCallback(const Vector3i & a_Pos, cItemGrid & a_Contents) :
@@ -204,22 +203,20 @@ bool cHopperEntity::MovePickupsIn(cChunk & a_Chunk, Int64 a_CurrentTick)
{
}
- virtual bool Item(cEntity * a_Entity) override
+ bool operator () (cEntity & a_Entity)
{
- ASSERT(a_Entity != nullptr);
-
- if (!a_Entity->IsPickup())
+ if (!a_Entity.IsPickup())
{
return false;
}
- Vector3f EntityPos = a_Entity->GetPosition();
+ Vector3f EntityPos = a_Entity.GetPosition();
Vector3f BlockPos(m_Pos.x + 0.5f, static_cast<float>(m_Pos.y) + 1, m_Pos.z + 0.5f); // One block above hopper, and search from center outwards
double Distance = (EntityPos - BlockPos).Length();
if (Distance < 0.5)
{
- if (TrySuckPickupIn(static_cast<cPickup *>(a_Entity)))
+ if (TrySuckPickupIn(static_cast<cPickup &>(a_Entity)))
{
return false;
}
@@ -228,9 +225,9 @@ bool cHopperEntity::MovePickupsIn(cChunk & a_Chunk, Int64 a_CurrentTick)
return false;
}
- bool TrySuckPickupIn(cPickup * a_Pickup)
+ bool TrySuckPickupIn(cPickup & a_Pickup)
{
- cItem & Item = a_Pickup->GetItem();
+ cItem & Item = a_Pickup.GetItem();
for (int i = 0; i < ContentsWidth * ContentsHeight; i++)
{
@@ -238,7 +235,7 @@ bool cHopperEntity::MovePickupsIn(cChunk & a_Chunk, Int64 a_CurrentTick)
{
m_bFoundPickupsAbove = true;
m_Contents.SetSlot(i, Item);
- a_Pickup->Destroy(); // Kill pickup
+ a_Pickup.Destroy(); // Kill pickup
return true;
}
@@ -252,7 +249,7 @@ bool cHopperEntity::MovePickupsIn(cChunk & a_Chunk, Int64 a_CurrentTick)
if (Item.IsEmpty())
{
- a_Pickup->Destroy(); // Kill pickup if all items were added
+ a_Pickup.Destroy(); // Kill pickup if all items were added
}
return true;
}