From 4dd046979240e327d7406feedf35fb1d2148b138 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Sat, 8 Aug 2015 14:53:03 +0200 Subject: [PATCH] Base enchantment class --- src/pocketmine/Server.php | 2 + .../item/enchantment/Enchantment.php | 158 ++++++++++++++++++ 2 files changed, 160 insertions(+) create mode 100644 src/pocketmine/item/enchantment/Enchantment.php diff --git a/src/pocketmine/Server.php b/src/pocketmine/Server.php index 38075cfc6..b8ac46e98 100644 --- a/src/pocketmine/Server.php +++ b/src/pocketmine/Server.php @@ -55,6 +55,7 @@ use pocketmine\inventory\InventoryType; use pocketmine\inventory\Recipe; use pocketmine\inventory\ShapedRecipe; use pocketmine\inventory\ShapelessRecipe; +use pocketmine\item\enchantment\Enchantment; use pocketmine\item\Item; use pocketmine\lang\BaseLang; use pocketmine\level\format\anvil\Anvil; @@ -1607,6 +1608,7 @@ class Server{ Item::init(); Biome::init(); Effect::init(); + Enchantment::init(); /** TODO: @deprecated */ TextWrapper::init(); $this->craftingManager = new CraftingManager(); diff --git a/src/pocketmine/item/enchantment/Enchantment.php b/src/pocketmine/item/enchantment/Enchantment.php new file mode 100644 index 000000000..d4c06e206 --- /dev/null +++ b/src/pocketmine/item/enchantment/Enchantment.php @@ -0,0 +1,158 @@ +id = (int) $id; + $this->name = (string) $name; + $this->rarity = (int) $rarity; + $this->activationType = (int) $activationType; + $this->slot = (int) $slot; + } + + public function getId(){ + return $this->id; + } + + public function getName(){ + return $this->name; + } + + public function getRarity(){ + return $this->rarity; + } + + public function getActivationType(){ + return $this->activationType; + } + + public function getSlot(){ + return $this->slot; + } + + public function hasSlot($slot){ + return ($this->slot & $slot) > 0; + } + + public function getLevel(){ + return $this->level; + } + + public function setLevel($level){ + $this->level = (int) $level; + } + +} \ No newline at end of file