Implemented strong slowness potion (#5888)

This commit is contained in:
ace 2023-07-13 20:22:01 +08:00 committed by GitHub
parent 0d8a06732a
commit 7132ac0ad3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 30 additions and 20 deletions

View File

@ -84,6 +84,7 @@ final class PotionTypeIdMap{
$this->register(PotionTypeIds::STRONG_TURTLE_MASTER, PotionType::STRONG_TURTLE_MASTER());
$this->register(PotionTypeIds::SLOW_FALLING, PotionType::SLOW_FALLING());
$this->register(PotionTypeIds::LONG_SLOW_FALLING, PotionType::LONG_SLOW_FALLING());
$this->register(PotionTypeIds::STRONG_SLOWNESS, PotionType::STRONG_SLOWNESS());
}
private function register(int $id, PotionType $type) : void{

View File

@ -66,4 +66,5 @@ final class PotionTypeIds{
public const STRONG_TURTLE_MASTER = 39;
public const SLOW_FALLING = 40;
public const LONG_SLOW_FALLING = 41;
public const STRONG_SLOWNESS = 42;
}

View File

@ -190,16 +190,17 @@ trait RuntimeEnumDeserializerTrait{
29 => \pocketmine\item\PotionType::STRONG_LEAPING(),
30 => \pocketmine\item\PotionType::STRONG_POISON(),
31 => \pocketmine\item\PotionType::STRONG_REGENERATION(),
32 => \pocketmine\item\PotionType::STRONG_STRENGTH(),
33 => \pocketmine\item\PotionType::STRONG_SWIFTNESS(),
34 => \pocketmine\item\PotionType::STRONG_TURTLE_MASTER(),
35 => \pocketmine\item\PotionType::SWIFTNESS(),
36 => \pocketmine\item\PotionType::THICK(),
37 => \pocketmine\item\PotionType::TURTLE_MASTER(),
38 => \pocketmine\item\PotionType::WATER(),
39 => \pocketmine\item\PotionType::WATER_BREATHING(),
40 => \pocketmine\item\PotionType::WEAKNESS(),
41 => \pocketmine\item\PotionType::WITHER(),
32 => \pocketmine\item\PotionType::STRONG_SLOWNESS(),
33 => \pocketmine\item\PotionType::STRONG_STRENGTH(),
34 => \pocketmine\item\PotionType::STRONG_SWIFTNESS(),
35 => \pocketmine\item\PotionType::STRONG_TURTLE_MASTER(),
36 => \pocketmine\item\PotionType::SWIFTNESS(),
37 => \pocketmine\item\PotionType::THICK(),
38 => \pocketmine\item\PotionType::TURTLE_MASTER(),
39 => \pocketmine\item\PotionType::WATER(),
40 => \pocketmine\item\PotionType::WATER_BREATHING(),
41 => \pocketmine\item\PotionType::WEAKNESS(),
42 => \pocketmine\item\PotionType::WITHER(),
default => throw new InvalidSerializedRuntimeDataException("Invalid serialized value for PotionType")
};
}

View File

@ -190,16 +190,17 @@ trait RuntimeEnumSerializerTrait{
\pocketmine\item\PotionType::STRONG_LEAPING() => 29,
\pocketmine\item\PotionType::STRONG_POISON() => 30,
\pocketmine\item\PotionType::STRONG_REGENERATION() => 31,
\pocketmine\item\PotionType::STRONG_STRENGTH() => 32,
\pocketmine\item\PotionType::STRONG_SWIFTNESS() => 33,
\pocketmine\item\PotionType::STRONG_TURTLE_MASTER() => 34,
\pocketmine\item\PotionType::SWIFTNESS() => 35,
\pocketmine\item\PotionType::THICK() => 36,
\pocketmine\item\PotionType::TURTLE_MASTER() => 37,
\pocketmine\item\PotionType::WATER() => 38,
\pocketmine\item\PotionType::WATER_BREATHING() => 39,
\pocketmine\item\PotionType::WEAKNESS() => 40,
\pocketmine\item\PotionType::WITHER() => 41,
\pocketmine\item\PotionType::STRONG_SLOWNESS() => 32,
\pocketmine\item\PotionType::STRONG_STRENGTH() => 33,
\pocketmine\item\PotionType::STRONG_SWIFTNESS() => 34,
\pocketmine\item\PotionType::STRONG_TURTLE_MASTER() => 35,
\pocketmine\item\PotionType::SWIFTNESS() => 36,
\pocketmine\item\PotionType::THICK() => 37,
\pocketmine\item\PotionType::TURTLE_MASTER() => 38,
\pocketmine\item\PotionType::WATER() => 39,
\pocketmine\item\PotionType::WATER_BREATHING() => 40,
\pocketmine\item\PotionType::WEAKNESS() => 41,
\pocketmine\item\PotionType::WITHER() => 42,
default => throw new \pocketmine\utils\AssumptionFailedError("All PotionType cases should be covered")
});
}

View File

@ -65,6 +65,7 @@ use pocketmine\utils\EnumTrait;
* @method static PotionType STRONG_LEAPING()
* @method static PotionType STRONG_POISON()
* @method static PotionType STRONG_REGENERATION()
* @method static PotionType STRONG_SLOWNESS()
* @method static PotionType STRONG_STRENGTH()
* @method static PotionType STRONG_SWIFTNESS()
* @method static PotionType STRONG_TURTLE_MASTER()
@ -201,6 +202,9 @@ final class PotionType{
]),
new self("long_slow_falling", "Long Slow Falling", fn() => [
//TODO
]),
new self("strong_slowness", "Strong Slowness", fn() => [
new EffectInstance(VanillaEffects::SLOWNESS(), 20 * 20, 3)
])
);
}

View File

@ -1506,6 +1506,8 @@ final class StringToItemParser extends StringToTParser{
$result->register("strong_poison_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::STRONG_POISON()));
$result->register("strong_regeneration_potion", fn() => Items::POTION()->setType(PotionType::STRONG_REGENERATION()));
$result->register("strong_regeneration_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::STRONG_REGENERATION()));
$result->register("strong_slowness_potion", fn() => Items::POTION()->setType(PotionType::STRONG_SLOWNESS()));
$result->register("strong_slowness_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::STRONG_SLOWNESS()));
$result->register("strong_strength_potion", fn() => Items::POTION()->setType(PotionType::STRONG_STRENGTH()));
$result->register("strong_strength_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::STRONG_STRENGTH()));
$result->register("strong_swiftness_potion", fn() => Items::POTION()->setType(PotionType::STRONG_SWIFTNESS()));