當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Item::getEnchantmentLevel方法代碼示例

本文整理匯總了PHP中pocketmine\item\Item::getEnchantmentLevel方法的典型用法代碼示例。如果您正苦於以下問題:PHP Item::getEnchantmentLevel方法的具體用法?PHP Item::getEnchantmentLevel怎麽用?PHP Item::getEnchantmentLevel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pocketmine\item\Item的用法示例。


在下文中一共展示了Item::getEnchantmentLevel方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getDrops

 public function getDrops(Item $item) : array
 {
     if ($item->getEnchantmentLevel(Enchantment::TYPE_MINING_SILK_TOUCH) > 0) {
         return [[Item::MELON_BLOCK, 0, 1]];
     } else {
         $fortunel = $item->getEnchantmentLevel(Enchantment::TYPE_MINING_FORTUNE);
         $fortunel = $fortunel > 2 ? 2 : $fortunel;
         //Note: for Melon level 2 is the same 3 So highest is 2
         return [[Item::MELON_SLICE, 0, mt_rand(3, 7 + $fortunel)]];
     }
 }
開發者ID:iTXTech,項目名稱:Genisys,代碼行數:11,代碼來源:Melon.php

示例2: getDrops

 public function getDrops(Item $item) : array
 {
     if ($item->isPickaxe() >= Tool::TIER_IRON) {
         if ($item->getEnchantmentLevel(Enchantment::TYPE_MINING_SILK_TOUCH) > 0) {
             return [[Item::REDSTONE_ORE, 0, 1]];
         } else {
             $fortuneL = $item->getEnchantmentLevel(Enchantment::TYPE_MINING_FORTUNE);
             $fortuneL = $fortuneL > 3 ? 3 : $fortuneL;
             return [[Item::REDSTONE_DUST, 0, mt_rand(4, 5 + $fortuneL)]];
         }
     } else {
         return [];
     }
 }
開發者ID:iTXTech,項目名稱:Genisys,代碼行數:14,代碼來源:RedstoneOre.php

示例3: getDrops

 public function getDrops(Item $item) : array
 {
     if ($item->getEnchantmentLevel(Enchantment::TYPE_MINING_SILK_TOUCH) > 0) {
         return [[Item::GLOWSTONE_BLOCK, 0, 1]];
     } else {
         $fortunel = $item->getEnchantmentLevel(Enchantment::TYPE_MINING_FORTUNE);
         $fortunel = $fortunel > 3 ? 3 : $fortunel;
         $times = [1, 1, 2, 3, 4];
         $time = $times[mt_rand(0, $fortunel + 1)];
         $num = mt_rand(2, 4) * $time;
         $num = $num > 4 ? 4 : $num;
         return [[Item::GLOWSTONE_DUST, 0, $num]];
     }
 }
開發者ID:AnonymousProjects,項目名稱:PocketMine-MP-Original,代碼行數:14,代碼來源:Glowstone.php

示例4: getDrops

 public function getDrops(Item $item) : array
 {
     if ($item->isPickaxe() >= 4) {
         if ($item->getEnchantmentLevel(Enchantment::TYPE_MINING_SILK_TOUCH) > 0) {
             return [[Item::DIAMOND_ORE, 0, 1]];
         } else {
             $fortunel = $item->getEnchantmentLevel(Enchantment::TYPE_MINING_FORTUNE);
             $fortunel = $fortunel > 3 ? 3 : $fortunel;
             $times = [1, 1, 2, 3, 4];
             $time = $times[mt_rand(0, $fortunel + 1)];
             return [[Item::DIAMOND, 0, $time]];
         }
     } else {
         return [];
     }
 }
開發者ID:iTXTech,項目名稱:Genisys,代碼行數:16,代碼來源:DiamondOre.php

示例5: getDrops

 public function getDrops(Item $item) : array
 {
     $drops = [];
     if ($item->isShears() or $item->getEnchantmentLevel(Enchantment::TYPE_MINING_SILK_TOUCH) > 0) {
         $drops[] = [$this->id, $this->meta & 0x1, 1];
     } else {
         $fortunel = $item->getEnchantmentLevel(Enchantment::TYPE_MINING_FORTUNE);
         $fortunel = min(3, $fortunel);
         $rates = [20, 16, 12, 10];
         if (mt_rand(1, $rates[$fortunel]) === 1) {
             //Saplings
             $drops[] = [Item::SAPLING, $this->meta & 0x1 | 0x4, 1];
         }
     }
     return $drops;
 }
開發者ID:iTXTech,項目名稱:Genisys,代碼行數:16,代碼來源:Leaves2.php

示例6: getDrops

 public function getDrops(Item $item) : array
 {
     if ($item->getEnchantmentLevel(Enchantment::TYPE_MINING_SILK_TOUCH) > 0) {
         return [[Item::BROWN_MUSHROOM_BLOCK, SELF::BROWN, 1]];
     } else {
         return [[Item::BROWN_MUSHROOM, 0, mt_rand(0, 2)]];
     }
 }
