22declare(strict_types=1);
24namespace pocketmine\block\utils;
27use pocketmine\utils\LegacyEnumShimTrait;
28use
function spl_object_id;
54 use LegacyEnumShimTrait;
78 private static function meta(
string $displayName, Color $rgbValue) : array{
79 return [$displayName, $rgbValue];
85 private function getMetadata() : array{
89 return $cache[spl_object_id($this)] ??= match($this){
90 self::WHITE => self::meta(
"White",
new Color(0xf0, 0xf0, 0xf0)),
91 self::ORANGE => self::meta(
"Orange",
new Color(0xf9, 0x80, 0x1d)),
92 self::MAGENTA => self::meta(
"Magenta",
new Color(0xc7, 0x4e, 0xbd)),
93 self::LIGHT_BLUE => self::meta(
"Light Blue",
new Color(0x3a, 0xb3, 0xda)),
94 self::YELLOW => self::meta(
"Yellow",
new Color(0xfe, 0xd8, 0x3d)),
95 self::LIME => self::meta(
"Lime",
new Color(0x80, 0xc7, 0x1f)),
96 self::PINK => self::meta(
"Pink",
new Color(0xf3, 0x8b, 0xaa)),
97 self::GRAY => self::meta(
"Gray",
new Color(0x47, 0x4f, 0x52)),
98 self::LIGHT_GRAY => self::meta(
"Light Gray",
new Color(0x9d, 0x9d, 0x97)),
99 self::CYAN => self::meta(
"Cyan",
new Color(0x16, 0x9c, 0x9c)),
100 self::PURPLE => self::meta(
"Purple",
new Color(0x89, 0x32, 0xb8)),
101 self::BLUE => self::meta(
"Blue",
new Color(0x3c, 0x44, 0xaa)),
102 self::BROWN => self::meta(
"Brown",
new Color(0x83, 0x54, 0x32)),
103 self::GREEN => self::meta(
"Green",
new Color(0x5e, 0x7c, 0x16)),
104 self::RED => self::meta(
"Red",
new Color(0xb0, 0x2e, 0x26)),
105 self::BLACK => self::meta(
"Black",
new Color(0x1d, 0x1d, 0x21)),
109 public function getDisplayName() : string{
110 return $this->getMetadata()[0];
113 public function getRgbValue() : Color{
114 return $this->getMetadata()[1];