PocketMine-MP 5.21.2 git-b2aa6396c3cc2cafdd815eacc360e1ad89599899
Loading...
Searching...
No Matches
WoodLikeBlockIdHelper.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\block;
25
28use pocketmine\block\tile\Sign as TileSign;
29use pocketmine\block\utils\LeavesType;
30use pocketmine\block\utils\SaplingType;
31use pocketmine\block\utils\WoodType;
33
48
49 public static function getPlanksIdentifier(WoodType $type) : BID{
50 return new BID(match($type){
51 WoodType::OAK => Ids::OAK_PLANKS,
52 WoodType::SPRUCE => Ids::SPRUCE_PLANKS,
53 WoodType::BIRCH => Ids::BIRCH_PLANKS,
54 WoodType::JUNGLE => Ids::JUNGLE_PLANKS,
55 WoodType::ACACIA => Ids::ACACIA_PLANKS,
56 WoodType::DARK_OAK => Ids::DARK_OAK_PLANKS,
57 WoodType::MANGROVE => Ids::MANGROVE_PLANKS,
58 WoodType::CRIMSON => Ids::CRIMSON_PLANKS,
59 WoodType::WARPED => Ids::WARPED_PLANKS,
60 WoodType::CHERRY => Ids::CHERRY_PLANKS,
61 });
62 }
63
64 public static function getFenceIdentifier(WoodType $type) : BID{
65 return new BID(match($type){
66 WoodType::OAK => Ids::OAK_FENCE,
67 WoodType::SPRUCE => Ids::SPRUCE_FENCE,
68 WoodType::BIRCH => Ids::BIRCH_FENCE,
69 WoodType::JUNGLE => Ids::JUNGLE_FENCE,
70 WoodType::ACACIA => Ids::ACACIA_FENCE,
71 WoodType::DARK_OAK => Ids::DARK_OAK_FENCE,
72 WoodType::MANGROVE => Ids::MANGROVE_FENCE,
73 WoodType::CRIMSON => Ids::CRIMSON_FENCE,
74 WoodType::WARPED => Ids::WARPED_FENCE,
75 WoodType::CHERRY => Ids::CHERRY_FENCE,
76 });
77 }
78
79 public static function getSlabIdentifier(WoodType $type) : BID{
80 return new BID(match($type){
81 WoodType::OAK => Ids::OAK_SLAB,
82 WoodType::SPRUCE => Ids::SPRUCE_SLAB,
83 WoodType::BIRCH => Ids::BIRCH_SLAB,
84 WoodType::JUNGLE => Ids::JUNGLE_SLAB,
85 WoodType::ACACIA => Ids::ACACIA_SLAB,
86 WoodType::DARK_OAK => Ids::DARK_OAK_SLAB,
87 WoodType::MANGROVE => Ids::MANGROVE_SLAB,
88 WoodType::CRIMSON => Ids::CRIMSON_SLAB,
89 WoodType::WARPED => Ids::WARPED_SLAB,
90 WoodType::CHERRY => Ids::CHERRY_SLAB,
91 });
92 }
93
94 public static function getLogIdentifier(WoodType $treeType) : BID{
95 return new BID(match($treeType){
96 WoodType::OAK => Ids::OAK_LOG,
97 WoodType::SPRUCE => Ids::SPRUCE_LOG,
98 WoodType::BIRCH => Ids::BIRCH_LOG,
99 WoodType::JUNGLE => Ids::JUNGLE_LOG,
100 WoodType::ACACIA => Ids::ACACIA_LOG,
101 WoodType::DARK_OAK => Ids::DARK_OAK_LOG,
102 WoodType::MANGROVE => Ids::MANGROVE_LOG,
103 WoodType::CRIMSON => Ids::CRIMSON_STEM,
104 WoodType::WARPED => Ids::WARPED_STEM,
105 WoodType::CHERRY => Ids::CHERRY_LOG,
106 });
107 }
108
109 public static function getAllSidedLogIdentifier(WoodType $treeType) : BID{
110 return new BID(match($treeType){
111 WoodType::OAK => Ids::OAK_WOOD,
112 WoodType::SPRUCE => Ids::SPRUCE_WOOD,
113 WoodType::BIRCH => Ids::BIRCH_WOOD,
114 WoodType::JUNGLE => Ids::JUNGLE_WOOD,
115 WoodType::ACACIA => Ids::ACACIA_WOOD,
116 WoodType::DARK_OAK => Ids::DARK_OAK_WOOD,
117 WoodType::MANGROVE => Ids::MANGROVE_WOOD,
118 WoodType::CRIMSON => Ids::CRIMSON_HYPHAE,
119 WoodType::WARPED => Ids::WARPED_HYPHAE,
120 WoodType::CHERRY => Ids::CHERRY_WOOD,
121 });
122 }
123
124 public static function getLeavesIdentifier(LeavesType $leavesType) : BID{
125 return new BID(match($leavesType){
126 LeavesType::OAK => Ids::OAK_LEAVES,
127 LeavesType::SPRUCE => Ids::SPRUCE_LEAVES,
128 LeavesType::BIRCH => Ids::BIRCH_LEAVES,
129 LeavesType::JUNGLE => Ids::JUNGLE_LEAVES,
130 LeavesType::ACACIA => Ids::ACACIA_LEAVES,
131 LeavesType::DARK_OAK => Ids::DARK_OAK_LEAVES,
132 LeavesType::MANGROVE => Ids::MANGROVE_LEAVES,
133 LeavesType::AZALEA => Ids::AZALEA_LEAVES,
134 LeavesType::FLOWERING_AZALEA => Ids::FLOWERING_AZALEA_LEAVES,
135 LeavesType::CHERRY => Ids::CHERRY_LEAVES,
136 });
137 }
138
139 public static function getSaplingIdentifier(SaplingType $treeType) : BID{
140 return new BID(match($treeType){
141 SaplingType::OAK => Ids::OAK_SAPLING,
142 SaplingType::SPRUCE => Ids::SPRUCE_SAPLING,
143 SaplingType::BIRCH => Ids::BIRCH_SAPLING,
144 SaplingType::JUNGLE => Ids::JUNGLE_SAPLING,
145 SaplingType::ACACIA => Ids::ACACIA_SAPLING,
146 SaplingType::DARK_OAK => Ids::DARK_OAK_SAPLING,
147 });
148 }
149
154 public static function getSignInfo(WoodType $treeType) : array{
155 $make = fn(int $floorId, int $wallId, \Closure $getItem) => [
156 new BID($floorId, TileSign::class),
157 new BID($wallId, TileSign::class),
158 $getItem
159 ];
160 return match($treeType){
161 WoodType::OAK => $make(Ids::OAK_SIGN, Ids::OAK_WALL_SIGN, fn() => VanillaItems::OAK_SIGN()),
162 WoodType::SPRUCE => $make(Ids::SPRUCE_SIGN, Ids::SPRUCE_WALL_SIGN, fn() => VanillaItems::SPRUCE_SIGN()),
163 WoodType::BIRCH => $make(Ids::BIRCH_SIGN, Ids::BIRCH_WALL_SIGN, fn() => VanillaItems::BIRCH_SIGN()),
164 WoodType::JUNGLE => $make(Ids::JUNGLE_SIGN, Ids::JUNGLE_WALL_SIGN, fn() => VanillaItems::JUNGLE_SIGN()),
165 WoodType::ACACIA => $make(Ids::ACACIA_SIGN, Ids::ACACIA_WALL_SIGN, fn() => VanillaItems::ACACIA_SIGN()),
166 WoodType::DARK_OAK => $make(Ids::DARK_OAK_SIGN, Ids::DARK_OAK_WALL_SIGN, fn() => VanillaItems::DARK_OAK_SIGN()),
167 WoodType::MANGROVE => $make(Ids::MANGROVE_SIGN, Ids::MANGROVE_WALL_SIGN, fn() => VanillaItems::MANGROVE_SIGN()),
168 WoodType::CRIMSON => $make(Ids::CRIMSON_SIGN, Ids::CRIMSON_WALL_SIGN, fn() => VanillaItems::CRIMSON_SIGN()),
169 WoodType::WARPED => $make(Ids::WARPED_SIGN, Ids::WARPED_WALL_SIGN, fn() => VanillaItems::WARPED_SIGN()),
170 WoodType::CHERRY => $make(Ids::CHERRY_SIGN, Ids::CHERRY_WALL_SIGN, fn() => VanillaItems::CHERRY_SIGN()),
171 };
172 }
173
174 public static function getTrapdoorIdentifier(WoodType $treeType) : BID{
175 return new BID(match($treeType){
176 WoodType::OAK => Ids::OAK_TRAPDOOR,
177 WoodType::SPRUCE => Ids::SPRUCE_TRAPDOOR,
178 WoodType::BIRCH => Ids::BIRCH_TRAPDOOR,
179 WoodType::JUNGLE => Ids::JUNGLE_TRAPDOOR,
180 WoodType::ACACIA => Ids::ACACIA_TRAPDOOR,
181 WoodType::DARK_OAK => Ids::DARK_OAK_TRAPDOOR,
182 WoodType::MANGROVE => Ids::MANGROVE_TRAPDOOR,
183 WoodType::CRIMSON => Ids::CRIMSON_TRAPDOOR,
184 WoodType::WARPED => Ids::WARPED_TRAPDOOR,
185 WoodType::CHERRY => Ids::CHERRY_TRAPDOOR,
186 });
187 }
188
189 public static function getButtonIdentifier(WoodType $treeType) : BID{
190 return new BID(match($treeType){
191 WoodType::OAK => Ids::OAK_BUTTON,
192 WoodType::SPRUCE => Ids::SPRUCE_BUTTON,
193 WoodType::BIRCH => Ids::BIRCH_BUTTON,
194 WoodType::JUNGLE => Ids::JUNGLE_BUTTON,
195 WoodType::ACACIA => Ids::ACACIA_BUTTON,
196 WoodType::DARK_OAK => Ids::DARK_OAK_BUTTON,
197 WoodType::MANGROVE => Ids::MANGROVE_BUTTON,
198 WoodType::CRIMSON => Ids::CRIMSON_BUTTON,
199 WoodType::WARPED => Ids::WARPED_BUTTON,
200 WoodType::CHERRY => Ids::CHERRY_BUTTON,
201 });
202 }
203
204 public static function getPressurePlateIdentifier(WoodType $treeType) : BID{
205 return new BID(match($treeType){
206 WoodType::OAK => Ids::OAK_PRESSURE_PLATE,
207 WoodType::SPRUCE => Ids::SPRUCE_PRESSURE_PLATE,
208 WoodType::BIRCH => Ids::BIRCH_PRESSURE_PLATE,
209 WoodType::JUNGLE => Ids::JUNGLE_PRESSURE_PLATE,
210 WoodType::ACACIA => Ids::ACACIA_PRESSURE_PLATE,
211 WoodType::DARK_OAK => Ids::DARK_OAK_PRESSURE_PLATE,
212 WoodType::MANGROVE => Ids::MANGROVE_PRESSURE_PLATE,
213 WoodType::CRIMSON => Ids::CRIMSON_PRESSURE_PLATE,
214 WoodType::WARPED => Ids::WARPED_PRESSURE_PLATE,
215 WoodType::CHERRY => Ids::CHERRY_PRESSURE_PLATE,
216 });
217 }
218
219 public static function getDoorIdentifier(WoodType $treeType) : BID{
220 return new BID(match($treeType){
221 WoodType::OAK => Ids::OAK_DOOR,
222 WoodType::SPRUCE => Ids::SPRUCE_DOOR,
223 WoodType::BIRCH => Ids::BIRCH_DOOR,
224 WoodType::JUNGLE => Ids::JUNGLE_DOOR,
225 WoodType::ACACIA => Ids::ACACIA_DOOR,
226 WoodType::DARK_OAK => Ids::DARK_OAK_DOOR,
227 WoodType::MANGROVE => Ids::MANGROVE_DOOR,
228 WoodType::CRIMSON => Ids::CRIMSON_DOOR,
229 WoodType::WARPED => Ids::WARPED_DOOR,
230 WoodType::CHERRY => Ids::CHERRY_DOOR,
231 });
232 }
233
234 public static function getFenceGateIdentifier(WoodType $treeType) : BID{
235 return new BID(match($treeType){
236 WoodType::OAK => Ids::OAK_FENCE_GATE,
237 WoodType::SPRUCE => Ids::SPRUCE_FENCE_GATE,
238 WoodType::BIRCH => Ids::BIRCH_FENCE_GATE,
239 WoodType::JUNGLE => Ids::JUNGLE_FENCE_GATE,
240 WoodType::ACACIA => Ids::ACACIA_FENCE_GATE,
241 WoodType::DARK_OAK => Ids::DARK_OAK_FENCE_GATE,
242 WoodType::MANGROVE => Ids::MANGROVE_FENCE_GATE,
243 WoodType::CRIMSON => Ids::CRIMSON_FENCE_GATE,
244 WoodType::WARPED => Ids::WARPED_FENCE_GATE,
245 WoodType::CHERRY => Ids::CHERRY_FENCE_GATE,
246 });
247 }
248
249 public static function getStairsIdentifier(WoodType $treeType) : BID{
250 return new BID(match($treeType){
251 WoodType::OAK => Ids::OAK_STAIRS,
252 WoodType::SPRUCE => Ids::SPRUCE_STAIRS,
253 WoodType::BIRCH => Ids::BIRCH_STAIRS,
254 WoodType::JUNGLE => Ids::JUNGLE_STAIRS,
255 WoodType::ACACIA => Ids::ACACIA_STAIRS,
256 WoodType::DARK_OAK => Ids::DARK_OAK_STAIRS,
257 WoodType::MANGROVE => Ids::MANGROVE_STAIRS,
258 WoodType::CRIMSON => Ids::CRIMSON_STAIRS,
259 WoodType::WARPED => Ids::WARPED_STAIRS,
260 WoodType::CHERRY => Ids::CHERRY_STAIRS,
261 });
262 }
263}