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:
|
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 {};
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -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 {};
|
||||||
|
@ -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 {};
|
||||||
|
@ -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,
|
||||||
|
@ -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))
|
||||||
{
|
{
|
||||||
|
@ -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))
|
||||||
{
|
{
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
|
@ -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 {};
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -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))
|
||||||
|
@ -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;
|
||||||
|
@ -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 {};
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -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();
|
||||||
|
|
||||||
|
@ -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 };
|
||||||
|
@ -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))
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
|
@ -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 {};
|
||||||
|
@ -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 (
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -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 {};
|
||||||
|
@ -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);
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -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 {};
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
|
@ -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))
|
||||||
|
@ -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))
|
||||||
|
@ -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))
|
||||||
{
|
{
|
||||||
|
@ -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))
|
||||||
{
|
{
|
||||||
|
@ -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:
|
||||||
|
@ -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(
|
||||||
|
@ -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))
|
||||||
{
|
{
|
||||||
|
@ -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))
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
|
@ -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))
|
||||||
|
@ -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);
|
||||||
|
@ -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);
|
||||||
|
@ -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 {};
|
||||||
|
@ -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 {};
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
|
@ -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))
|
||||||
|
@ -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))
|
||||||
|
@ -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...
|
||||||
|
@ -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;
|
||||||
} ;
|
} ;
|
||||||
|
@ -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 {};
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -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));
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
|
@ -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))
|
||||||
|
@ -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);
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
|
@ -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))
|
||||||
|
@ -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:
|
||||||
|
@ -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 (
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -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))
|
||||||
|
@ -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 };
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -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))
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user