|  | 
| static | binomial (Item $usedItem, int $min, int $minRolls=3, float $chance=4/7) | 
|  | 
| static | bonusChanceDivisor (Item $usedItem, int $divisorBase, int $divisorSubtractPerLevel) | 
|  | 
| static | bonusChanceFixed (Item $usedItem, float $chanceBase, float $addedChancePerLevel) | 
|  | 
| static | discrete (Item $usedItem, int $min, int $maxBase) | 
|  | 
| static | weighted (Item $usedItem, int $min, int $maxBase) | 
|  | 
Definition at line 33 of file FortuneDropHelper.php.
 
◆ binomial()
  
  | 
        
          | static pocketmine\block\utils\FortuneDropHelper::binomial | ( | Item | $usedItem, |  
          |  |  | int | $min, |  
          |  |  | int | $minRolls = 3, |  
          |  |  | float | $chance = 4 / 7 ) |  | static | 
 
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.
- Parameters
- 
  
    | float | $chance | The chance of adding 1 to the amount for each roll, must be in the range 0-1 |  | int | $min | Minimum amount |  | int | $minRolls | Number of rolls if fortune level is 0, added to fortune level to calculate total rolls |  
 
- Returns
- int the number of items to drop 
Definition at line 73 of file FortuneDropHelper.php.
 
 
◆ bonusChanceDivisor()
  
  | 
        
          | static pocketmine\block\utils\FortuneDropHelper::bonusChanceDivisor | ( | Item | $usedItem, |  
          |  |  | int | $divisorBase, |  
          |  |  | int | $divisorSubtractPerLevel ) |  | static | 
 
Calculates a chance of getting an extra bonus drop by reducing the chance divisor by a given amount per fortune level.
- Parameters
- 
  
    | int | $divisorBase | The number to divide 1 by to get the chance, as if the fortune level was 0 |  | int | $divisorSubtractPerLevel | The amount to subtract from the divisor for each level of fortune |  
 
- Returns
- bool whether the bonus drop should be added 
Definition at line 113 of file FortuneDropHelper.php.
 
 
◆ bonusChanceFixed()
  
  | 
        
          | static pocketmine\block\utils\FortuneDropHelper::bonusChanceFixed | ( | Item | $usedItem, |  
          |  |  | float | $chanceBase, |  
          |  |  | float | $addedChancePerLevel ) |  | static | 
 
Calculates a chance of getting an extra bonus drop by increasing the chance by a fixed amount per fortune level.
- Parameters
- 
  
    | float | $chanceBase | The base chance of getting a bonus drop, as if the fortune level was 0 |  | float | $addedChancePerLevel | The amount to add to the chance for each level of fortune |  
 
Definition at line 124 of file FortuneDropHelper.php.
 
 
◆ discrete()
  
  | 
        
          | static pocketmine\block\utils\FortuneDropHelper::discrete | ( | Item | $usedItem, |  
          |  |  | int | $min, |  
          |  |  | int | $maxBase ) |  | static | 
 
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.
- Parameters
- 
  
    | int | $maxBase | Maximum base amount, as if the fortune level was 0 |  
 
- Returns
- int the number of items to drop 
Definition at line 95 of file FortuneDropHelper.php.
 
 
◆ weighted()
  
  | 
        
          | static pocketmine\block\utils\FortuneDropHelper::weighted | ( | Item | $usedItem, |  
          |  |  | int | $min, |  
          |  |  | int | $maxBase ) |  | static | 
 
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.
- Parameters
- 
  
    | Item | $usedItem | The item used to break the block |  | int | $min | Minimum amount |  | int | $maxBase | Maximum amount, as if fortune level was 0 |  
 
- Returns
- int the number of items to drop 
Definition at line 47 of file FortuneDropHelper.php.
 
 
The documentation for this class was generated from the following file: