Move potion types to enum

This commit is contained in:
Dylan K. Taylor
2021-06-19 21:39:23 +01:00
parent 908fa5f901
commit 5387456e44
8 changed files with 398 additions and 253 deletions

View File

@@ -30,12 +30,11 @@ use pocketmine\player\Player;
class SplashPotion extends ProjectileItem{
/** @var int */
private $potionId;
private PotionType $potionType;
public function __construct(ItemIdentifier $identifier, string $name, int $potionId){
public function __construct(ItemIdentifier $identifier, string $name, PotionType $potionType){
parent::__construct($identifier, $name);
$this->potionId = $potionId;
$this->potionType = $potionType;
}
public function getMaxStackSize() : int{
@@ -43,7 +42,7 @@ class SplashPotion extends ProjectileItem{
}
protected function createEntity(Location $location, Player $thrower) : Throwable{
return new SplashPotionEntity($location, $thrower, $this->potionId);
return new SplashPotionEntity($location, $thrower, $this->potionType);
}
public function getThrowForce() : float{