summaryrefslogtreecommitdiffstats
path: root/src/Simulator/IncrementalRedstoneSimulator/TrappedChestHandler.h
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2017-09-01 21:12:44 +0200
committerLogicParrot <LogicParrot@users.noreply.github.com>2017-09-01 21:12:44 +0200
commit6e3e7552e67dfc0254c3e99bcd32fea02f10d062 (patch)
tree84bfd40d2c2693cab44a47d4902aa601d8a715e6 /src/Simulator/IncrementalRedstoneSimulator/TrappedChestHandler.h
parentd (diff)
parentSetSwimState now takes into account head height (diff)
downloadcuberite-6e3e7552e67dfc0254c3e99bcd32fea02f10d062.tar
cuberite-6e3e7552e67dfc0254c3e99bcd32fea02f10d062.tar.gz
cuberite-6e3e7552e67dfc0254c3e99bcd32fea02f10d062.tar.bz2
cuberite-6e3e7552e67dfc0254c3e99bcd32fea02f10d062.tar.lz
cuberite-6e3e7552e67dfc0254c3e99bcd32fea02f10d062.tar.xz
cuberite-6e3e7552e67dfc0254c3e99bcd32fea02f10d062.tar.zst
cuberite-6e3e7552e67dfc0254c3e99bcd32fea02f10d062.zip
Diffstat (limited to 'src/Simulator/IncrementalRedstoneSimulator/TrappedChestHandler.h')
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator/TrappedChestHandler.h37
1 files changed, 7 insertions, 30 deletions
diff --git a/src/Simulator/IncrementalRedstoneSimulator/TrappedChestHandler.h b/src/Simulator/IncrementalRedstoneSimulator/TrappedChestHandler.h
index 8b7b82d49..d280f73e3 100644
--- a/src/Simulator/IncrementalRedstoneSimulator/TrappedChestHandler.h
+++ b/src/Simulator/IncrementalRedstoneSimulator/TrappedChestHandler.h
@@ -1,4 +1,4 @@
-
+
#pragma once
#include "RedstoneHandler.h"
@@ -28,38 +28,15 @@ public:
UNUSED(a_BlockType);
UNUSED(a_Meta);
- class cGetTrappedChestPlayers :
- public cItemCallback<cChestEntity>
- {
- public:
- cGetTrappedChestPlayers(void) :
- m_NumberOfPlayers(0)
- {
- }
-
- virtual ~cGetTrappedChestPlayers() override
- {
- }
-
- virtual bool Item(cChestEntity * a_Chest) override
+ int NumberOfPlayers = 0;
+ VERIFY(!a_World.DoWithChestAt(a_Position.x, a_Position.y, a_Position.z, [&](cChestEntity & a_Chest)
{
- ASSERT(a_Chest->GetBlockType() == E_BLOCK_TRAPPED_CHEST);
- m_NumberOfPlayers = a_Chest->GetNumberOfPlayers();
+ ASSERT(a_Chest.GetBlockType() == E_BLOCK_TRAPPED_CHEST);
+ NumberOfPlayers = a_Chest.GetNumberOfPlayers();
return true;
}
-
- unsigned char GetPowerLevel(void) const
- {
- return static_cast<unsigned char>(std::min(m_NumberOfPlayers, 15));
- }
-
- private:
- int m_NumberOfPlayers;
-
- } GTCP;
-
- VERIFY(!a_World.DoWithChestAt(a_Position.x, a_Position.y, a_Position.z, GTCP));
- return GTCP.GetPowerLevel();
+ ));
+ return static_cast<unsigned char>(std::min(NumberOfPlayers, 15));
}
virtual cVector3iArray Update(cWorld & a_World, const Vector3i & a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta, PoweringData a_PoweringData) const override