PocketMine-MP 5.39.3 git-400eb2dddf91a9c112aa09f3b498ffc8c85e98ed
Loading...
Searching...
No Matches
ToolTier.php
1<?php
2
3/*
4 *
5 * ____ _ _ __ __ _ __ __ ____
6 * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
7 * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
8 * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
9 * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
10 *
11 * This program is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as published by
13 * the Free Software Foundation, either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * @author PocketMine Team
17 * @link http://www.pocketmine.net/
18 *
19 *
20 */
21
22declare(strict_types=1);
23
24namespace pocketmine\item;
25
26use pocketmine\utils\LegacyEnumShimTrait;
27
42 use LegacyEnumShimTrait;
43
44 case WOOD;
45 case GOLD;
46 case STONE;
47 case COPPER;
48 case IRON;
49 case DIAMOND;
50 case NETHERITE;
51
56 private static function meta(int $harvestLevel, int $maxDurability, int $baseAttackPoints, int $baseEfficiency, int $enchantability) : array{
57 return [$harvestLevel, $maxDurability, $baseAttackPoints, $baseEfficiency, $enchantability];
58 }
59
63 private function getMetadata() : array{
64 return match($this){
65 self::WOOD => self::meta(1, 60, 5, 2, 15),
66 self::GOLD => self::meta(2, 33, 5, 12, 22),
67 self::STONE => self::meta(3, 132, 6, 4, 5),
68 self::COPPER => self::meta(3, 191, 6, 5, 13),
69 self::IRON => self::meta(4, 251, 7, 6, 14),
70 self::DIAMOND => self::meta(5, 1562, 8, 8, 10),
71 self::NETHERITE => self::meta(6, 2032, 9, 9, 15)
72 };
73 }
74
75 public function getHarvestLevel() : int{
76 return $this->getMetadata()[0];
77 }
78
79 public function getMaxDurability() : int{
80 return $this->getMetadata()[1];
81 }
82
83 public function getBaseAttackPoints() : int{
84 return $this->getMetadata()[2];
85 }
86
87 public function getBaseEfficiency() : int{
88 return $this->getMetadata()[3];
89 }
90
97 public function getEnchantability() : int{
98 return $this->getMetadata()[4];
99 }