1
0

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.
This commit is contained in:
Tiger Wang 2021-03-14 00:30:40 +00:00
parent 45591cbe7b
commit de76503d5c
8 changed files with 2 additions and 74 deletions

View File

@ -494,15 +494,8 @@ void cBlockHandler::OnNeighborChanged(cChunkInterface & a_ChunkInterface, Vector
return; return;
} }
if (DoesDropOnUnsuitable())
{
a_ChunkInterface.DropBlockAsPickups(a_BlockPos); a_ChunkInterface.DropBlockAsPickups(a_BlockPos);
} }
else
{
a_ChunkInterface.SetBlock(a_BlockPos, E_BLOCK_AIR, 0);
}
}
@ -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 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 // Default functionality: Test the height, since we assume full voxels with varying height

View File

@ -166,10 +166,6 @@ public:
@param a_Meta Meta value of the block currently at a_Pos */ @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; 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. /** 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. */ 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; virtual bool IsInsideBlock(const Vector3d a_RelPosition, const NIBBLETYPE a_BlockMeta) const;

View File

@ -120,15 +120,6 @@ private:
virtual bool DoesDropOnUnsuitable(void) const override
{
return false;
}
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) const override virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) const override
{ {
UNUSED(a_Meta); UNUSED(a_Meta);

View File

@ -180,10 +180,6 @@ private:
if ((Common == 0) && !HasTop) if ((Common == 0) && !HasTop)
{ {
// The vine just lost all its support, destroy the block: // 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); a_Chunk.SetBlock(a_RelPos, E_BLOCK_AIR, 0);
return false; return false;
} }
@ -207,15 +203,6 @@ private:
virtual bool DoesDropOnUnsuitable(void) const override
{
return false;
}
virtual void OnUpdate( virtual void OnUpdate(
cChunkInterface & a_ChunkInterface, cChunkInterface & a_ChunkInterface,
cWorldInterface & a_WorldInterface, cWorldInterface & a_WorldInterface,

View File

@ -298,11 +298,8 @@ void cFloodyFluidSimulator::SpreadToNeighbor(cChunk * a_NearChunk, int a_RelX, i
// Wash away the block there, if possible: // Wash away the block there, if possible:
if (CanWashAway(BlockType)) if (CanWashAway(BlockType))
{
if (cBlockHandler::For(BlockType).DoesDropOnUnsuitable())
{ {
m_World.DropBlockAsPickups(absPos, nullptr, nullptr); m_World.DropBlockAsPickups(absPos, nullptr, nullptr);
}
} // if (CanWashAway) } // if (CanWashAway)
// Spread: // Spread:

View File

@ -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 void cBlockHandler::Check(cChunkInterface & a_ChunkInterface, cBlockPluginInterface & a_PluginInterface, Vector3i a_RelPos, cChunk & a_Chunk) const
{ {
} }

View File

@ -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 void cBlockHandler::Check(cChunkInterface & a_ChunkInterface, cBlockPluginInterface & a_PluginInterface, Vector3i a_RelPos, cChunk & a_Chunk) const
{ {
} }

View File

@ -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 void cBlockHandler::Check(cChunkInterface & a_ChunkInterface, cBlockPluginInterface & a_PluginInterface, Vector3i a_RelPos, cChunk & a_Chunk) const
{ {
} }