PocketMine-MP 5.21.2 git-a6534ecbbbcf369264567d27e5ed70f7f5be9816
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
30 case WOOD;
31 case GOLD;
32 case STONE;
33 case IRON;
34 case DIAMOND;
35 case NETHERITE;
36
41 private static function meta(int $harvestLevel, int $maxDurability, int $baseAttackPoints, int $baseEfficiency, int $enchantability) : array{
42 return [$harvestLevel, $maxDurability, $baseAttackPoints, $baseEfficiency, $enchantability];
43 }
44
48 private function getMetadata() : array{
49 return match($this){
50 self::WOOD => self::meta(1, 60, 5, 2, 15),
51 self::GOLD => self::meta(2, 33, 5, 12, 22),
52 self::STONE => self::meta(3, 132, 6, 4, 5),
53 self::IRON => self::meta(4, 251, 7, 6, 14),
54 self::DIAMOND => self::meta(5, 1562, 8, 8, 10),
55 self::NETHERITE => self::meta(6, 2032, 9, 9, 15)
56 };
57 }
58
59 public function getHarvestLevel() : int{
60 return $this->getMetadata()[0];
61 }
62
63 public function getMaxDurability() : int{
64 return $this->getMetadata()[1];
65 }
66
67 public function getBaseAttackPoints() : int{
68 return $this->getMetadata()[2];
69 }
70
71 public function getBaseEfficiency() : int{
72 return $this->getMetadata()[3];
73 }
74
81 public function getEnchantability() : int{
82 return $this->getMetadata()[4];
83 }