PocketMine-MP 5.23.3 git-f7687af337d001ddbcc47b8e773f014a33faa662
Loading...
Searching...
No Matches
VanillaEnchantments.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\item\enchantment;
25
28use pocketmine\utils\RegistryTrait;
29
61 use RegistryTrait;
62
63 protected static function setup() : void{
64 self::register("PROTECTION", new ProtectionEnchantment(
65 KnownTranslationFactory::enchantment_protect_all(),
66 Rarity::COMMON,
67 0,
68 0,
69 4,
70 0.75,
71 null,
72 fn(int $level) : int => 11 * ($level - 1) + 1,
73 20
74 ));
75 self::register("FIRE_PROTECTION", new ProtectionEnchantment(
76 KnownTranslationFactory::enchantment_protect_fire(),
77 Rarity::UNCOMMON,
78 0,
79 0,
80 4,
81 1.25,
82 [
83 EntityDamageEvent::CAUSE_FIRE,
84 EntityDamageEvent::CAUSE_FIRE_TICK,
85 EntityDamageEvent::CAUSE_LAVA
86 //TODO: check fireballs
87 ],
88 fn(int $level) : int => 8 * ($level - 1) + 10,
89 12
90 ));
91 self::register("FEATHER_FALLING", new ProtectionEnchantment(
92 KnownTranslationFactory::enchantment_protect_fall(),
93 Rarity::UNCOMMON,
94 0,
95 0,
96 4,
97 2.5,
98 [
99 EntityDamageEvent::CAUSE_FALL
100 ],
101 fn(int $level) : int => 6 * ($level - 1) + 5,
102 10
103 ));
104 self::register("BLAST_PROTECTION", new ProtectionEnchantment(
105 KnownTranslationFactory::enchantment_protect_explosion(),
106 Rarity::RARE,
107 0,
108 0,
109 4,
110 1.5,
111 [
112 EntityDamageEvent::CAUSE_BLOCK_EXPLOSION,
113 EntityDamageEvent::CAUSE_ENTITY_EXPLOSION
114 ],
115 fn(int $level) : int => 8 * ($level - 1) + 5,
116 12
117 ));
118 self::register("PROJECTILE_PROTECTION", new ProtectionEnchantment(
119 KnownTranslationFactory::enchantment_protect_projectile(),
120 Rarity::UNCOMMON,
121 0,
122 0,
123 4,
124 1.5,
125 [
126 EntityDamageEvent::CAUSE_PROJECTILE
127 ],
128 fn(int $level) : int => 6 * ($level - 1) + 3,
129 15
130 ));
131 self::register("THORNS", new Enchantment(
132 KnownTranslationFactory::enchantment_thorns(),
133 Rarity::MYTHIC,
134 0,
135 0,
136 3,
137 fn(int $level) : int => 20 * ($level - 1) + 10,
138 50
139 ));
140 self::register("RESPIRATION", new Enchantment(
141 KnownTranslationFactory::enchantment_oxygen(),
142 Rarity::RARE,
143 0,
144 0,
145 3,
146 fn(int $level) : int => 10 * $level,
147 30
148 ));
149
150 self::register("FROST_WALKER", new Enchantment(
151 KnownTranslationFactory::enchantment_frostwalker(),
152 Rarity::RARE,
153 0,
154 0,
155 2,
156 fn(int $level) : int => 10 * $level,
157 15
158 ));
159 self::register("AQUA_AFFINITY", new Enchantment(
160 KnownTranslationFactory::enchantment_waterWorker(),
161 Rarity::RARE,
162 0,
163 0,
164 1,
165 null,
166 40
167 ));
168
169 self::register("SHARPNESS", new SharpnessEnchantment(
170 KnownTranslationFactory::enchantment_damage_all(),
171 Rarity::COMMON,
172 0,
173 0,
174 5,
175 fn(int $level) : int => 11 * ($level - 1) + 1,
176 20
177 ));
178 self::register("KNOCKBACK", new KnockbackEnchantment(
179 KnownTranslationFactory::enchantment_knockback(),
180 Rarity::UNCOMMON,
181 0,
182 0,
183 2,
184 fn(int $level) : int => 20 * ($level - 1) + 5,
185 50
186 ));
187 self::register("FIRE_ASPECT", new FireAspectEnchantment(
188 KnownTranslationFactory::enchantment_fire(),
189 Rarity::RARE,
190 0,
191 0,
192 2,
193 fn(int $level) : int => 20 * ($level - 1) + 10,
194 50
195 ));
196 //TODO: smite, bane of arthropods, looting (these don't make sense now because their applicable mobs don't exist yet)
197
198 self::register("EFFICIENCY", new Enchantment(
199 KnownTranslationFactory::enchantment_digging(),
200 Rarity::COMMON,
201 0,
202 0,
203 5,
204 fn(int $level) : int => 10 * ($level - 1) + 1,
205 50
206 ));
207 self::register("FORTUNE", new Enchantment(
208 KnownTranslationFactory::enchantment_lootBonusDigger(),
209 Rarity::RARE,
210 0,
211 0,
212 3,
213 fn(int $level) : int => 9 * ($level - 1) + 15,
214 50
215 ));
216 self::register("SILK_TOUCH", new Enchantment(
217 KnownTranslationFactory::enchantment_untouching(),
218 Rarity::MYTHIC,
219 0,
220 0,
221 1,
222 fn(int $level) : int => 15,
223 50
224 ));
225 self::register("UNBREAKING", new Enchantment(
226 KnownTranslationFactory::enchantment_durability(),
227 Rarity::UNCOMMON,
228 0,
229 0,
230 3,
231 fn(int $level) : int => 8 * ($level - 1) + 5,
232 50
233 ));
234
235 self::register("POWER", new Enchantment(
236 KnownTranslationFactory::enchantment_arrowDamage(),
237 Rarity::COMMON,
238 0,
239 0,
240 5,
241 fn(int $level) : int => 10 * ($level - 1) + 1,
242 15
243 ));
244 self::register("PUNCH", new Enchantment(
245 KnownTranslationFactory::enchantment_arrowKnockback(),
246 Rarity::RARE,
247 0,
248 0,
249 2,
250 fn(int $level) : int => 20 * ($level - 1) + 12,
251 25
252 ));
253 self::register("FLAME", new Enchantment(
254 KnownTranslationFactory::enchantment_arrowFire(),
255 Rarity::RARE,
256 0,
257 0,
258 1,
259 fn(int $level) : int => 20,
260 30
261 ));
262 self::register("INFINITY", new Enchantment(
263 KnownTranslationFactory::enchantment_arrowInfinite(),
264 Rarity::MYTHIC,
265 0,
266 0,
267 1,
268 fn(int $level) : int => 20,
269 30
270 ));
271
272 self::register("MENDING", new Enchantment(
273 KnownTranslationFactory::enchantment_mending(),
274 Rarity::RARE,
275 0,
276 0,
277 1,
278 fn(int $level) : int => 25,
279 50
280 ));
281
282 self::register("VANISHING", new Enchantment(
283 KnownTranslationFactory::enchantment_curse_vanishing(),
284 Rarity::MYTHIC,
285 0,
286 0,
287 1,
288 fn(int $level) : int => 25,
289 25
290 ));
291
292 self::register("SWIFT_SNEAK", new Enchantment(
293 KnownTranslationFactory::enchantment_swift_sneak(),
294 Rarity::MYTHIC,
295 0,
296 0,
297 3,
298 fn(int $level) : int => 10 * $level,
299 5
300 ));
301 }
302
303 protected static function register(string $name, Enchantment $member) : void{
304 self::_registryRegister($name, $member);
305 }
306
311 public static function getAll() : array{
316 $result = self::_registryGetAll();
317 return $result;
318 }
319}