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:
parent
748b121703
commit
125df19477
@ -14,7 +14,7 @@ public:
|
||||
|
||||
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:
|
||||
return {};
|
||||
|
@ -21,7 +21,7 @@ public:
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ public:
|
||||
|
||||
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:
|
||||
return {};
|
||||
|
@ -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:
|
||||
return {};
|
||||
|
@ -68,7 +68,7 @@ private:
|
||||
const Vector3i a_CursorPos
|
||||
) 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(
|
||||
cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer & a_Player,
|
||||
|
@ -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))
|
||||
{
|
||||
|
@ -15,7 +15,7 @@ public:
|
||||
|
||||
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))
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ public:
|
||||
|
||||
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
|
||||
}
|
||||
|
@ -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
|
||||
return {};
|
||||
|
@ -19,7 +19,7 @@ public:
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ public:
|
||||
|
||||
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:
|
||||
if (ToolHasSilkTouch(a_Tool))
|
||||
|
@ -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:
|
||||
auto growState = a_BlockMeta >> 2;
|
||||
|
@ -18,7 +18,7 @@ public:
|
||||
|
||||
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:
|
||||
return {};
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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:
|
||||
return { E_BLOCK_DAYLIGHT_SENSOR };
|
||||
|
@ -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 ((a_Tool != nullptr) && (a_Tool->m_ItemType == E_ITEM_SHEARS))
|
||||
|
@ -18,7 +18,7 @@ public:
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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:
|
||||
return {};
|
||||
|
@ -17,7 +17,7 @@ public:
|
||||
|
||||
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:
|
||||
if (
|
||||
|
@ -27,7 +27,7 @@ public:
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -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
|
||||
return {};
|
||||
|
@ -18,7 +18,7 @@ public:
|
||||
|
||||
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;
|
||||
return cItem(m_BlockType, 1, meta);
|
||||
|
@ -16,7 +16,7 @@ public:
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ protected:
|
||||
|
||||
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
|
||||
return {};
|
||||
|
@ -17,7 +17,7 @@ public:
|
||||
|
||||
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
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ public:
|
||||
|
||||
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:
|
||||
if (ToolHasSilkTouch(a_Tool))
|
||||
|
@ -16,7 +16,7 @@ public:
|
||||
|
||||
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:
|
||||
if (ToolHasSilkTouch(a_Tool))
|
||||
|
@ -31,7 +31,7 @@ private:
|
||||
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))
|
||||
{
|
||||
|
@ -16,7 +16,7 @@ public:
|
||||
|
||||
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))
|
||||
{
|
||||
|
@ -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);
|
||||
|
||||
// Add self:
|
||||
|
@ -139,7 +139,7 @@ public:
|
||||
a_Digger is the entity that caused the conversion, usually the player 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. */
|
||||
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 */
|
||||
virtual bool CanBeAt(
|
||||
|
@ -19,7 +19,7 @@ public:
|
||||
|
||||
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))
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ public:
|
||||
|
||||
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:
|
||||
if (ToolHasSilkTouch(a_Tool))
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -110,7 +110,7 @@ private:
|
||||
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 ((a_Tool != nullptr) && (a_Tool->m_ItemType == E_ITEM_SHEARS))
|
||||
|
@ -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:
|
||||
return cItem(E_BLOCK_LEVER, 1, 0);
|
||||
|
@ -18,7 +18,7 @@ public:
|
||||
|
||||
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);
|
||||
return cItem(E_ITEM_MELON_SLICE, DropNum);
|
||||
|
@ -18,7 +18,7 @@ public:
|
||||
|
||||
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:
|
||||
return {};
|
||||
|
@ -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
|
||||
return {};
|
||||
|
@ -18,7 +18,7 @@ private:
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ public:
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -22,7 +22,7 @@ protected:
|
||||
|
||||
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 (ToolHasSilkTouch(a_Tool))
|
||||
|
@ -18,7 +18,7 @@ public:
|
||||
|
||||
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:
|
||||
if (ToolHasSilkTouch(a_Tool))
|
||||
|
@ -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
|
||||
// With 1.7, the item forms of these technical blocks have been removed, so giving someone this will crash their client...
|
||||
|
@ -161,5 +161,5 @@ public:
|
||||
const cEntity * a_Digger
|
||||
) 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;
|
||||
} ;
|
||||
|
@ -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
|
||||
return {};
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ public:
|
||||
|
||||
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:
|
||||
return(cItem(E_BLOCK_REDSTONE_LAMP_OFF, 1, 0));
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ public:
|
||||
|
||||
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)
|
||||
return cItem(m_BlockType, 1, a_BlockMeta & 0x07);
|
||||
|
@ -18,7 +18,7 @@ public:
|
||||
|
||||
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:
|
||||
if (ToolHasSilkTouch(a_Tool))
|
||||
|
@ -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
|
||||
return cItem(m_BlockType, 1, a_BlockMeta & 0x03);
|
||||
|
@ -33,7 +33,7 @@ public:
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
|
||||
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:
|
||||
return cItem(m_BlockType, 1, a_BlockMeta & 0x07);
|
||||
@ -246,7 +246,7 @@ public:
|
||||
|
||||
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);
|
||||
return cItem(Block, 2, a_BlockMeta & 0x7);
|
||||
|
@ -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
|
||||
if ((a_Tool == nullptr) || !ItemCategory::IsShovel(a_Tool->m_ItemType))
|
||||
|
@ -22,7 +22,7 @@ public:
|
||||
|
||||
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:
|
||||
|
@ -17,7 +17,7 @@ public:
|
||||
|
||||
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:
|
||||
if (
|
||||
|
@ -18,7 +18,7 @@ public:
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -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 ((a_Tool != nullptr) && (a_Tool->m_ItemType == E_ITEM_SHEARS))
|
||||
|
@ -245,7 +245,7 @@ public:
|
||||
|
||||
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:
|
||||
return { E_BLOCK_REDSTONE_TORCH_ON };
|
||||
|
@ -18,7 +18,7 @@ public:
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -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:
|
||||
if ((a_Tool == nullptr) || (a_Tool->m_ItemType != E_ITEM_SHEARS))
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ protected:
|
||||
|
||||
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:
|
||||
return cItem(this->m_BlockType);
|
||||
|
@ -960,10 +960,9 @@ cItems cChunk::PickupsFromBlock(Vector3i a_RelPos, const cEntity * a_Digger, con
|
||||
cItems Pickups;
|
||||
const auto BlockEntity = GetBlockEntityRel(a_RelPos);
|
||||
|
||||
const auto ToolHandler = (a_Tool != nullptr) ? a_Tool->GetHandler() : cItemHandler::GetItemHandler(E_ITEM_EMPTY);
|
||||
if (ToolHandler->CanHarvestBlock(BlockType))
|
||||
if ((a_Tool == nullptr) || a_Tool->GetHandler()->CanHarvestBlock(BlockType))
|
||||
{
|
||||
Pickups = cBlockHandler::For(BlockType).ConvertToPickups(BlockMeta, a_Digger, a_Tool);
|
||||
Pickups = cBlockHandler::For(BlockType).ConvertToPickups(BlockMeta, a_Tool);
|
||||
|
||||
if (BlockEntity != nullptr)
|
||||
{
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user