1
0

Do not fake a tool when converting to pickups (#5170)

* When the cause of destruction was world-induced (CanBeAt check failed) there is no tool. Pass the nullptr directly to ConvertToPickups and let it handle it.
* Fixes #4795
- Remove unused a_Digger parameter to ConvertToPickups.
This commit is contained in:
Tiger Wang 2021-03-28 14:41:34 +01:00 committed by GitHub
parent 748b121703
commit 125df19477
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
70 changed files with 72 additions and 74 deletions

View File

@ -14,7 +14,7 @@ public:
private: private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
// Don't drop anything: // Don't drop anything:
return {}; return {};

View File

@ -21,7 +21,7 @@ public:
private: private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
return cItem(m_BlockType, 1, a_BlockMeta >> 2); return cItem(m_BlockType, 1, a_BlockMeta >> 2);
} }

View File

@ -19,7 +19,7 @@ public:
using Super::Super; using Super::Super;
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
// Drops handled by the block entity: // Drops handled by the block entity:
return {}; return {};

View File

@ -170,7 +170,7 @@ void cBlockBedHandler::OnPlacedByPlayer(cChunkInterface & a_ChunkInterface, cWor
cItems cBlockBedHandler::ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const cItems cBlockBedHandler::ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const
{ {
// Drops handled by the block entity: // Drops handled by the block entity:
return {}; return {};

View File

@ -68,7 +68,7 @@ private:
const Vector3i a_CursorPos const Vector3i a_CursorPos
) const override; ) const override;
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override; virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cItem * a_Tool) const override;
virtual void OnPlacedByPlayer( virtual void OnPlacedByPlayer(
cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer & a_Player, cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer & a_Player,

View File

@ -47,7 +47,7 @@ private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
if (IsMetaTopPart(a_BlockMeta)) if (IsMetaTopPart(a_BlockMeta))
{ {

View File

@ -15,7 +15,7 @@ public:
private: private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
if (ToolHasSilkTouch(a_Tool)) if (ToolHasSilkTouch(a_Tool))
{ {

View File

@ -18,7 +18,7 @@ public:
private: private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
return cItem(E_ITEM_BREWING_STAND); // We have to drop the item form of a brewing stand return cItem(E_ITEM_BREWING_STAND); // We have to drop the item form of a brewing stand
} }

View File

@ -49,7 +49,7 @@ private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
// Give nothing // Give nothing
return {}; return {};

View File

@ -19,7 +19,7 @@ public:
private: private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
return cItem(E_ITEM_CAULDRON, 1, 0); return cItem(E_ITEM_CAULDRON, 1, 0);
} }

View File

@ -18,7 +18,7 @@ public:
private: private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
// Silk touch gives cobweb, anything else gives just string: // Silk touch gives cobweb, anything else gives just string:
if (ToolHasSilkTouch(a_Tool)) if (ToolHasSilkTouch(a_Tool))

View File

@ -69,7 +69,7 @@ private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
// If fully grown, give 3 items, otherwise just one: // If fully grown, give 3 items, otherwise just one:
auto growState = a_BlockMeta >> 2; auto growState = a_BlockMeta >> 2;

View File

@ -18,7 +18,7 @@ public:
private: private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
// Don't allow as a pickup: // Don't allow as a pickup:
return {}; return {};

View File

@ -182,7 +182,7 @@ private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
return cItem(E_ITEM_COMPARATOR, 1, 0); return cItem(E_ITEM_COMPARATOR, 1, 0);
} }

View File

@ -32,7 +32,7 @@ private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
auto & rand = GetRandomProvider(); auto & rand = GetRandomProvider();

View File

@ -40,7 +40,7 @@ private:
} }
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
// Always drop the regular daylight sensor: // Always drop the regular daylight sensor:
return { E_BLOCK_DAYLIGHT_SENSOR }; return { E_BLOCK_DAYLIGHT_SENSOR };

View File

@ -52,7 +52,7 @@ private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
// If cutting down with shears, drop self: // If cutting down with shears, drop self:
if ((a_Tool != nullptr) && (a_Tool->m_ItemType == E_ITEM_SHEARS)) if ((a_Tool != nullptr) && (a_Tool->m_ItemType == E_ITEM_SHEARS))

View File

