diff options
author | Michal Havlíček <80639037+havel06@users.noreply.github.com> | 2021-12-30 23:09:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-30 23:09:58 +0100 |
commit | 158435737eff36ad3217991a13ee8da431a580a0 (patch) | |
tree | 03990184a1800c090d698650913375547edbb7bb | |
parent | Add skeleton bow pulling animation (#5355) (diff) | |
download | cuberite-158435737eff36ad3217991a13ee8da431a580a0.tar cuberite-158435737eff36ad3217991a13ee8da431a580a0.tar.gz cuberite-158435737eff36ad3217991a13ee8da431a580a0.tar.bz2 cuberite-158435737eff36ad3217991a13ee8da431a580a0.tar.lz cuberite-158435737eff36ad3217991a13ee8da431a580a0.tar.xz cuberite-158435737eff36ad3217991a13ee8da431a580a0.tar.zst cuberite-158435737eff36ad3217991a13ee8da431a580a0.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Simulator/IncrementalRedstoneSimulator/ForEachSourceCallback.cpp | 28 | ||||
-rw-r--r-- | src/Simulator/IncrementalRedstoneSimulator/ForEachSourceCallback.h | 3 |
2 files changed, 1 insertions, 30 deletions
diff --git a/src/Simulator/IncrementalRedstoneSimulator/ForEachSourceCallback.cpp b/src/Simulator/IncrementalRedstoneSimulator/ForEachSourceCallback.cpp index 9505b12da..e8a8515eb 100644 --- a/src/Simulator/IncrementalRedstoneSimulator/ForEachSourceCallback.cpp +++ b/src/Simulator/IncrementalRedstoneSimulator/ForEachSourceCallback.cpp @@ -40,7 +40,7 @@ void ForEachSourceCallback::operator()(Vector3i Location) const auto PotentialSourceBlock = NeighbourChunk->GetBlock(Location); const auto NeighbourRelativeQueryPosition = cIncrementalRedstoneSimulatorChunkData::RebaseRelativePosition(m_Chunk, *NeighbourChunk, m_Position); - if (ShouldQueryLinkedPosition(PotentialSourceBlock)) + if (!cBlockInfo::IsTransparent(PotentialSourceBlock)) { Power = std::max(Power, QueryLinkedPower(*NeighbourChunk, NeighbourRelativeQueryPosition, m_CurrentBlock, Location)); } @@ -88,32 +88,6 @@ void ForEachSourceCallback::CheckIndirectPower() -bool ForEachSourceCallback::ShouldQueryLinkedPosition(const BLOCKTYPE Block) -{ - switch (Block) - { - // Normally we don't ask solid blocks for power because they don't have any (stone, dirt, etc.) - // However, these are mechanisms that are IsSolid, but still give power. Don't ignore them: - case E_BLOCK_BLOCK_OF_REDSTONE: - case E_BLOCK_DAYLIGHT_SENSOR: - case E_BLOCK_INVERTED_DAYLIGHT_SENSOR: - case E_BLOCK_OBSERVER: - case E_BLOCK_TRAPPED_CHEST: return false; - - // Pistons are solid but don't participate in link powering: - case E_BLOCK_PISTON: - case E_BLOCK_PISTON_EXTENSION: - case E_BLOCK_STICKY_PISTON: return false; - - // If a mechanism asks for power from a block, redirect the query to linked positions if: - default: return cBlockInfo::IsSolid(Block); - } -} - - - - - PowerLevel ForEachSourceCallback::QueryLinkedPower(const cChunk & Chunk, const Vector3i QueryPosition, const BLOCKTYPE QueryBlock, const Vector3i SolidBlockPosition) { PowerLevel Power = 0; diff --git a/src/Simulator/IncrementalRedstoneSimulator/ForEachSourceCallback.h b/src/Simulator/IncrementalRedstoneSimulator/ForEachSourceCallback.h index 66b56aa5a..16c10fd5e 100644 --- a/src/Simulator/IncrementalRedstoneSimulator/ForEachSourceCallback.h +++ b/src/Simulator/IncrementalRedstoneSimulator/ForEachSourceCallback.h @@ -24,9 +24,6 @@ public: private: - /** Returns whether a potential source position that's occupied by Block should be treated as linked. */ - static bool ShouldQueryLinkedPosition(BLOCKTYPE Block); - /** Asks redstone handlers adjacent to a solid block how much power they will deliver to the querying position, via the solid block. Both QueryPosition and SolidBlockPosition are relative to Chunk. */ static PowerLevel QueryLinkedPower(const cChunk & Chunk, Vector3i QueryPosition, BLOCKTYPE QueryBlock, Vector3i SolidBlockPosition); |