mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-12 06:25:32 +00:00
Add the long-awaited Enchantment::registerEnchantment() API method
api3/blocks users: I am sorry I kept you waiting so long
This commit is contained in:
parent
9598b8cee4
commit
6dbdefafdd
@ -89,9 +89,18 @@ class Enchantment{
|
|||||||
public static function init(){
|
public static function init(){
|
||||||
self::$enchantments = new \SplFixedArray(256);
|
self::$enchantments = new \SplFixedArray(256);
|
||||||
|
|
||||||
self::$enchantments[self::PROTECTION] = new Enchantment(self::PROTECTION, "%enchantment.protect.all", self::RARITY_COMMON, self::ACTIVATION_EQUIP, self::SLOT_ARMOR);
|
self::registerEnchantment(new Enchantment(self::PROTECTION, "%enchantment.protect.all", self::RARITY_COMMON, self::ACTIVATION_EQUIP, self::SLOT_ARMOR));
|
||||||
self::$enchantments[self::FIRE_PROTECTION] = new Enchantment(self::FIRE_PROTECTION, "%enchantment.protect.fire", self::RARITY_UNCOMMON, self::ACTIVATION_EQUIP, self::SLOT_ARMOR);
|
self::registerEnchantment(new Enchantment(self::FIRE_PROTECTION, "%enchantment.protect.fire", self::RARITY_UNCOMMON, self::ACTIVATION_EQUIP, self::SLOT_ARMOR));
|
||||||
self::$enchantments[self::FEATHER_FALLING] = new Enchantment(self::FEATHER_FALLING, "%enchantment.protect.fall", self::RARITY_UNCOMMON, self::ACTIVATION_EQUIP, self::SLOT_FEET);
|
self::registerEnchantment(new Enchantment(self::FEATHER_FALLING, "%enchantment.protect.fall", self::RARITY_UNCOMMON, self::ACTIVATION_EQUIP, self::SLOT_FEET));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers an enchantment type.
|
||||||
|
*
|
||||||
|
* @param Enchantment $enchantment
|
||||||
|
*/
|
||||||
|
public static function registerEnchantment(Enchantment $enchantment) : void{
|
||||||
|
self::$enchantments[$enchantment->getId()] = clone $enchantment;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user