@ -18,7 +18,7 @@ public:
private: private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
if (a_BlockMeta == E_META_DIRT_COARSE) if (a_BlockMeta == E_META_DIRT_COARSE)
{ {

View File

@ -205,7 +205,7 @@ private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
switch (m_BlockType) switch (m_BlockType)
{ {

View File

@ -62,7 +62,7 @@ private:
} }
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
// Drops handled by the block entity: // Drops handled by the block entity:
return {}; return {};

View File

@ -17,7 +17,7 @@ public:
private: private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
// Only drop something when mined with a pickaxe: // Only drop something when mined with a pickaxe:
if ( if (

View File

@ -27,7 +27,7 @@ public:
private: private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
return cItem(E_BLOCK_DIRT, 1, 0); return cItem(E_BLOCK_DIRT, 1, 0);
} }

View File

@ -58,7 +58,7 @@ private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
// No pickups from this block // No pickups from this block
return {}; return {};

View File

@ -18,7 +18,7 @@ public:
private: private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
NIBBLETYPE meta = a_BlockMeta & 0x7; NIBBLETYPE meta = a_BlockMeta & 0x7;
return cItem(m_BlockType, 1, meta); return cItem(m_BlockType, 1, meta);

View File

@ -16,7 +16,7 @@ public:
private: private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
return cItem(E_ITEM_FLOWER_POT, 1, 0); return cItem(E_ITEM_FLOWER_POT, 1, 0);
} }

View File

@ -22,7 +22,7 @@ protected:
private: private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
// No pickups // No pickups
return {}; return {};

View File

@ -17,7 +17,7 @@ public:
private: private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
return cItem(E_BLOCK_FURNACE); // We can't drop a lit furnace return cItem(E_BLOCK_FURNACE); // We can't drop a lit furnace
} }

View File

@ -16,7 +16,7 @@ public:
private: private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
// Only drop self when mined with silk-touch: // Only drop self when mined with silk-touch:
if (ToolHasSilkTouch(a_Tool)) if (ToolHasSilkTouch(a_Tool))

View File

@ -16,7 +16,7 @@ public:
private: private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
// Drop self only when using silk-touch: // Drop self only when using silk-touch:
if (ToolHasSilkTouch(a_Tool)) if (ToolHasSilkTouch(a_Tool))

View File

