Skip to content

NumberProvider 5.46.0 ​

final class · pocketmine\loot\NumberProvider · source

A vanilla number provider (constant, uniform, binomial...), with Java's float arithmetic.

Methods ​

constant() ​

php
public static function constant(float $value) : self

getFloat() ​

php
public function getFloat(\pocketmine\loot\LootContext $context) : float

getInt() ​

php
public function getInt(\pocketmine\loot\LootContext $context) : int

nextInt() ​

php
public static function nextInt(\pocketmine\loot\LootContext $context, int $min, int $max) : int

Mth.nextInt(): a random int in [min, max], without using the random if min >= max.

parse() ​

php
public static function parse(mixed $json, \pocketmine\loot\LootCompiler $compiler) : self

randomBetween() ​

php
public static function randomBetween(\pocketmine\loot\LootContext $context, float $min, float $max) : float

Mth.randomBetween() for floats.

round() ​

php
public static function round(float $value) : int

Java's Math.round(float).

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