開發者ID:yungtechboy1,項目名稱:Genisys,代碼行數:8,代碼來源:BrownMushroomBlock.php

示例7: getDrops

 public function getDrops(Item $item) : array
 {
     if ($item->getEnchantmentLevel(Enchantment::TYPE_MINING_SILK_TOUCH) > 0) {
         return [[Item::ICE, 0, 1]];
     } else {
         return [];
     }
 }
開發者ID:iTXTech,項目名稱:Genisys,代碼行數:8,代碼來源:Ice.php

示例8: getDrops

 public function getDrops(Item $item) : array
 {
     if ($item->isPickaxe() >= Tool::TIER_WOODEN) {
         if ($item->getEnchantmentLevel(Enchantment::TYPE_MINING_SILK_TOUCH) > 0 and $this->getDamage() === 0) {
             return [[Item::STONE, 0, 1]];
         }
         return [[$this->getDamage() === 0 ? Item::COBBLESTONE : Item::STONE, $this->getDamage(), 1]];
     } else {
         return [];
     }
 }
開發者ID:iTXTech,項目名稱:Genisys,代碼行數:11,代碼來源:Stone.php

示例9: getDrops

 public function getDrops(Item $item) : array
 {
     $drops = [];
     if ($item->getEnchantmentLevel(Enchantment::TYPE_MINING_SILK_TOUCH) > 0) {
         //使用精準采集附魔 不掉落燧石
         $drops[] = [Item::GRAVEL, 0, 1];
         return $drops;
     }
     $fortunel = $item->getEnchantmentLevel(Enchantment::TYPE_MINING_FORTUNE);
     $fortunel = $fortunel > 3 ? 3 : $fortunel;
     $rates = [10, 7, 4, 1];
     if (mt_rand(1, $rates[$fortunel]) === 1) {
         //10% 14% 25% 100%
         $drops[] = [Item::FLINT, 0, 1];
     }
     if (mt_rand(1, 10) !== 1) {
         //90%
         $drops[] = [Item::GRAVEL, 0, 1];
     }
     return $drops;
 }
開發者ID:iTXTech,項目名稱:Genisys,代碼行數:21,代碼來源:Gravel.php

示例10: getDrops

 public function getDrops(Item $item) : array
 {
     if ($item->isShovel() !== false) {
         if ($item->getEnchantmentLevel(Enchantment::TYPE_MINING_SILK_TOUCH) > 0) {
             return [[Item::SNOW_BLOCK, 0, 1]];
         } else {
             return [[Item::SNOWBALL, 0, 4]];
         }
     } else {
         return [];
     }
 }
開發者ID:iTXTech,項目名稱:Genisys,代碼行數:12,代碼來源:Snow.php

示例11: getDrops

 public function getDrops(Item $item) : array
 {
     $drops = [];
     if ($this->meta >= 0x7) {
         $fortunel = $item->getEnchantmentLevel(Enchantment::TYPE_MINING_FORTUNE);
         $fortunel = $fortunel > 3 ? 3 : $fortunel;
         $drops[] = [Item::CARROT, 0, mt_rand(1, 4 + $fortunel)];
     } else {
         $drops[] = [Item::CARROT, 0, 1];
     }
     return $drops;
 }
開發者ID:iTXTech,項目名稱:Genisys,代碼行數:12,代碼來源:Carrot.php

示例12: getDrops

 public function getDrops(Item $item) : array
 {
     if ($item->isShears()) {
         return [[Item::COBWEB, 0, 1]];
     } elseif ($item->isSword() >= Tool::TIER_WOODEN) {
         if ($item->getEnchantmentLevel(Enchantment::TYPE_MINING_SILK_TOUCH) > 0) {
             return [[Item::COBWEB, 0, 1]];
         } else {
             return [[Item::STRING, 0, 1]];
         }
     }
     return [];
 }
開發者ID:iTXTech,項目名稱:Genisys,代碼行數:13,代碼來源:Cobweb.php

示例13: getDrops

 public function getDrops(Item $item) : array
 {
     $drops = [];
     if ($item->isShears() or $item->getEnchantmentLevel(Enchantment::TYPE_MINING_SILK_TOUCH) > 0) {
         $drops[] = [Item::LEAVES, $this->meta & 0x3, 1];
     } else {
         $fortunel = $item->getEnchantmentLevel(Enchantment::TYPE_MINING_FORTUNE);
         $fortunel = $fortunel > 3 ? 3 : $fortunel;
         $rates = [20, 16, 12, 10];
         if (mt_rand(1, $rates[$fortunel]) === 1) {
             //Saplings
             $drops[] = [Item::SAPLING, $this->meta & 0x3, 1];
         }
         $rates = [200, 180, 160, 120];
         if (($this->meta & 0x3) === self::OAK and mt_rand(1, $rates[$fortunel]) === 1) {
             //Apples
             $drops[] = [Item::APPLE, 0, 1];
         }
     }
     return $drops;
 }
開發者ID:yungtechboy1,項目名稱:Genisys,代碼行數:21,代碼來源:Leaves.php


注:本文中的pocketmine\item\Item::getEnchantmentLevel方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。