@ -31,7 +31,7 @@ private:
DieInDarkness DieInDarkness
}; };
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
if (!ToolHasSilkTouch(a_Tool)) if (!ToolHasSilkTouch(a_Tool))
{ {

View File

@ -16,7 +16,7 @@ public:
private: private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
if (ToolHasSilkTouch(a_Tool)) if (ToolHasSilkTouch(a_Tool))
{ {

View File

@ -516,9 +516,8 @@ void cBlockHandler::NeighborChanged(cChunkInterface & a_ChunkInterface, Vector3i
cItems cBlockHandler::ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const cItems cBlockHandler::ConvertToPickups(NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const
{ {
UNUSED(a_Digger);
UNUSED(a_Tool); UNUSED(a_Tool);
// Add self: // Add self:

View File

@ -139,7 +139,7 @@ public:
a_Digger is the entity that caused the conversion, usually the player digging. a_Digger is the entity that caused the conversion, usually the player digging.
a_Tool is the tool used for the digging. a_Tool is the tool used for the digging.
The default implementation drops a single item created from m_BlockType and the current meta. */ The default implementation drops a single item created from m_BlockType and the current meta. */
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger = nullptr, const cItem * a_Tool = nullptr) const; virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cItem * a_Tool = nullptr) const;
/** Checks if the block can stay at the specified relative coords in the chunk */ /** Checks if the block can stay at the specified relative coords in the chunk */
virtual bool CanBeAt( virtual bool CanBeAt(

View File

@ -19,7 +19,7 @@ public:
private: private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
if (ToolHasSilkTouch(a_Tool)) if (ToolHasSilkTouch(a_Tool))
{ {

View File

@ -18,7 +18,7 @@ public:
private: private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
// Only drop self when using silk-touch: // Only drop self when using silk-touch:
if (ToolHasSilkTouch(a_Tool)) if (ToolHasSilkTouch(a_Tool))

View File

@ -30,7 +30,7 @@ private:
} }
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
switch (a_BlockMeta) switch (a_BlockMeta)
{ {

View File

@ -110,7 +110,7 @@ private:
return false; return false;
} }
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
// If breaking with shears, drop self: // If breaking with shears, drop self:
if ((a_Tool != nullptr) && (a_Tool->m_ItemType == E_ITEM_SHEARS)) if ((a_Tool != nullptr) && (a_Tool->m_ItemType == E_ITEM_SHEARS))

View File

@ -45,7 +45,7 @@ private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
// Reset meta to zero: // Reset meta to zero:
return cItem(E_BLOCK_LEVER, 1, 0); return cItem(E_BLOCK_LEVER, 1, 0);

View File

@ -18,7 +18,7 @@ public:
private: private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
const auto DropNum = FortuneDiscreteRandom(3, 7, ToolFortuneLevel(a_Tool), 9); const auto DropNum = FortuneDiscreteRandom(3, 7, ToolFortuneLevel(a_Tool), 9);
return cItem(E_ITEM_MELON_SLICE, DropNum); return cItem(E_ITEM_MELON_SLICE, DropNum);

View File

@ -18,7 +18,7 @@ public:
private: private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
// Drops handled by the block entity: // Drops handled by the block entity:
return {}; return {};

View File

@ -44,7 +44,7 @@ private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
// No pickups // No pickups
return {}; return {};

View File

@ -18,7 +18,7 @@ private:
// TODO: Add Mycel Spread // TODO: Add Mycel Spread
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
return cItem(E_BLOCK_DIRT, 1, 0); return cItem(E_BLOCK_DIRT, 1, 0);
} }

View File

@ -19,7 +19,7 @@ public:
private: private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
if (a_BlockMeta == 0x03) if (a_BlockMeta == 0x03)
{ {

View File

@ -22,7 +22,7 @@ protected:
private: private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
// If using silk-touch, drop self rather than the resource: // If using silk-touch, drop self rather than the resource:
if (ToolHasSilkTouch(a_Tool)) if (ToolHasSilkTouch(a_Tool))

View File

@ -18,7 +18,7 @@ public:
private: private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
// Only drop self when using silk-touch: // Only drop self when using silk-touch:
if (ToolHasSilkTouch(a_Tool)) if (ToolHasSilkTouch(a_Tool))

View File

@ -340,7 +340,7 @@ void cBlockPistonHeadHandler::OnBroken(
cItems cBlockPistonHeadHandler::ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const cItems cBlockPistonHeadHandler::ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const
{ {
// Give a normal\sticky piston base, not piston extension // Give a normal\sticky piston base, not piston extension
// With 1.7, the item forms of these technical blocks have been removed, so giving someone this will crash their client... // With 1.7, the item forms of these technical blocks have been removed, so giving someone this will crash their client...

View File

@ -161,5 +161,5 @@ public:
const cEntity * a_Digger const cEntity * a_Digger
) const override; ) const override;
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override; virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cItem * a_Tool) const override;
} ; } ;

View File

@ -40,7 +40,7 @@ private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
// No pickups // No pickups
return {}; return {};

View File

@ -49,7 +49,7 @@ private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
return cItem(E_ITEM_REDSTONE_DUST, 1, 0); return cItem(E_ITEM_REDSTONE_DUST, 1, 0);
} }

View File

@ -16,7 +16,7 @@ public:
private: private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
// Always drop the Off variant: // Always drop the Off variant:
return(cItem(E_BLOCK_REDSTONE_LAMP_OFF, 1, 0)); return(cItem(E_BLOCK_REDSTONE_LAMP_OFF, 1, 0));

View File

@ -135,7 +135,7 @@ private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
return cItem(E_ITEM_REDSTONE_REPEATER, 1, 0); return cItem(E_ITEM_REDSTONE_REPEATER, 1, 0);
} }

View File

@ -19,7 +19,7 @@ public:
private: private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
// The low 3 bits store the sapling type; bit 0x08 is the growth timer (not used in pickups) // The low 3 bits store the sapling type; bit 0x08 is the growth timer (not used in pickups)
return cItem(m_BlockType, 1, a_BlockMeta & 0x07); return cItem(m_BlockType, 1, a_BlockMeta & 0x07);

View File

@ -18,7 +18,7 @@ public:
private: private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
// Drop self only when using silk-touch: // Drop self only when using silk-touch:
if (ToolHasSilkTouch(a_Tool)) if (ToolHasSilkTouch(a_Tool))

View File

@ -40,7 +40,7 @@ private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
// Reset the orientation part of meta, keep the sub-type part of meta // Reset the orientation part of meta, keep the sub-type part of meta
return cItem(m_BlockType, 1, a_BlockMeta & 0x03); return cItem(m_BlockType, 1, a_BlockMeta & 0x03);

View File

@ -33,7 +33,7 @@ public:
private: private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
return cItem(E_ITEM_SIGN, 1, 0); return cItem(E_ITEM_SIGN, 1, 0);
} }

View File

