22declare(strict_types=1);
24namespace pocketmine\block\utils;
27use
function spl_object_id;
55 private static function meta(
string $displayName, Color $rgbValue) : array{
56 return [$displayName, $rgbValue];
62 private function getMetadata() : array{
66 return $cache[spl_object_id($this)] ??= match($this){
67 self::WHITE => self::meta(
"White",
new Color(0xf0, 0xf0, 0xf0)),
68 self::ORANGE => self::meta(
"Orange",
new Color(0xf9, 0x80, 0x1d)),
69 self::MAGENTA => self::meta(
"Magenta",
new Color(0xc7, 0x4e, 0xbd)),
70 self::LIGHT_BLUE => self::meta(
"Light Blue",
new Color(0x3a, 0xb3, 0xda)),
71 self::YELLOW => self::meta(
"Yellow",
new Color(0xfe, 0xd8, 0x3d)),
72 self::LIME => self::meta(
"Lime",
new Color(0x80, 0xc7, 0x1f)),
73 self::PINK => self::meta(
"Pink",
new Color(0xf3, 0x8b, 0xaa)),
74 self::GRAY => self::meta(
"Gray",
new Color(0x47, 0x4f, 0x52)),
75 self::LIGHT_GRAY => self::meta(
"Light Gray",
new Color(0x9d, 0x9d, 0x97)),
76 self::CYAN => self::meta(
"Cyan",
new Color(0x16, 0x9c, 0x9c)),
77 self::PURPLE => self::meta(
"Purple",
new Color(0x89, 0x32, 0xb8)),
78 self::BLUE => self::meta(
"Blue",
new Color(0x3c, 0x44, 0xaa)),
79 self::BROWN => self::meta(
"Brown",
new Color(0x83, 0x54, 0x32)),
80 self::GREEN => self::meta(
"Green",
new Color(0x5e, 0x7c, 0x16)),
81 self::RED => self::meta(
"Red",
new Color(0xb0, 0x2e, 0x26)),
82 self::BLACK => self::meta(
"Black",
new Color(0x1d, 0x1d, 0x21)),
86 public function getDisplayName() : string{
87 return $this->getMetadata()[0];
90 public function getRgbValue() : Color{
91 return $this->getMetadata()[1];