Move enchanting seed generation to EnchantmentHelper

This commit is contained in:
Dylan K. Taylor
2023-08-23 15:52:49 +01:00
parent 29fdc8b08d
commit d942748203
3 changed files with 14 additions and 6 deletions

View File

@@ -28,6 +28,7 @@ use pocketmine\item\enchantment\AvailableEnchantmentRegistry as EnchantmentRegis
use pocketmine\item\Item;
use pocketmine\item\ItemTypeIds;
use pocketmine\item\VanillaItems as Items;
use pocketmine\utils\Limits;
use pocketmine\utils\Random;
use pocketmine\world\Position;
use function abs;
@@ -37,6 +38,7 @@ use function count;
use function floor;
use function max;
use function min;
use function mt_rand;
use function ord;
use function round;
@@ -47,6 +49,13 @@ final class EnchantmentHelper{
//NOOP
}
/**
* Generates a new random seed for enchant option randomization.
*/
public static function generateSeed() : int{
return mt_rand(Limits::INT32_MIN, Limits::INT32_MAX);
}
/**
* @param EnchantmentInstance[] $enchantments
*/