From 5b16046f77af7407771d136aae77979937324865 Mon Sep 17 00:00:00 2001 From: GameHerobrine Date: Thu, 2 Jun 2022 11:34:25 +0300 Subject: [PATCH] armor fix x2(forgot to upload item files --- src/material/Item.php | 82 ++++++++++++++++++- src/material/item/armor/ChainBoots.php | 2 +- src/material/item/armor/ChainChestplate.php | 2 +- src/material/item/armor/ChainHelmet.php | 2 +- src/material/item/armor/ChainLeggings.php | 2 +- src/material/item/armor/DiamondBoots.php | 2 +- src/material/item/armor/DiamondChestplate.php | 2 +- src/material/item/armor/DiamondHelmet.php | 2 +- src/material/item/armor/DiamondLeggings.php | 2 +- src/material/item/armor/GoldenBoots.php | 2 +- src/material/item/armor/GoldenChestplate.php | 2 +- src/material/item/armor/GoldenHelmet.php | 2 +- src/material/item/armor/GoldenLeggings.php | 2 +- src/material/item/armor/IronBoots.php | 2 +- src/material/item/armor/IronChestplate.php | 2 +- src/material/item/armor/IronHelmet.php | 2 +- src/material/item/armor/IronLeggings.php | 2 +- src/material/item/armor/LeatherBoots.php | 2 +- src/material/item/armor/LeatherCap.php | 2 +- src/material/item/armor/LeatherPants.php | 2 +- src/material/item/armor/LeatherTunic.php | 2 +- 21 files changed, 101 insertions(+), 21 deletions(-) diff --git a/src/material/Item.php b/src/material/Item.php index 85d8f183..f5f4f375 100755 --- a/src/material/Item.php +++ b/src/material/Item.php @@ -239,6 +239,36 @@ class Item{ } final public function getMaxDurability(){ + $isArmor = $this->isArmor(); + if($isArmor !== false){ + $armorDurability = [ + 10 => 56, + 11 => 81, + 12 => 76, + 13 => 66, + + 20 => 166, + 21 => 241, + 22 => 226, + 23 => 196, + + 30 => 166, + 31 => 241, + 32 => 226, + 33 => 196, + + 40 => 364, + 41 => 529, + 42 => 496, + 43 => 430, + + 50 => 78, + 51 => 113, + 52 => 106, + 53 => 92, + ]; + return $armorDurability[$isArmor]; + } if(!$this->isTool() and $this->isHoe() === false and $this->id !== BOW){ return false; } @@ -267,7 +297,57 @@ class Item{ } return $levels[$type]; } - + final public function isArmor(){ + switch($this->id){ + case LEATHER_CAP: + return 10; + case LEATHER_TUNIC: + return 11; + case LEATHER_PANTS: + return 12; + case LEATHER_BOOTS: + return 13; + + case CHAIN_HELMET: + return 20; + case CHAIN_CHESTPLATE: + return 21; + case CHAIN_LEGGINGS: + return 22; + case CHAIN_BOOTS: + return 23; + + case IRON_HELMET: + return 30; + case IRON_CHESTPLATE: + return 31; + case IRON_LEGGINGS: + return 32; + case IRON_BOOTS: + return 33; + + case DIAMOND_HELMET: + return 40; + case DIAMOND_CHESTPLATE: + return 41; + case DIAMOND_LEGGINGS: + return 42; + case DIAMOND_BOOTS: + return 43; + + case GOLD_HELMET: + return 50; + case GOLD_CHESTPLATE: + return 51; + case GOLD_LEGGINGS: + return 52; + case GOLD_BOOTS: + return 53; + default: + return false; + } + + } final public function isPickaxe(){ //Returns false or level of the pickaxe switch($this->id){ case IRON_PICKAXE: diff --git a/src/material/item/armor/ChainBoots.php b/src/material/item/armor/ChainBoots.php index 3277c8c2..9e83ca50 100644 --- a/src/material/item/armor/ChainBoots.php +++ b/src/material/item/armor/ChainBoots.php @@ -21,7 +21,7 @@ class ChainBootsItem extends Item{ public function __construct($meta = 0, $count = 1){ - parent::__construct(CHAIN_BOOTS, 0, $count, "Chain Boots"); + parent::__construct(CHAIN_BOOTS, $meta, $count, "Chain Boots"); } } \ No newline at end of file diff --git a/src/material/item/armor/ChainChestplate.php b/src/material/item/armor/ChainChestplate.php index 8289b425..2ce24cbf 100644 --- a/src/material/item/armor/ChainChestplate.php +++ b/src/material/item/armor/ChainChestplate.php @@ -21,7 +21,7 @@ class ChainChestplateItem extends Item{ public function __construct($meta = 0, $count = 1){ - parent::__construct(CHAIN_CHESTPLATE, 0, $count, "Chain Chestplate"); + parent::__construct(CHAIN_CHESTPLATE, $meta, $count, "Chain Chestplate"); } } \ No newline at end of file diff --git a/src/material/item/armor/ChainHelmet.php b/src/material/item/armor/ChainHelmet.php index 68d7ffae..57965ec8 100644 --- a/src/material/item/armor/ChainHelmet.php +++ b/src/material/item/armor/ChainHelmet.php @@ -21,7 +21,7 @@ class ChainHelmetItem extends Item{ public function __construct($meta = 0, $count = 1){ - parent::__construct(CHAIN_HELMET, 0, $count, "Chain Helmet"); + parent::__construct(CHAIN_HELMET, $meta, $count, "Chain Helmet"); } } \ No newline at end of file diff --git a/src/material/item/armor/ChainLeggings.php b/src/material/item/armor/ChainLeggings.php index fa98cbc0..67764c22 100644 --- a/src/material/item/armor/ChainLeggings.php +++ b/src/material/item/armor/ChainLeggings.php @@ -21,7 +21,7 @@ class ChainLeggingsItem extends Item{ public function __construct($meta = 0, $count = 1){ - parent::__construct(CHAIN_LEGGINGS, 0, $count, "Chain Leggings"); + parent::__construct(CHAIN_LEGGINGS, $meta, $count, "Chain Leggings"); } } \ No newline at end of file diff --git a/src/material/item/armor/DiamondBoots.php b/src/material/item/armor/DiamondBoots.php index 5c1490a6..cdaec0d4 100644 --- a/src/material/item/armor/DiamondBoots.php +++ b/src/material/item/armor/DiamondBoots.php @@ -21,7 +21,7 @@ class DiamondBootsItem extends Item{ public function __construct($meta = 0, $count = 1){ - parent::__construct(DIAMOND_BOOTS, 0, $count, "Diamond Boots"); + parent::__construct(DIAMOND_BOOTS, $meta, $count, "Diamond Boots"); } } \ No newline at end of file diff --git a/src/material/item/armor/DiamondChestplate.php b/src/material/item/armor/DiamondChestplate.php index bf7cbb2c..172e8837 100644 --- a/src/material/item/armor/DiamondChestplate.php +++ b/src/material/item/armor/DiamondChestplate.php @@ -21,7 +21,7 @@ class DiamondChestplateItem extends Item{ public function __construct($meta = 0, $count = 1){ - parent::__construct(DIAMOND_CHESTPLATE, 0, $count, "Diamond Chestplate"); + parent::__construct(DIAMOND_CHESTPLATE, $meta, $count, "Diamond Chestplate"); } } \ No newline at end of file diff --git a/src/material/item/armor/DiamondHelmet.php b/src/material/item/armor/DiamondHelmet.php index c81ecd8b..b4db93c0 100644 --- a/src/material/item/armor/DiamondHelmet.php +++ b/src/material/item/armor/DiamondHelmet.php @@ -21,7 +21,7 @@ class DiamondHelmetItem extends Item{ public function __construct($meta = 0, $count = 1){ - parent::__construct(DIAMOND_HELMET, 0, $count, "Diamond Helmet"); + parent::__construct(DIAMOND_HELMET, $meta, $count, "Diamond Helmet"); } } \ No newline at end of file diff --git a/src/material/item/armor/DiamondLeggings.php b/src/material/item/armor/DiamondLeggings.php index 77b5117c..cb23a3ce 100644 --- a/src/material/item/armor/DiamondLeggings.php +++ b/src/material/item/armor/DiamondLeggings.php @@ -21,7 +21,7 @@ class DiamondLeggingsItem extends Item{ public function __construct($meta = 0, $count = 1){ - parent::__construct(DIAMOND_LEGGINGS, 0, $count, "Diamond Leggings"); + parent::__construct(DIAMOND_LEGGINGS, $meta, $count, "Diamond Leggings"); } } \ No newline at end of file diff --git a/src/material/item/armor/GoldenBoots.php b/src/material/item/armor/GoldenBoots.php index 1ea1c622..365b846d 100644 --- a/src/material/item/armor/GoldenBoots.php +++ b/src/material/item/armor/GoldenBoots.php @@ -21,7 +21,7 @@ class GoldenBootsItem extends Item{ public function __construct($meta = 0, $count = 1){ - parent::__construct(GOLDEN_BOOTS, 0, $count, "Golden Boots"); + parent::__construct(GOLDEN_BOOTS, $meta, $count, "Golden Boots"); } } \ No newline at end of file diff --git a/src/material/item/armor/GoldenChestplate.php b/src/material/item/armor/GoldenChestplate.php index 7fb819ca..43d68821 100644 --- a/src/material/item/armor/GoldenChestplate.php +++ b/src/material/item/armor/GoldenChestplate.php @@ -21,7 +21,7 @@ class GoldenChestplateItem extends Item{ public function __construct($meta = 0, $count = 1){ - parent::__construct(GOLDEN_CHESTPLATE, 0, $count, "Golden Chestplate"); + parent::__construct(GOLDEN_CHESTPLATE, $meta, $count, "Golden Chestplate"); } } \ No newline at end of file diff --git a/src/material/item/armor/GoldenHelmet.php b/src/material/item/armor/GoldenHelmet.php index cf974947..97384a7f 100644 --- a/src/material/item/armor/GoldenHelmet.php +++ b/src/material/item/armor/GoldenHelmet.php @@ -21,7 +21,7 @@ class GoldenHelmetItem extends Item{ public function __construct($meta = 0, $count = 1){ - parent::__construct(GOLDEN_HELMET, 0, $count, "Golden Helmet"); + parent::__construct(GOLDEN_HELMET, $meta, $count, "Golden Helmet"); } } \ No newline at end of file diff --git a/src/material/item/armor/GoldenLeggings.php b/src/material/item/armor/GoldenLeggings.php index 8db5f386..53c1e171 100644 --- a/src/material/item/armor/GoldenLeggings.php +++ b/src/material/item/armor/GoldenLeggings.php @@ -21,7 +21,7 @@ class GoldenLeggingsItem extends Item{ public function __construct($meta = 0, $count = 1){ - parent::__construct(GOLDEN_LEGGINGS, 0, $count, "Golden Leggings"); + parent::__construct(GOLDEN_LEGGINGS, $meta, $count, "Golden Leggings"); } } \ No newline at end of file diff --git a/src/material/item/armor/IronBoots.php b/src/material/item/armor/IronBoots.php index 8bd9a32d..70c8cdc7 100644 --- a/src/material/item/armor/IronBoots.php +++ b/src/material/item/armor/IronBoots.php @@ -21,7 +21,7 @@ class IronBootsItem extends Item{ public function __construct($meta = 0, $count = 1){ - parent::__construct(IRON_BOOTS, 0, $count, "Iron Boots"); + parent::__construct(IRON_BOOTS, $meta, $count, "Iron Boots"); } } \ No newline at end of file diff --git a/src/material/item/armor/IronChestplate.php b/src/material/item/armor/IronChestplate.php index d97c3cdc..72afcbd6 100644 --- a/src/material/item/armor/IronChestplate.php +++ b/src/material/item/armor/IronChestplate.php @@ -21,7 +21,7 @@ class IronChestplateItem extends Item{ public function __construct($meta = 0, $count = 1){ - parent::__construct(IRON_CHESTPLATE, 0, $count, "Iron Chestplate"); + parent::__construct(IRON_CHESTPLATE, $meta, $count, "Iron Chestplate"); } } \ No newline at end of file diff --git a/src/material/item/armor/IronHelmet.php b/src/material/item/armor/IronHelmet.php index 0142835c..6ffd2201 100644 --- a/src/material/item/armor/IronHelmet.php +++ b/src/material/item/armor/IronHelmet.php @@ -21,7 +21,7 @@ class IronHelmetItem extends Item{ public function __construct($meta = 0, $count = 1){ - parent::__construct(IRON_HELMET, 0, $count, "Iron Helmet"); + parent::__construct(IRON_HELMET, $meta, $count, "Iron Helmet"); } } \ No newline at end of file diff --git a/src/material/item/armor/IronLeggings.php b/src/material/item/armor/IronLeggings.php index 220856d1..fdd265e0 100644 --- a/src/material/item/armor/IronLeggings.php +++ b/src/material/item/armor/IronLeggings.php @@ -21,7 +21,7 @@ class IronLeggingsItem extends Item{ public function __construct($meta = 0, $count = 1){ - parent::__construct(IRON_LEGGINGS, 0, $count, "Iron Leggings"); + parent::__construct(IRON_LEGGINGS, $meta, $count, "Iron Leggings"); } } \ No newline at end of file diff --git a/src/material/item/armor/LeatherBoots.php b/src/material/item/armor/LeatherBoots.php index 2446d724..1710df2d 100644 --- a/src/material/item/armor/LeatherBoots.php +++ b/src/material/item/armor/LeatherBoots.php @@ -21,7 +21,7 @@ class LeatherBootsItem extends Item{ public function __construct($meta = 0, $count = 1){ - parent::__construct(LEATHER_BOOTS, 0, $count, "Leather Boots"); + parent::__construct(LEATHER_BOOTS, $meta, $count, "Leather Boots"); } } \ No newline at end of file diff --git a/src/material/item/armor/LeatherCap.php b/src/material/item/armor/LeatherCap.php index 011035bd..bb5f0200 100755 --- a/src/material/item/armor/LeatherCap.php +++ b/src/material/item/armor/LeatherCap.php @@ -21,7 +21,7 @@ class LeatherCapItem extends Item{ public function __construct($meta = 0, $count = 1){ - parent::__construct(LEATHER_CAP, 0, $count, "Leather Cap"); + parent::__construct(LEATHER_CAP, $meta, $count, "Leather Cap"); } } \ No newline at end of file diff --git a/src/material/item/armor/LeatherPants.php b/src/material/item/armor/LeatherPants.php index 07d17cb8..248569ca 100644 --- a/src/material/item/armor/LeatherPants.php +++ b/src/material/item/armor/LeatherPants.php @@ -21,7 +21,7 @@ class LeatherPantsItem extends Item{ public function __construct($meta = 0, $count = 1){ - parent::__construct(LEATHER_PANTS, 0, $count, "Leather Pants"); + parent::__construct(LEATHER_PANTS, $meta, $count, "Leather Pants"); } } \ No newline at end of file diff --git a/src/material/item/armor/LeatherTunic.php b/src/material/item/armor/LeatherTunic.php index 54998592..93ccba62 100644 --- a/src/material/item/armor/LeatherTunic.php +++ b/src/material/item/armor/LeatherTunic.php @@ -21,7 +21,7 @@ class LeatherTunicItem extends Item{ public function __construct($meta = 0, $count = 1){ - parent::__construct(LEATHER_TUNIC, 0, $count, "Leather Tunic"); + parent::__construct(LEATHER_TUNIC, $meta, $count, "Leather Tunic"); } } \ No newline at end of file