PocketMine-MP 5.21.2 git-a6534ecbbbcf369264567d27e5ed70f7f5be9816
Loading...
Searching...
No Matches
PaintingMotive.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\entity\object;
25
27 private static bool $initialized = false;
28
30 protected static array $motives = [];
31
32 public static function init() : void{
33 self::$initialized = true;
34 foreach([
35 new PaintingMotive(1, 1, "Alban"),
36 new PaintingMotive(1, 1, "Aztec"),
37 new PaintingMotive(1, 1, "Aztec2"),
38 new PaintingMotive(1, 1, "Bomb"),
39 new PaintingMotive(1, 1, "Kebab"),
40 new PaintingMotive(1, 1, "meditative"),
41 new PaintingMotive(1, 1, "Plant"),
42 new PaintingMotive(1, 1, "Wasteland"),
43 new PaintingMotive(1, 2, "Graham"),
44 new PaintingMotive(1, 2, "prairie_ride"),
45 new PaintingMotive(1, 2, "Wanderer"),
46 new PaintingMotive(2, 1, "Courbet"),
47 new PaintingMotive(2, 1, "Creebet"),
48 new PaintingMotive(2, 1, "Pool"),
49 new PaintingMotive(2, 1, "Sea"),
50 new PaintingMotive(2, 1, "Sunset"),
51 new PaintingMotive(2, 2, "Bust"),
52 new PaintingMotive(2, 2, "baroque"),
53 new PaintingMotive(2, 2, "Earth"),
54 new PaintingMotive(2, 2, "Fire"),
55 new PaintingMotive(2, 2, "humble"),
56 new PaintingMotive(2, 2, "Match"),
57 new PaintingMotive(2, 2, "SkullAndRoses"),
58 new PaintingMotive(2, 2, "Stage"),
59 new PaintingMotive(2, 2, "Void"),
60 new PaintingMotive(2, 2, "Water"),
61 new PaintingMotive(2, 2, "Wind"),
62 new PaintingMotive(2, 2, "Wither"),
63 new PaintingMotive(3, 3, "bouquet"),
64 new PaintingMotive(3, 3, "cavebird"),
65 new PaintingMotive(3, 3, "cotan"),
66 new PaintingMotive(3, 3, "endboss"),
67 new PaintingMotive(3, 3, "fern"),
68 new PaintingMotive(3, 3, "owlemons"),
69 new PaintingMotive(3, 3, "sunflowers"),
70 new PaintingMotive(3, 3, "tides"),
71 new PaintingMotive(3, 4, "backyard"),
72 new PaintingMotive(3, 4, "pond"),
73 new PaintingMotive(4, 2, "changing"),
74 new PaintingMotive(4, 2, "Fighters"),
75 new PaintingMotive(4, 2, "finding"),
76 new PaintingMotive(4, 2, "lowmist"),
77 new PaintingMotive(4, 2, "passage"),
78 new PaintingMotive(4, 3, "DonkeyKong"),
79 new PaintingMotive(4, 3, "Skeleton"),
80 new PaintingMotive(4, 4, "BurningSkull"),
81 new PaintingMotive(4, 4, "orb"),
82 new PaintingMotive(4, 4, "Pigscene"),
83 new PaintingMotive(4, 4, "Pointer"),
84 new PaintingMotive(4, 4, "unpacked")
85 ] as $motive){
86 self::registerMotive($motive);
87 }
88 }
89
90 public static function registerMotive(PaintingMotive $motive) : void{
91 if(!self::$initialized){
92 self::init();
93 }
94 self::$motives[$motive->getName()] = $motive;
95 }
96
97 public static function getMotiveByName(string $name) : ?PaintingMotive{
98 if(!self::$initialized){
99 self::init();
100 }
101 return self::$motives[$name] ?? null;
102 }
103
107 public static function getAll() : array{
108 if(!self::$initialized){
109 self::init();
110 }
111 return self::$motives;
112 }
113
114 public function __construct(
115 protected int $width,
116 protected int $height,
117 protected string $name
118 ){}
119
120 public function getName() : string{
121 return $this->name;
122 }
123
124 public function getWidth() : int{
125 return $this->width;
126 }
127
128 public function getHeight() : int{
129 return $this->height;
130 }
131
132 public function __toString() : string{
133 return "PaintingMotive(name: " . $this->getName() . ", height: " . $this->getHeight() . ", width: " . $this->getWidth() . ")";
134 }
135}