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

@@ -33,6 +33,7 @@ use pocketmine\block\utils\TreeType;
use pocketmine\block\VanillaBlocks;
use pocketmine\data\bedrock\DyeColorIdMap;
use pocketmine\data\bedrock\EntityLegacyIds;
use pocketmine\data\bedrock\PotionTypeIdMap;
use pocketmine\entity\Entity;
use pocketmine\entity\Location;
use pocketmine\entity\Squid;
@@ -278,9 +279,10 @@ class ItemFactory{
))->setColor($color));
}
foreach(Potion::ALL as $type){
$this->register(new Potion(new ItemIdentifier(ItemIds::POTION, $type), "Potion", $type));
$this->register(new SplashPotion(new ItemIdentifier(ItemIds::SPLASH_POTION, $type), "Splash Potion", $type));
foreach(PotionType::getAll() as $type){
$typeId = PotionTypeIdMap::getInstance()->toId($type);
$this->register(new Potion(new ItemIdentifier(ItemIds::POTION, $typeId), "Potion", $type));
$this->register(new SplashPotion(new ItemIdentifier(ItemIds::SPLASH_POTION, $typeId), "Splash Potion", $type));
}
foreach(TreeType::getAll() as $type){