Skip to content

FortuneDropHelper ​

final class · pocketmine\block\utils\FortuneDropHelper · source

Methods ​

binomial() ​

php
public static function binomial(\pocketmine\item\Item $usedItem, int $min, int $minRolls = 3, float $chance = 4 / 7) : int

Increases the drop amount according to a binomial distribution. The function will roll maxBase+level times, and add 1 if a random number between 0-1 is less than the given probability. Each level of fortune adds one extra roll.

As many as maxBase+level items can be dropped. This applies even if the fortune level is 0.

bonusChanceDivisor() ​

php
public static function bonusChanceDivisor(\pocketmine\item\Item $usedItem, int $divisorBase, int $divisorSubtractPerLevel) : bool

Calculates a chance of getting an extra bonus drop by reducing the chance divisor by a given amount per fortune level.

bonusChanceFixed() ​

php
public static function bonusChanceFixed(\pocketmine\item\Item $usedItem, float $chanceBase, float $addedChancePerLevel) : bool

Calculates a chance of getting an extra bonus drop by increasing the chance by a fixed amount per fortune level.

discrete() ​

php
public static function discrete(\pocketmine\item\Item $usedItem, int $min, int $maxBase) : int

Adds the fortune level to the base max and picks a random number between the minimim and adjusted maximum. Each amount in the range has an equal chance of being picked.

weighted() ​

php
public static function weighted(\pocketmine\item\Item $usedItem, int $min, int $maxBase) : int

If a random number between 0-1 is greater than 2/(level+2), this multiplies the max drop amount by level+1, and picks a random amount between the minimum and multiplied maximum. Each level of fortune increases the chance of fortune activation, and also increases the maximum drop limit when activated.

Otherwise, returns a random amount of the item between the minimum and original maximum.

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.