mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-04 00:59:51 +00:00
Register missing potion types
This commit is contained in:
parent
5387456e44
commit
5d6146a01f
@ -79,6 +79,11 @@ final class PotionTypeIdMap{
|
|||||||
$this->register(PotionTypeIds::WEAKNESS, PotionType::WEAKNESS());
|
$this->register(PotionTypeIds::WEAKNESS, PotionType::WEAKNESS());
|
||||||
$this->register(PotionTypeIds::LONG_WEAKNESS, PotionType::LONG_WEAKNESS());
|
$this->register(PotionTypeIds::LONG_WEAKNESS, PotionType::LONG_WEAKNESS());
|
||||||
$this->register(PotionTypeIds::WITHER, PotionType::WITHER());
|
$this->register(PotionTypeIds::WITHER, PotionType::WITHER());
|
||||||
|
$this->register(PotionTypeIds::TURTLE_MASTER, PotionType::TURTLE_MASTER());
|
||||||
|
$this->register(PotionTypeIds::LONG_TURTLE_MASTER, PotionType::LONG_TURTLE_MASTER());
|
||||||
|
$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());
|
||||||
}
|
}
|
||||||
|
|
||||||
private function register(int $id, PotionType $type) : void{
|
private function register(int $id, PotionType $type) : void{
|
||||||
|
@ -61,4 +61,9 @@ final class PotionTypeIds{
|
|||||||
public const WEAKNESS = 34;
|
public const WEAKNESS = 34;
|
||||||
public const LONG_WEAKNESS = 35;
|
public const LONG_WEAKNESS = 35;
|
||||||
public const WITHER = 36;
|
public const WITHER = 36;
|
||||||
|
public const TURTLE_MASTER = 37;
|
||||||
|
public const LONG_TURTLE_MASTER = 38;
|
||||||
|
public const STRONG_TURTLE_MASTER = 39;
|
||||||
|
public const SLOW_FALLING = 40;
|
||||||
|
public const LONG_SLOW_FALLING = 41;
|
||||||
}
|
}
|
||||||
|
@ -152,7 +152,7 @@ final class EntityFactory{
|
|||||||
$this->register(SplashPotion::class, function(World $world, CompoundTag $nbt) : SplashPotion{
|
$this->register(SplashPotion::class, function(World $world, CompoundTag $nbt) : SplashPotion{
|
||||||
$potionType = PotionTypeIdMap::getInstance()->fromId($nbt->getShort("PotionId", PotionTypeIds::WATER));
|
$potionType = PotionTypeIdMap::getInstance()->fromId($nbt->getShort("PotionId", PotionTypeIds::WATER));
|
||||||
if($potionType === null){
|
if($potionType === null){
|
||||||
$potionType = PotionType::WATER(); //TODO: this should be an error, but we haven't registered all the types yet
|
throw new \UnexpectedValueException("No such potion type");
|
||||||
}
|
}
|
||||||
return new SplashPotion(EntityDataHelper::parseLocation($nbt, $world), null, $potionType, $nbt);
|
return new SplashPotion(EntityDataHelper::parseLocation($nbt, $world), null, $potionType, $nbt);
|
||||||
}, ['ThrownPotion', 'minecraft:potion', 'thrownpotion'], EntityLegacyIds::SPLASH_POTION);
|
}, ['ThrownPotion', 'minecraft:potion', 'thrownpotion'], EntityLegacyIds::SPLASH_POTION);
|
||||||
|
@ -46,8 +46,10 @@ use pocketmine\utils\EnumTrait;
|
|||||||
* @method static PotionType LONG_POISON()
|
* @method static PotionType LONG_POISON()
|
||||||
* @method static PotionType LONG_REGENERATION()
|
* @method static PotionType LONG_REGENERATION()
|
||||||
* @method static PotionType LONG_SLOWNESS()
|
* @method static PotionType LONG_SLOWNESS()
|
||||||
|
* @method static PotionType LONG_SLOW_FALLING()
|
||||||
* @method static PotionType LONG_STRENGTH()
|
* @method static PotionType LONG_STRENGTH()
|
||||||
* @method static PotionType LONG_SWIFTNESS()
|
* @method static PotionType LONG_SWIFTNESS()
|
||||||
|
* @method static PotionType LONG_TURTLE_MASTER()
|
||||||
* @method static PotionType LONG_WATER_BREATHING()
|
* @method static PotionType LONG_WATER_BREATHING()
|
||||||
* @method static PotionType LONG_WEAKNESS()
|
* @method static PotionType LONG_WEAKNESS()
|
||||||
* @method static PotionType MUNDANE()
|
* @method static PotionType MUNDANE()
|
||||||
@ -55,6 +57,7 @@ use pocketmine\utils\EnumTrait;
|
|||||||
* @method static PotionType POISON()
|
* @method static PotionType POISON()
|
||||||
* @method static PotionType REGENERATION()
|
* @method static PotionType REGENERATION()
|
||||||
* @method static PotionType SLOWNESS()
|
* @method static PotionType SLOWNESS()
|
||||||
|
* @method static PotionType SLOW_FALLING()
|
||||||
* @method static PotionType STRENGTH()
|
* @method static PotionType STRENGTH()
|
||||||
* @method static PotionType STRONG_HARMING()
|
* @method static PotionType STRONG_HARMING()
|
||||||
* @method static PotionType STRONG_HEALING()
|
* @method static PotionType STRONG_HEALING()
|
||||||
@ -63,8 +66,10 @@ use pocketmine\utils\EnumTrait;
|
|||||||
* @method static PotionType STRONG_REGENERATION()
|
* @method static PotionType STRONG_REGENERATION()
|
||||||
* @method static PotionType STRONG_STRENGTH()
|
* @method static PotionType STRONG_STRENGTH()
|
||||||
* @method static PotionType STRONG_SWIFTNESS()
|
* @method static PotionType STRONG_SWIFTNESS()
|
||||||
|
* @method static PotionType STRONG_TURTLE_MASTER()
|
||||||
* @method static PotionType SWIFTNESS()
|
* @method static PotionType SWIFTNESS()
|
||||||
* @method static PotionType THICK()
|
* @method static PotionType THICK()
|
||||||
|
* @method static PotionType TURTLE_MASTER()
|
||||||
* @method static PotionType WATER()
|
* @method static PotionType WATER()
|
||||||
* @method static PotionType WATER_BREATHING()
|
* @method static PotionType WATER_BREATHING()
|
||||||
* @method static PotionType WEAKNESS()
|
* @method static PotionType WEAKNESS()
|
||||||
@ -177,6 +182,21 @@ final class PotionType{
|
|||||||
]),
|
]),
|
||||||
new self("wither", fn() => [
|
new self("wither", fn() => [
|
||||||
new EffectInstance(VanillaEffects::WITHER(), 800, 1)
|
new EffectInstance(VanillaEffects::WITHER(), 800, 1)
|
||||||
|
]),
|
||||||
|
new self("turtle_master", fn() => [
|
||||||
|
//TODO
|
||||||
|
]),
|
||||||
|
new self("long_turtle_master", fn() => [
|
||||||
|
//TODO
|
||||||
|
]),
|
||||||
|
new self("strong_turtle_master", fn() => [
|
||||||
|
//TODO
|
||||||
|
]),
|
||||||
|
new self("slow_falling", fn() => [
|
||||||
|
//TODO
|
||||||
|
]),
|
||||||
|
new self("long_slow_falling", fn() => [
|
||||||
|
//TODO
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user