PocketMine-MP 5.23.3 git-f7687af337d001ddbcc47b8e773f014a33faa662
Loading...
Searching...
No Matches
VanillaEffects.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\effect;
25
28use pocketmine\utils\RegistryTrait;
29
64final class VanillaEffects{
65 use RegistryTrait;
66
67 protected static function setup() : void{
68 self::register("absorption", new AbsorptionEffect(KnownTranslationFactory::potion_absorption(), new Color(0x25, 0x52, 0xa5)));
69 //TODO: bad_omen
70 self::register("blindness", new Effect(KnownTranslationFactory::potion_blindness(), new Color(0x1f, 0x1f, 0x23), true));
71 self::register("conduit_power", new Effect(KnownTranslationFactory::potion_conduitPower(), new Color(0x1d, 0xc2, 0xd1)));
72 self::register("darkness", new Effect(KnownTranslationFactory::effect_darkness(), new Color(0x29, 0x27, 0x21), true, 600, false));
73 self::register("fatal_poison", new PoisonEffect(KnownTranslationFactory::potion_poison(), new Color(0x4e, 0x93, 0x31), true, 600, true, true));
74 self::register("fire_resistance", new Effect(KnownTranslationFactory::potion_fireResistance(), new Color(0xe4, 0x9a, 0x3a)));
75 self::register("haste", new Effect(KnownTranslationFactory::potion_digSpeed(), new Color(0xd9, 0xc0, 0x43)));
76 self::register("health_boost", new HealthBoostEffect(KnownTranslationFactory::potion_healthBoost(), new Color(0xf8, 0x7d, 0x23)));
77 self::register("hunger", new HungerEffect(KnownTranslationFactory::potion_hunger(), new Color(0x58, 0x76, 0x53), true));
78 self::register("instant_damage", new InstantDamageEffect(KnownTranslationFactory::potion_harm(), new Color(0x43, 0x0a, 0x09), true, false));
79 self::register("instant_health", new InstantHealthEffect(KnownTranslationFactory::potion_heal(), new Color(0xf8, 0x24, 0x23), false, false));
80 self::register("invisibility", new InvisibilityEffect(KnownTranslationFactory::potion_invisibility(), new Color(0x7f, 0x83, 0x92)));
81 self::register("jump_boost", new Effect(KnownTranslationFactory::potion_jump(), new Color(0x22, 0xff, 0x4c)));
82 self::register("levitation", new LevitationEffect(KnownTranslationFactory::potion_levitation(), new Color(0xce, 0xff, 0xff)));
83 self::register("mining_fatigue", new Effect(KnownTranslationFactory::potion_digSlowDown(), new Color(0x4a, 0x42, 0x17), true));
84 self::register("nausea", new Effect(KnownTranslationFactory::potion_confusion(), new Color(0x55, 0x1d, 0x4a), true));
85 self::register("night_vision", new Effect(KnownTranslationFactory::potion_nightVision(), new Color(0x1f, 0x1f, 0xa1)));
86 self::register("poison", new PoisonEffect(KnownTranslationFactory::potion_poison(), new Color(0x4e, 0x93, 0x31), true));
87 self::register("regeneration", new RegenerationEffect(KnownTranslationFactory::potion_regeneration(), new Color(0xcd, 0x5c, 0xab)));
88 self::register("resistance", new Effect(KnownTranslationFactory::potion_resistance(), new Color(0x99, 0x45, 0x3a)));
89 self::register("saturation", new SaturationEffect(KnownTranslationFactory::potion_saturation(), new Color(0xf8, 0x24, 0x23)));
90 //TODO: slow_falling
91 self::register("slowness", new SlownessEffect(KnownTranslationFactory::potion_moveSlowdown(), new Color(0x5a, 0x6c, 0x81), true));
92 self::register("speed", new SpeedEffect(KnownTranslationFactory::potion_moveSpeed(), new Color(0x7c, 0xaf, 0xc6)));
93 self::register("strength", new Effect(KnownTranslationFactory::potion_damageBoost(), new Color(0x93, 0x24, 0x23)));
94 //TODO: village_hero
95 self::register("water_breathing", new Effect(KnownTranslationFactory::potion_waterBreathing(), new Color(0x2e, 0x52, 0x99)));
96 self::register("weakness", new Effect(KnownTranslationFactory::potion_weakness(), new Color(0x48, 0x4d, 0x48), true));
97 self::register("wither", new WitherEffect(KnownTranslationFactory::potion_wither(), new Color(0x35, 0x2a, 0x27), true));
98 }
99
100 protected static function register(string $name, Effect $member) : void{
101 self::_registryRegister($name, $member);
102 }
103
108 public static function getAll() : array{
109 //phpstan doesn't support generic traits yet :(
111 $result = self::_registryGetAll();
112 return $result;
113 }
114}