mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-12 06:25:32 +00:00
Enchantment: Added max level property
This commit is contained in:
parent
12ac2f4ac7
commit
e0b063ac85
@ -87,9 +87,9 @@ class Enchantment{
|
|||||||
public static function init(){
|
public static function init(){
|
||||||
self::$enchantments = new \SplFixedArray(256);
|
self::$enchantments = new \SplFixedArray(256);
|
||||||
|
|
||||||
self::registerEnchantment(new Enchantment(self::PROTECTION, "%enchantment.protect.all", self::RARITY_COMMON, self::SLOT_ARMOR));
|
self::registerEnchantment(new Enchantment(self::PROTECTION, "%enchantment.protect.all", self::RARITY_COMMON, self::SLOT_ARMOR, 4));
|
||||||
self::registerEnchantment(new Enchantment(self::FIRE_PROTECTION, "%enchantment.protect.fire", self::RARITY_UNCOMMON, self::SLOT_ARMOR));
|
self::registerEnchantment(new Enchantment(self::FIRE_PROTECTION, "%enchantment.protect.fire", self::RARITY_UNCOMMON, self::SLOT_ARMOR, 4));
|
||||||
self::registerEnchantment(new Enchantment(self::FEATHER_FALLING, "%enchantment.protect.fall", self::RARITY_UNCOMMON, self::SLOT_FEET));
|
self::registerEnchantment(new Enchantment(self::FEATHER_FALLING, "%enchantment.protect.fall", self::RARITY_UNCOMMON, self::SLOT_FEET, 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -133,18 +133,22 @@ class Enchantment{
|
|||||||
private $rarity;
|
private $rarity;
|
||||||
/** @var int */
|
/** @var int */
|
||||||
private $slot;
|
private $slot;
|
||||||
|
/** @var int */
|
||||||
|
private $maxLevel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $id
|
* @param int $id
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @param int $rarity
|
* @param int $rarity
|
||||||
* @param int $slot
|
* @param int $slot
|
||||||
|
* @param int $maxLevel
|
||||||
*/
|
*/
|
||||||
public function __construct(int $id, string $name, int $rarity, int $slot){
|
public function __construct(int $id, string $name, int $rarity, int $slot, int $maxLevel){
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
$this->rarity = $rarity;
|
$this->rarity = $rarity;
|
||||||
$this->slot = $slot;
|
$this->slot = $slot;
|
||||||
|
$this->maxLevel = $maxLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -188,4 +192,12 @@ class Enchantment{
|
|||||||
public function hasSlot(int $slot) : bool{
|
public function hasSlot(int $slot) : bool{
|
||||||
return ($this->slot & $slot) > 0;
|
return ($this->slot & $slot) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the maximum level of this enchantment that can be found on an enchantment table.
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getMaxLevel() : int{
|
||||||
|
return $this->maxLevel;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user