summaryrefslogtreecommitdiffstats
path: root/src/Simulator/IncrementalRedstoneSimulator/TrappedChestHandler.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2021-03-28 15:40:57 +0200
committerGitHub <noreply@github.com>2021-03-28 15:40:57 +0200
commit748b121703fa28b10933f4432c09391e66179118 (patch)
tree58a39b6a75c3e9127507bf3c185a99e546147276 /src/Simulator/IncrementalRedstoneSimulator/TrappedChestHandler.h
parentFix Windows XP to 7 compatibility (#5167) (diff)
downloadcuberite-748b121703fa28b10933f4432c09391e66179118.tar
cuberite-748b121703fa28b10933f4432c09391e66179118.tar.gz
cuberite-748b121703fa28b10933f4432c09391e66179118.tar.bz2
cuberite-748b121703fa28b10933f4432c09391e66179118.tar.lz
cuberite-748b121703fa28b10933f4432c09391e66179118.tar.xz
cuberite-748b121703fa28b10933f4432c09391e66179118.tar.zst
cuberite-748b121703fa28b10933f4432c09391e66179118.zip
Diffstat (limited to '')
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator/TrappedChestHandler.h16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/Simulator/IncrementalRedstoneSimulator/TrappedChestHandler.h b/src/Simulator/IncrementalRedstoneSimulator/TrappedChestHandler.h
index 619401d80..145c5dc83 100644
--- a/src/Simulator/IncrementalRedstoneSimulator/TrappedChestHandler.h
+++ b/src/Simulator/IncrementalRedstoneSimulator/TrappedChestHandler.h
@@ -22,14 +22,16 @@ namespace TrappedChestHandler
static unsigned char GetPowerLevel(cChunk & a_Chunk, Vector3i a_Position)
{
int NumberOfPlayers = 0;
- VERIFY(
- !a_Chunk.DoWithChestAt(a_Position, [&](cChestEntity & a_Chest)
+ a_Chunk.DoWithBlockEntityAt(a_Position, [&NumberOfPlayers](cBlockEntity & a_BlockEntity)
+ {
+ if (a_BlockEntity.GetBlockType() != E_BLOCK_TRAPPED_CHEST)
{
- ASSERT(a_Chest.GetBlockType() == E_BLOCK_TRAPPED_CHEST);
- NumberOfPlayers = a_Chest.GetNumberOfPlayers();
- return true;
- })
- );
+ return false;
+ }
+
+ NumberOfPlayers = static_cast<cChestEntity &>(a_BlockEntity).GetNumberOfPlayers();
+ return false;
+ });
return static_cast<unsigned char>(std::min(NumberOfPlayers, 15));
}