From de76503d5c87fd7782b0aa3bbda9bdd997ad7fa8 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sun, 14 Mar 2021 00:30:40 +0000 Subject: Remove DoesDropOnUnsuitable This is only overridden false in Vines and Snow. It is called when a CanBeAt check fails, to determine whether DropBlockAsPickups is called. However, Vines and Snow already drop nothing without the right tool, so this function is superfluous. --- src/Blocks/BlockHandler.cpp | 18 +----------------- src/Blocks/BlockHandler.h | 4 ---- src/Blocks/BlockSnow.h | 9 --------- src/Blocks/BlockVine.h | 13 ------------- src/Simulator/FloodyFluidSimulator.cpp | 5 +---- tests/Generating/Stubs.cpp | 9 --------- tests/LuaThreadStress/Stubs.cpp | 9 --------- tests/SchematicFileSerializer/Stubs.cpp | 9 --------- 8 files changed, 2 insertions(+), 74 deletions(-) diff --git a/src/Blocks/BlockHandler.cpp b/src/Blocks/BlockHandler.cpp index 829905221..316906907 100644 --- a/src/Blocks/BlockHandler.cpp +++ b/src/Blocks/BlockHandler.cpp @@ -494,14 +494,7 @@ void cBlockHandler::OnNeighborChanged(cChunkInterface & a_ChunkInterface, Vector return; } - if (DoesDropOnUnsuitable()) - { - a_ChunkInterface.DropBlockAsPickups(a_BlockPos); - } - else - { - a_ChunkInterface.SetBlock(a_BlockPos, E_BLOCK_AIR, 0); - } + a_ChunkInterface.DropBlockAsPickups(a_BlockPos); } @@ -571,15 +564,6 @@ bool cBlockHandler::DoesIgnoreBuildCollision(cChunkInterface & a_ChunkInterface, -bool cBlockHandler::DoesDropOnUnsuitable(void) const -{ - return true; -} - - - - - bool cBlockHandler::IsInsideBlock(const Vector3d a_RelPosition, const NIBBLETYPE a_BlockMeta) const { // Default functionality: Test the height, since we assume full voxels with varying height diff --git a/src/Blocks/BlockHandler.h b/src/Blocks/BlockHandler.h index 772536003..ecf895d66 100644 --- a/src/Blocks/BlockHandler.h +++ b/src/Blocks/BlockHandler.h @@ -166,10 +166,6 @@ public: @param a_Meta Meta value of the block currently at a_Pos */ virtual bool DoesIgnoreBuildCollision(cChunkInterface & ChunkInterface, const Vector3i a_Pos, cPlayer & a_Player, NIBBLETYPE a_Meta) const; - /** Returns if this block drops if it gets destroyed by an unsuitable situation. - Default: true */ - virtual bool DoesDropOnUnsuitable(void) const; - /** Tests if a_RelPosition is inside the block, where a_RelPosition is relative to the origin of the block. Coords in a_RelPosition are guaranteed to be in the [0..1] range. */ virtual bool IsInsideBlock(const Vector3d a_RelPosition, const NIBBLETYPE a_BlockMeta) const; diff --git a/src/Blocks/BlockSnow.h b/src/Blocks/BlockSnow.h index d4d8bcc50..9b4e20306 100644 --- a/src/Blocks/BlockSnow.h +++ b/src/Blocks/BlockSnow.h @@ -120,15 +120,6 @@ private: - virtual bool DoesDropOnUnsuitable(void) const override - { - return false; - } - - - - - virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) const override { UNUSED(a_Meta); diff --git a/src/Blocks/BlockVine.h b/src/Blocks/BlockVine.h index 8d42137d4..80498ee63 100644 --- a/src/Blocks/BlockVine.h +++ b/src/Blocks/BlockVine.h @@ -180,10 +180,6 @@ private: if ((Common == 0) && !HasTop) { // The vine just lost all its support, destroy the block: - if (DoesDropOnUnsuitable()) - { - a_ChunkInterface.DropBlockAsPickups(a_Chunk.RelativeToAbsolute(a_RelPos)); - } a_Chunk.SetBlock(a_RelPos, E_BLOCK_AIR, 0); return false; } @@ -207,15 +203,6 @@ private: - virtual bool DoesDropOnUnsuitable(void) const override - { - return false; - } - - - - - virtual void OnUpdate( cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, diff --git a/src/Simulator/FloodyFluidSimulator.cpp b/src/Simulator/FloodyFluidSimulator.cpp index ff611bbc3..428c0dbc1 100644 --- a/src/Simulator/FloodyFluidSimulator.cpp +++ b/src/Simulator/FloodyFluidSimulator.cpp @@ -299,10 +299,7 @@ void cFloodyFluidSimulator::SpreadToNeighbor(cChunk * a_NearChunk, int a_RelX, i // Wash away the block there, if possible: if (CanWashAway(BlockType)) { - if (cBlockHandler::For(BlockType).DoesDropOnUnsuitable()) - { - m_World.DropBlockAsPickups(absPos, nullptr, nullptr); - } + m_World.DropBlockAsPickups(absPos, nullptr, nullptr); } // if (CanWashAway) // Spread: diff --git a/tests/Generating/Stubs.cpp b/tests/Generating/Stubs.cpp index 811809776..32c4f696e 100644 --- a/tests/Generating/Stubs.cpp +++ b/tests/Generating/Stubs.cpp @@ -194,15 +194,6 @@ bool cBlockHandler::DoesIgnoreBuildCollision(cChunkInterface & a_ChunkInterface, -bool cBlockHandler::DoesDropOnUnsuitable(void) const -{ - return true; -} - - - - - void cBlockHandler::Check(cChunkInterface & a_ChunkInterface, cBlockPluginInterface & a_PluginInterface, Vector3i a_RelPos, cChunk & a_Chunk) const { } diff --git a/tests/LuaThreadStress/Stubs.cpp b/tests/LuaThreadStress/Stubs.cpp index 4b347b895..11264deb2 100644 --- a/tests/LuaThreadStress/Stubs.cpp +++ b/tests/LuaThreadStress/Stubs.cpp @@ -196,15 +196,6 @@ bool cBlockHandler::DoesIgnoreBuildCollision(cChunkInterface & a_ChunkInterface, -bool cBlockHandler::DoesDropOnUnsuitable(void) const -{ - return true; -} - - - - - void cBlockHandler::Check(cChunkInterface & a_ChunkInterface, cBlockPluginInterface & a_PluginInterface, Vector3i a_RelPos, cChunk & a_Chunk) const { } diff --git a/tests/SchematicFileSerializer/Stubs.cpp b/tests/SchematicFileSerializer/Stubs.cpp index 67ecde7cd..1209c4cef 100644 --- a/tests/SchematicFileSerializer/Stubs.cpp +++ b/tests/SchematicFileSerializer/Stubs.cpp @@ -114,15 +114,6 @@ bool cBlockHandler::DoesIgnoreBuildCollision(cChunkInterface & a_ChunkInterface, -bool cBlockHandler::DoesDropOnUnsuitable(void) const -{ - return true; -} - - - - - void cBlockHandler::Check(cChunkInterface & a_ChunkInterface, cBlockPluginInterface & a_PluginInterface, Vector3i a_RelPos, cChunk & a_Chunk) const { } -- cgit v1.2.3