From d03bbb0426e6c531712a451928b5dd5cec43b8db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Le=C3=B3n?= <58715544+JavierLeon9966@users.noreply.github.com> Date: Thu, 10 Nov 2022 09:57:14 -0300 Subject: [PATCH] Implemented darkness effect (#5402) --- src/data/bedrock/EffectIdMap.php | 1 + src/data/bedrock/EffectIds.php | 1 + src/entity/effect/StringToEffectParser.php | 1 + src/entity/effect/VanillaEffects.php | 2 ++ 4 files changed, 5 insertions(+) diff --git a/src/data/bedrock/EffectIdMap.php b/src/data/bedrock/EffectIdMap.php index 23985fa12..6dce86d9b 100644 --- a/src/data/bedrock/EffectIdMap.php +++ b/src/data/bedrock/EffectIdMap.php @@ -74,6 +74,7 @@ final class EffectIdMap{ //TODO: SLOW_FALLING //TODO: BAD_OMEN //TODO: VILLAGE_HERO + $this->register(EffectIds::DARKNESS, VanillaEffects::DARKNESS()); } //TODO: not a big fan of the code duplication here :( diff --git a/src/data/bedrock/EffectIds.php b/src/data/bedrock/EffectIds.php index 3acf56569..a2ada01d9 100644 --- a/src/data/bedrock/EffectIds.php +++ b/src/data/bedrock/EffectIds.php @@ -58,4 +58,5 @@ final class EffectIds{ public const SLOW_FALLING = 27; public const BAD_OMEN = 28; public const VILLAGE_HERO = 29; + public const DARKNESS = 30; } diff --git a/src/entity/effect/StringToEffectParser.php b/src/entity/effect/StringToEffectParser.php index d336af33b..23bd29bd0 100644 --- a/src/entity/effect/StringToEffectParser.php +++ b/src/entity/effect/StringToEffectParser.php @@ -40,6 +40,7 @@ final class StringToEffectParser extends StringToTParser{ $result->register("absorption", fn() => VanillaEffects::ABSORPTION()); $result->register("blindness", fn() => VanillaEffects::BLINDNESS()); $result->register("conduit_power", fn() => VanillaEffects::CONDUIT_POWER()); + $result->register("darkness", fn() => VanillaEffects::DARKNESS()); $result->register("fatal_poison", fn() => VanillaEffects::FATAL_POISON()); $result->register("fire_resistance", fn() => VanillaEffects::FIRE_RESISTANCE()); $result->register("haste", fn() => VanillaEffects::HASTE()); diff --git a/src/entity/effect/VanillaEffects.php b/src/entity/effect/VanillaEffects.php index 04f7985da..50544054a 100644 --- a/src/entity/effect/VanillaEffects.php +++ b/src/entity/effect/VanillaEffects.php @@ -36,6 +36,7 @@ use pocketmine\utils\RegistryTrait; * @method static AbsorptionEffect ABSORPTION() * @method static Effect BLINDNESS() * @method static Effect CONDUIT_POWER() + * @method static Effect DARKNESS() * @method static PoisonEffect FATAL_POISON() * @method static Effect FIRE_RESISTANCE() * @method static Effect HASTE() @@ -68,6 +69,7 @@ final class VanillaEffects{ //TODO: bad_omen self::register("blindness", new Effect(KnownTranslationFactory::potion_blindness(), new Color(0x1f, 0x1f, 0x23), true)); self::register("conduit_power", new Effect(KnownTranslationFactory::potion_conduitPower(), new Color(0x1d, 0xc2, 0xd1))); + self::register("darkness", new Effect(KnownTranslationFactory::effect_darkness(), new Color(0x29, 0x27, 0x21), true, 600, false)); self::register("fatal_poison", new PoisonEffect(KnownTranslationFactory::potion_poison(), new Color(0x4e, 0x93, 0x31), true, 600, true, true)); self::register("fire_resistance", new Effect(KnownTranslationFactory::potion_fireResistance(), new Color(0xe4, 0x9a, 0x3a))); self::register("haste", new Effect(KnownTranslationFactory::potion_digSpeed(), new Color(0xd9, 0xc0, 0x43)));