22declare(strict_types=1);
24namespace pocketmine\item\enchantment;
30use pocketmine\utils\NotCloneable;
31use pocketmine\utils\NotSerializable;
42 private \Closure $minEnchantingPower;
54 private int $primaryItemFlags,
55 private int $secondaryItemFlags,
56 private int $maxLevel,
57 ?\Closure $minEnchantingPower =
null,
58 private int $enchantingPowerRange = 50
60 $this->minEnchantingPower = $minEnchantingPower ?? fn(
int $level) :
int => 1;
65 ), $this->minEnchantingPower);
89 return $this->primaryItemFlags;
100 return $this->secondaryItemFlags;
110 return ($this->primaryItemFlags & $flag) !== 0;
120 return ($this->secondaryItemFlags & $flag) !== 0;
127 return $this->maxLevel;
146 return ($this->minEnchantingPower)($level);
158 return $this->getMinEnchantingPower($level) + $this->enchantingPowerRange;
isCompatibleWith(Enchantment $other)
hasPrimaryItemType(int $flag)
getMinEnchantingPower(int $level)
__construct(private Translatable|string $name, private int $rarity, private int $primaryItemFlags, private int $secondaryItemFlags, private int $maxLevel, ?\Closure $minEnchantingPower=null, private int $enchantingPowerRange=50)
hasSecondaryItemType(int $flag)
getMaxEnchantingPower(int $level)
static validateCallableSignature(callable|CallbackType $signature, callable $subject)