PocketMine-MP
5.21.2 git-09bf203267aca9b83a09640e17bfac0fc7b58ff8
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
22
declare(strict_types=1);
23
24
namespace
pocketmine\item
;
25
26
use pocketmine\utils\LegacyEnumShimTrait;
27
41
enum
ToolTier
{
42
use LegacyEnumShimTrait;
43
44
case
WOOD;
45
case
GOLD;
46
case
STONE;
47
case
IRON;
48
case
DIAMOND;
49
case
NETHERITE;
50
55
private
static
function
meta
(
int
$harvestLevel,
int
$maxDurability,
int
$baseAttackPoints,
int
$baseEfficiency,
int
$enchantability) : array{
56
return
[$harvestLevel, $maxDurability, $baseAttackPoints, $baseEfficiency, $enchantability];
57
}
58
62
private
function
getMetadata
() : array{
63
return
match($this){
64
self::WOOD =>
self::meta
(1, 60, 5, 2, 15),
65
self::GOLD =>
self::meta
(2, 33, 5, 12, 22),
66
self::STONE =>
self::meta
(3, 132, 6, 4, 5),
67
self::IRON =>
self::meta
(4, 251, 7, 6, 14),
68
self::DIAMOND =>
self::meta
(5, 1562, 8, 8, 10),
69
self::NETHERITE =>
self::meta
(6, 2032, 9, 9, 15)
70
};
71
}
72
73
public
function
getHarvestLevel() :
int
{
74
return
$this->
getMetadata
()[0];
75
}
76
77
public
function
getMaxDurability() :
int
{
78
return
$this->
getMetadata
()[1];
79
}
80
81
public
function
getBaseAttackPoints() :
int
{
82
return
$this->
getMetadata
()[2];
83
}
84
85
public
function
getBaseEfficiency() :
int
{
86
return
$this->
getMetadata
()[3];
87
}
88
95
public
function
getEnchantability() :
int
{
96
return
$this->
getMetadata
()[4];
97
}
98
}
pocketmine\item
Definition
Apple.php:24
pocketmine\item\ToolTier
ToolTier
Definition
ToolTier.php:41
pocketmine\item\meta
@ meta
Definition
ToolTier.php:55
pocketmine\item\getMetadata
@ getMetadata
Definition
MedicineType.php:50
src
item
ToolTier.php
Generated by
1.12.0