From 748b121703fa28b10933f4432c09391e66179118 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sun, 28 Mar 2021 14:40:57 +0100 Subject: Unify DoWithBlockEntity (#5168) + DoWith calls now broadcast the block entity and mark the chunk dirty + Add block entity change queue to synchronise BE updates with block updates * Fixed a few incorrect assertions about BE type - Remove manual overloads --- .../IncrementalRedstoneSimulator/TrappedChestHandler.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/Simulator/IncrementalRedstoneSimulator/TrappedChestHandler.h') 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(a_BlockEntity).GetNumberOfPlayers(); + return false; + }); return static_cast(std::min(NumberOfPlayers, 15)); } -- cgit v1.2.3