48 const auto DropMult = std::max(
static_cast<char>(1), FloorC<char>(Random.RandReal(FortuneLevel + 2.0)));
75 if (a_Digger ==
nullptr)
84 const auto Player =
static_cast<const cPlayer *
>(a_Digger);
85 if (!Player->IsGameModeSurvival())
97 if (!Player->GetEquippedItem().GetHandler().CanHarvestBlock(
m_BlockType))
105 switch (a_OldBlockType)
111 Reward = Random.RandInt(2, 5);
118 Reward = Random.RandInt(1, 5);
125 Reward = Random.RandInt(3, 7);
131 Reward = Random.RandInt(2);
154 using cBlockOreHandler::cBlockOreHandler;
@ E_BLOCK_REDSTONE_ORE_GLOWING
@ E_BLOCK_NETHER_QUARTZ_ORE
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
unsigned char BLOCKTYPE
The datatype used by blockdata.
MTRand & GetRandomProvider()
Returns the current thread's random number source.
Vector3< double > Vector3d
static unsigned char ToolFortuneLevel(const cItem *a_Tool)
Returns the fortune level of a tool, if it is a valid tool.
static char FortuneDiscreteRandom(char a_MinDrop, char a_DefaultMax, unsigned char a_BonusMax, char a_DropCap=25)
Returns a random number of drops taking into account fortune.
static bool ToolHasSilkTouch(const cItem *a_Tool)
Returns true if the specified tool is valid and has a non-zero silk-touch enchantment.
constexpr cBlockHandler(BLOCKTYPE a_BlockType)
const BLOCKTYPE m_BlockType
virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem *const a_Tool) const override
Returns the pickups that would result if the block was mined by a_Digger using a_Tool.
~cBlockOreHandler()=default
virtual void OnBroken(cChunkInterface &a_ChunkInterface, cWorldInterface &a_WorldInterface, Vector3i a_BlockPos, BLOCKTYPE a_OldBlockType, NIBBLETYPE a_OldBlockMeta, const cEntity *a_Digger) const override
Called after a block gets broken (replaced with air), by natural means.
virtual std::vector< UInt32 > SpawnSplitExperienceOrbs(Vector3d a_Pos, int a_Reward)=0
Spawns experience orbs of the specified total value at the given location.
bool IsPlayer(void) const
This class bridges a vector of cItem for safe access via Lua.