@ -39,7 +39,7 @@ public:
private: private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
// Reset the "top half" flag: // Reset the "top half" flag:
return cItem(m_BlockType, 1, a_BlockMeta & 0x07); return cItem(m_BlockType, 1, a_BlockMeta & 0x07);
@ -246,7 +246,7 @@ public:
private: private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
BLOCKTYPE Block = GetSingleSlabType(m_BlockType); BLOCKTYPE Block = GetSingleSlabType(m_BlockType);
return cItem(Block, 2, a_BlockMeta & 0x7); return cItem(Block, 2, a_BlockMeta & 0x7);

View File

@ -81,7 +81,7 @@ private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
// No drop unless dug up with a shovel // No drop unless dug up with a shovel
if ((a_Tool == nullptr) || !ItemCategory::IsShovel(a_Tool->m_ItemType)) if ((a_Tool == nullptr) || !ItemCategory::IsShovel(a_Tool->m_ItemType))

View File

@ -22,7 +22,7 @@ public:
private: private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
/* /*
Use correct percent: Use correct percent:

View File

@ -17,7 +17,7 @@ public:
private: private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
// Convert stone to cobblestone, unless using silk-touch: // Convert stone to cobblestone, unless using silk-touch:
if ( if (

View File

@ -18,7 +18,7 @@ public:
private: private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
return cItem(E_ITEM_SUGARCANE, 1, 0); return cItem(E_ITEM_SUGARCANE, 1, 0);
} }

View File

@ -29,7 +29,7 @@ private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
// If using shears, drop self: // If using shears, drop self:
if ((a_Tool != nullptr) && (a_Tool->m_ItemType == E_ITEM_SHEARS)) if ((a_Tool != nullptr) && (a_Tool->m_ItemType == E_ITEM_SHEARS))

View File

@ -245,7 +245,7 @@ public:
private: private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
// Always drop the ON torch, meta 0: // Always drop the ON torch, meta 0:
return { E_BLOCK_REDSTONE_TORCH_ON }; return { E_BLOCK_REDSTONE_TORCH_ON };

View File

@ -18,7 +18,7 @@ public:
private: private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
return cItem(E_ITEM_STRING, 1, 0); return cItem(E_ITEM_STRING, 1, 0);
} }

View File

@ -46,7 +46,7 @@ private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
// Only drops self when using shears, otherwise drops nothing: // Only drops self when using shears, otherwise drops nothing:
if ((a_Tool == nullptr) || (a_Tool->m_ItemType != E_ITEM_SHEARS)) if ((a_Tool == nullptr) || (a_Tool->m_ItemType != E_ITEM_SHEARS))

View File

@ -38,7 +38,7 @@ public:
private: private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
return cItem(E_ITEM_SIGN, 1, 0); return cItem(E_ITEM_SIGN, 1, 0);
} }

View File

@ -43,7 +43,7 @@ protected:
private: private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{ {
// Reset the meta to zero: // Reset the meta to zero:
return cItem(this->m_BlockType); return cItem(this->m_BlockType);

View File

@ -960,10 +960,9 @@ cItems cChunk::PickupsFromBlock(Vector3i a_RelPos, const cEntity * a_Digger, con
cItems Pickups; cItems Pickups;
const auto BlockEntity = GetBlockEntityRel(a_RelPos); const auto BlockEntity = GetBlockEntityRel(a_RelPos);
const auto ToolHandler = (a_Tool != nullptr) ? a_Tool->GetHandler() : cItemHandler::GetItemHandler(E_ITEM_EMPTY); if ((a_Tool == nullptr) || a_Tool->GetHandler()->CanHarvestBlock(BlockType))
if (ToolHandler->CanHarvestBlock(BlockType))
{ {
Pickups = cBlockHandler::For(BlockType).ConvertToPickups(BlockMeta, a_Digger, a_Tool); Pickups = cBlockHandler::For(BlockType).ConvertToPickups(BlockMeta, a_Tool);
if (BlockEntity != nullptr) if (BlockEntity != nullptr)
{ {

View File

@ -149,7 +149,7 @@ void cBlockHandler::NeighborChanged(cChunkInterface & a_ChunkInterface, Vector3i
cItems cBlockHandler::ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const cItems cBlockHandler::ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const
{ {
return cItems(); return cItems();
} }

View File

@ -151,7 +151,7 @@ void cBlockHandler::NeighborChanged(cChunkInterface & a_ChunkInterface, Vector3i
cItems cBlockHandler::ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const cItems cBlockHandler::ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const
{ {
return cItems(); return cItems();
} }

View File

@ -69,7 +69,7 @@ void cBlockHandler::NeighborChanged(cChunkInterface & a_ChunkInterface, Vector3i
cItems cBlockHandler::ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const cItems cBlockHandler::ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const
{ {
return cItems(); return cItems();
} }