From 60580328078f6ee9eb83082f198508da4e2b13e9 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 28 Jun 2022 23:33:25 +0100 Subject: [PATCH] Make potion types dynamic It became obvious this was needed when I wanted to make new IDs for existing items - there's no way I'm unrolling those registrations... --- src/data/bedrock/item/ItemDeserializer.php | 93 +---------- src/data/bedrock/item/ItemSerializer.php | 105 +------------ src/item/ItemFactory.php | 6 +- src/item/Potion.php | 17 +- src/item/SplashPotion.php | 17 +- src/item/StringToItemParser.php | 172 ++++++++++----------- src/item/VanillaItems.php | 172 +-------------------- 7 files changed, 128 insertions(+), 454 deletions(-) diff --git a/src/data/bedrock/item/ItemDeserializer.php b/src/data/bedrock/item/ItemDeserializer.php index 1fc93a77b..37fbdad7b 100644 --- a/src/data/bedrock/item/ItemDeserializer.php +++ b/src/data/bedrock/item/ItemDeserializer.php @@ -37,7 +37,6 @@ use pocketmine\data\bedrock\item\ItemTypeIds as Ids; use pocketmine\data\bedrock\item\SavedItemData as Data; use pocketmine\data\bedrock\PotionTypeIdMap; use pocketmine\item\Item; -use pocketmine\item\PotionType; use pocketmine\item\VanillaItems as Items; use pocketmine\utils\AssumptionFailedError; @@ -493,51 +492,7 @@ final class ItemDeserializer{ if($potionType === null){ throw new ItemTypeDeserializeException("Unknown potion type ID $meta"); } - return match($potionType->id()){ - PotionType::WATER()->id() => Items::WATER_POTION(), - PotionType::MUNDANE()->id() => Items::MUNDANE_POTION(), - PotionType::LONG_MUNDANE()->id() => Items::LONG_MUNDANE_POTION(), - PotionType::THICK()->id() => Items::THICK_POTION(), - PotionType::AWKWARD()->id() => Items::AWKWARD_POTION(), - PotionType::NIGHT_VISION()->id() => Items::NIGHT_VISION_POTION(), - PotionType::LONG_NIGHT_VISION()->id() => Items::LONG_NIGHT_VISION_POTION(), - PotionType::INVISIBILITY()->id() => Items::INVISIBILITY_POTION(), - PotionType::LONG_INVISIBILITY()->id() => Items::LONG_INVISIBILITY_POTION(), - PotionType::LEAPING()->id() => Items::LEAPING_POTION(), - PotionType::LONG_LEAPING()->id() => Items::LONG_LEAPING_POTION(), - PotionType::STRONG_LEAPING()->id() => Items::STRONG_LEAPING_POTION(), - PotionType::FIRE_RESISTANCE()->id() => Items::FIRE_RESISTANCE_POTION(), - PotionType::LONG_FIRE_RESISTANCE()->id() => Items::LONG_FIRE_RESISTANCE_POTION(), - PotionType::SWIFTNESS()->id() => Items::SWIFTNESS_POTION(), - PotionType::LONG_SWIFTNESS()->id() => Items::LONG_SWIFTNESS_POTION(), - PotionType::STRONG_SWIFTNESS()->id() => Items::STRONG_SWIFTNESS_POTION(), - PotionType::SLOWNESS()->id() => Items::SLOWNESS_POTION(), - PotionType::LONG_SLOWNESS()->id() => Items::LONG_SLOWNESS_POTION(), - PotionType::WATER_BREATHING()->id() => Items::WATER_BREATHING_POTION(), - PotionType::LONG_WATER_BREATHING()->id() => Items::LONG_WATER_BREATHING_POTION(), - PotionType::HEALING()->id() => Items::HEALING_POTION(), - PotionType::STRONG_HEALING()->id() => Items::STRONG_HEALING_POTION(), - PotionType::HARMING()->id() => Items::HARMING_POTION(), - PotionType::STRONG_HARMING()->id() => Items::STRONG_HARMING_POTION(), - PotionType::POISON()->id() => Items::POISON_POTION(), - PotionType::LONG_POISON()->id() => Items::LONG_POISON_POTION(), - PotionType::STRONG_POISON()->id() => Items::STRONG_POISON_POTION(), - PotionType::REGENERATION()->id() => Items::REGENERATION_POTION(), - PotionType::LONG_REGENERATION()->id() => Items::LONG_REGENERATION_POTION(), - PotionType::STRONG_REGENERATION()->id() => Items::STRONG_REGENERATION_POTION(), - PotionType::STRENGTH()->id() => Items::STRENGTH_POTION(), - PotionType::LONG_STRENGTH()->id() => Items::LONG_STRENGTH_POTION(), - PotionType::STRONG_STRENGTH()->id() => Items::STRONG_STRENGTH_POTION(), - PotionType::WEAKNESS()->id() => Items::WEAKNESS_POTION(), - PotionType::LONG_WEAKNESS()->id() => Items::LONG_WEAKNESS_POTION(), - PotionType::WITHER()->id() => Items::WITHER_POTION(), - PotionType::TURTLE_MASTER()->id() => Items::TURTLE_MASTER_POTION(), - PotionType::LONG_TURTLE_MASTER()->id() => Items::LONG_TURTLE_MASTER_POTION(), - PotionType::STRONG_TURTLE_MASTER()->id() => Items::STRONG_TURTLE_MASTER_POTION(), - PotionType::SLOW_FALLING()->id() => Items::SLOW_FALLING_POTION(), - PotionType::LONG_SLOW_FALLING()->id() => Items::LONG_SLOW_FALLING_POTION(), - default => throw new ItemTypeDeserializeException("Unhandled potion type " . $potionType->getDisplayName()) - }; + return Items::POTION()->setType($potionType); }); //TODO: minecraft:powder_snow_bucket $this->map(Ids::PRISMARINE_CRYSTALS, fn() => Items::PRISMARINE_CRYSTALS()); @@ -613,51 +568,7 @@ final class ItemDeserializer{ if($potionType === null){ throw new ItemTypeDeserializeException("Unknown potion type ID $meta"); } - return match($potionType->id()){ - PotionType::WATER()->id() => Items::WATER_SPLASH_POTION(), - PotionType::MUNDANE()->id() => Items::MUNDANE_SPLASH_POTION(), - PotionType::LONG_MUNDANE()->id() => Items::LONG_MUNDANE_SPLASH_POTION(), - PotionType::THICK()->id() => Items::THICK_SPLASH_POTION(), - PotionType::AWKWARD()->id() => Items::AWKWARD_SPLASH_POTION(), - PotionType::NIGHT_VISION()->id() => Items::NIGHT_VISION_SPLASH_POTION(), - PotionType::LONG_NIGHT_VISION()->id() => Items::LONG_NIGHT_VISION_SPLASH_POTION(), - PotionType::INVISIBILITY()->id() => Items::INVISIBILITY_SPLASH_POTION(), - PotionType::LONG_INVISIBILITY()->id() => Items::LONG_INVISIBILITY_SPLASH_POTION(), - PotionType::LEAPING()->id() => Items::LEAPING_SPLASH_POTION(), - PotionType::LONG_LEAPING()->id() => Items::LONG_LEAPING_SPLASH_POTION(), - PotionType::STRONG_LEAPING()->id() => Items::STRONG_LEAPING_SPLASH_POTION(), - PotionType::FIRE_RESISTANCE()->id() => Items::FIRE_RESISTANCE_SPLASH_POTION(), - PotionType::LONG_FIRE_RESISTANCE()->id() => Items::LONG_FIRE_RESISTANCE_SPLASH_POTION(), - PotionType::SWIFTNESS()->id() => Items::SWIFTNESS_SPLASH_POTION(), - PotionType::LONG_SWIFTNESS()->id() => Items::LONG_SWIFTNESS_SPLASH_POTION(), - PotionType::STRONG_SWIFTNESS()->id() => Items::STRONG_SWIFTNESS_SPLASH_POTION(), - PotionType::SLOWNESS()->id() => Items::SLOWNESS_SPLASH_POTION(), - PotionType::LONG_SLOWNESS()->id() => Items::LONG_SLOWNESS_SPLASH_POTION(), - PotionType::WATER_BREATHING()->id() => Items::WATER_BREATHING_SPLASH_POTION(), - PotionType::LONG_WATER_BREATHING()->id() => Items::LONG_WATER_BREATHING_SPLASH_POTION(), - PotionType::HEALING()->id() => Items::HEALING_SPLASH_POTION(), - PotionType::STRONG_HEALING()->id() => Items::STRONG_HEALING_SPLASH_POTION(), - PotionType::HARMING()->id() => Items::HARMING_SPLASH_POTION(), - PotionType::STRONG_HARMING()->id() => Items::STRONG_HARMING_SPLASH_POTION(), - PotionType::POISON()->id() => Items::POISON_SPLASH_POTION(), - PotionType::LONG_POISON()->id() => Items::LONG_POISON_SPLASH_POTION(), - PotionType::STRONG_POISON()->id() => Items::STRONG_POISON_SPLASH_POTION(), - PotionType::REGENERATION()->id() => Items::REGENERATION_SPLASH_POTION(), - PotionType::LONG_REGENERATION()->id() => Items::LONG_REGENERATION_SPLASH_POTION(), - PotionType::STRONG_REGENERATION()->id() => Items::STRONG_REGENERATION_SPLASH_POTION(), - PotionType::STRENGTH()->id() => Items::STRENGTH_SPLASH_POTION(), - PotionType::LONG_STRENGTH()->id() => Items::LONG_STRENGTH_SPLASH_POTION(), - PotionType::STRONG_STRENGTH()->id() => Items::STRONG_STRENGTH_SPLASH_POTION(), - PotionType::WEAKNESS()->id() => Items::WEAKNESS_SPLASH_POTION(), - PotionType::LONG_WEAKNESS()->id() => Items::LONG_WEAKNESS_SPLASH_POTION(), - PotionType::WITHER()->id() => Items::WITHER_SPLASH_POTION(), - PotionType::TURTLE_MASTER()->id() => Items::TURTLE_MASTER_SPLASH_POTION(), - PotionType::LONG_TURTLE_MASTER()->id() => Items::LONG_TURTLE_MASTER_SPLASH_POTION(), - PotionType::STRONG_TURTLE_MASTER()->id() => Items::STRONG_TURTLE_MASTER_SPLASH_POTION(), - PotionType::SLOW_FALLING()->id() => Items::SLOW_FALLING_SPLASH_POTION(), - PotionType::LONG_SLOW_FALLING()->id() => Items::LONG_SLOW_FALLING_SPLASH_POTION(), - default => throw new ItemTypeDeserializeException("Unhandled potion type " . $potionType->getDisplayName()) - }; + return Items::SPLASH_POTION()->setType($potionType); }); $this->map(Ids::SPRUCE_BOAT, fn() => Items::SPRUCE_BOAT()); $this->map(Ids::SPRUCE_DOOR, fn() => Blocks::SPRUCE_DOOR()->asItem()); diff --git a/src/data/bedrock/item/ItemSerializer.php b/src/data/bedrock/item/ItemSerializer.php index ed8417734..e7f1601ab 100644 --- a/src/data/bedrock/item/ItemSerializer.php +++ b/src/data/bedrock/item/ItemSerializer.php @@ -38,7 +38,8 @@ use pocketmine\item\Banner; use pocketmine\item\CoralFan; use pocketmine\item\Item; use pocketmine\item\ItemBlock; -use pocketmine\item\PotionType; +use pocketmine\item\Potion; +use pocketmine\item\SplashPotion; use pocketmine\item\VanillaItems as Items; use pocketmine\utils\AssumptionFailedError; use function class_parents; @@ -236,22 +237,6 @@ final class ItemSerializer{ return fn() => new Data(Ids::COMPOUND, $type); } - /** - * @phpstan-return \Closure() : Data - */ - private static function potion(PotionType $type) : \Closure{ - $meta = PotionTypeIdMap::getInstance()->toId($type); - return fn() => new Data(Ids::POTION, $meta); - } - - /** - * @phpstan-return \Closure() : Data - */ - private static function splashPotion(PotionType $type) : \Closure{ - $meta = PotionTypeIdMap::getInstance()->toId($type); - return fn() => new Data(Ids::SPLASH_POTION, $meta); - } - private function registerSpecialBlockSerializers() : void{ $this->mapBlock(Blocks::ACACIA_DOOR(), self::id(Ids::ACACIA_DOOR)); $this->mapBlock(Blocks::BIRCH_DOOR(), self::id(Ids::BIRCH_DOOR)); @@ -283,8 +268,6 @@ final class ItemSerializer{ $this->map(Items::ACACIA_SIGN(), self::id(Ids::ACACIA_SIGN)); $this->map(Items::APPLE(), self::id(Ids::APPLE)); $this->map(Items::ARROW(), self::id(Ids::ARROW)); - $this->map(Items::AWKWARD_POTION(), self::potion(PotionType::AWKWARD())); - $this->map(Items::AWKWARD_SPLASH_POTION(), self::splashPotion(PotionType::AWKWARD())); $this->map(Items::BAKED_POTATO(), self::id(Ids::BAKED_POTATO)); $this->map(Items::BANNER(), fn(Banner $item) => new Data(Ids::BANNER, DyeColorIdMap::getInstance()->toInvertedId($item->getColor()))); $this->map(Items::BEETROOT(), self::id(Ids::BEETROOT)); @@ -392,8 +375,6 @@ final class ItemSerializer{ $this->map(Items::EXPERIENCE_BOTTLE(), self::id(Ids::EXPERIENCE_BOTTLE)); $this->map(Items::FEATHER(), self::id(Ids::FEATHER)); $this->map(Items::FERMENTED_SPIDER_EYE(), self::id(Ids::FERMENTED_SPIDER_EYE)); - $this->map(Items::FIRE_RESISTANCE_POTION(), self::potion(PotionType::FIRE_RESISTANCE())); - $this->map(Items::FIRE_RESISTANCE_SPLASH_POTION(), self::splashPotion(PotionType::FIRE_RESISTANCE())); $this->map(Items::FISHING_ROD(), self::id(Ids::FISHING_ROD)); $this->map(Items::FLINT(), self::id(Ids::FLINT)); $this->map(Items::FLINT_AND_STEEL(), self::id(Ids::FLINT_AND_STEEL)); @@ -419,14 +400,8 @@ final class ItemSerializer{ $this->map(Items::GREEN_BED(), self::bed(DyeColor::GREEN())); $this->map(Items::GREEN_DYE(), self::id(Ids::GREEN_DYE)); $this->map(Items::GUNPOWDER(), self::id(Ids::GUNPOWDER)); - $this->map(Items::HARMING_POTION(), self::potion(PotionType::HARMING())); - $this->map(Items::HARMING_SPLASH_POTION(), self::splashPotion(PotionType::HARMING())); - $this->map(Items::HEALING_POTION(), self::potion(PotionType::HEALING())); - $this->map(Items::HEALING_SPLASH_POTION(), self::splashPotion(PotionType::HEALING())); $this->map(Items::HEART_OF_THE_SEA(), self::id(Ids::HEART_OF_THE_SEA)); $this->map(Items::INK_SAC(), self::id(Ids::INK_SAC)); - $this->map(Items::INVISIBILITY_POTION(), self::potion(PotionType::INVISIBILITY())); - $this->map(Items::INVISIBILITY_SPLASH_POTION(), self::splashPotion(PotionType::INVISIBILITY())); $this->map(Items::IRON_AXE(), self::id(Ids::IRON_AXE)); $this->map(Items::IRON_BOOTS(), self::id(Ids::IRON_BOOTS)); $this->map(Items::IRON_CHESTPLATE(), self::id(Ids::IRON_CHESTPLATE)); @@ -442,8 +417,6 @@ final class ItemSerializer{ $this->map(Items::JUNGLE_SIGN(), self::id(Ids::JUNGLE_SIGN)); $this->map(Items::LAPIS_LAZULI(), self::id(Ids::LAPIS_LAZULI)); $this->map(Items::LAVA_BUCKET(), self::id(Ids::LAVA_BUCKET)); - $this->map(Items::LEAPING_POTION(), self::potion(PotionType::LEAPING())); - $this->map(Items::LEAPING_SPLASH_POTION(), self::splashPotion(PotionType::LEAPING())); $this->map(Items::LEATHER(), self::id(Ids::LEATHER)); $this->map(Items::LEATHER_BOOTS(), self::id(Ids::LEATHER_BOOTS)); $this->map(Items::LEATHER_CAP(), self::id(Ids::LEATHER_HELMET)); @@ -455,34 +428,6 @@ final class ItemSerializer{ $this->map(Items::LIGHT_GRAY_DYE(), self::id(Ids::LIGHT_GRAY_DYE)); $this->map(Items::LIME_BED(), self::bed(DyeColor::LIME())); $this->map(Items::LIME_DYE(), self::id(Ids::LIME_DYE)); - $this->map(Items::LONG_FIRE_RESISTANCE_POTION(), self::potion(PotionType::LONG_FIRE_RESISTANCE())); - $this->map(Items::LONG_FIRE_RESISTANCE_SPLASH_POTION(), self::splashPotion(PotionType::LONG_FIRE_RESISTANCE())); - $this->map(Items::LONG_INVISIBILITY_POTION(), self::potion(PotionType::LONG_INVISIBILITY())); - $this->map(Items::LONG_INVISIBILITY_SPLASH_POTION(), self::splashPotion(PotionType::LONG_INVISIBILITY())); - $this->map(Items::LONG_LEAPING_POTION(), self::potion(PotionType::LONG_LEAPING())); - $this->map(Items::LONG_LEAPING_SPLASH_POTION(), self::splashPotion(PotionType::LONG_LEAPING())); - $this->map(Items::LONG_MUNDANE_POTION(), self::potion(PotionType::LONG_MUNDANE())); - $this->map(Items::LONG_MUNDANE_SPLASH_POTION(), self::splashPotion(PotionType::LONG_MUNDANE())); - $this->map(Items::LONG_NIGHT_VISION_POTION(), self::potion(PotionType::LONG_NIGHT_VISION())); - $this->map(Items::LONG_NIGHT_VISION_SPLASH_POTION(), self::splashPotion(PotionType::LONG_NIGHT_VISION())); - $this->map(Items::LONG_POISON_POTION(), self::potion(PotionType::LONG_POISON())); - $this->map(Items::LONG_POISON_SPLASH_POTION(), self::splashPotion(PotionType::LONG_POISON())); - $this->map(Items::LONG_REGENERATION_POTION(), self::potion(PotionType::LONG_REGENERATION())); - $this->map(Items::LONG_REGENERATION_SPLASH_POTION(), self::splashPotion(PotionType::LONG_REGENERATION())); - $this->map(Items::LONG_SLOWNESS_POTION(), self::potion(PotionType::LONG_SLOWNESS())); - $this->map(Items::LONG_SLOWNESS_SPLASH_POTION(), self::splashPotion(PotionType::LONG_SLOWNESS())); - $this->map(Items::LONG_SLOW_FALLING_POTION(), self::potion(PotionType::LONG_SLOW_FALLING())); - $this->map(Items::LONG_SLOW_FALLING_SPLASH_POTION(), self::splashPotion(PotionType::LONG_SLOW_FALLING())); - $this->map(Items::LONG_STRENGTH_POTION(), self::potion(PotionType::LONG_STRENGTH())); - $this->map(Items::LONG_STRENGTH_SPLASH_POTION(), self::splashPotion(PotionType::LONG_STRENGTH())); - $this->map(Items::LONG_SWIFTNESS_POTION(), self::potion(PotionType::LONG_SWIFTNESS())); - $this->map(Items::LONG_SWIFTNESS_SPLASH_POTION(), self::splashPotion(PotionType::LONG_SWIFTNESS())); - $this->map(Items::LONG_TURTLE_MASTER_POTION(), self::potion(PotionType::LONG_TURTLE_MASTER())); - $this->map(Items::LONG_TURTLE_MASTER_SPLASH_POTION(), self::splashPotion(PotionType::LONG_TURTLE_MASTER())); - $this->map(Items::LONG_WATER_BREATHING_POTION(), self::potion(PotionType::LONG_WATER_BREATHING())); - $this->map(Items::LONG_WATER_BREATHING_SPLASH_POTION(), self::splashPotion(PotionType::LONG_WATER_BREATHING())); - $this->map(Items::LONG_WEAKNESS_POTION(), self::potion(PotionType::LONG_WEAKNESS())); - $this->map(Items::LONG_WEAKNESS_SPLASH_POTION(), self::splashPotion(PotionType::LONG_WEAKNESS())); $this->map(Items::MAGENTA_BED(), self::bed(DyeColor::MAGENTA())); $this->map(Items::MAGENTA_DYE(), self::id(Ids::MAGENTA_DYE)); $this->map(Items::MAGMA_CREAM(), self::id(Ids::MAGMA_CREAM)); @@ -490,15 +435,11 @@ final class ItemSerializer{ $this->map(Items::MELON_SEEDS(), self::id(Ids::MELON_SEEDS)); $this->map(Items::MILK_BUCKET(), self::id(Ids::MILK_BUCKET)); $this->map(Items::MINECART(), self::id(Ids::MINECART)); - $this->map(Items::MUNDANE_POTION(), self::potion(PotionType::MUNDANE())); - $this->map(Items::MUNDANE_SPLASH_POTION(), self::splashPotion(PotionType::MUNDANE())); $this->map(Items::MUSHROOM_STEW(), self::id(Ids::MUSHROOM_STEW)); $this->map(Items::NAUTILUS_SHELL(), self::id(Ids::NAUTILUS_SHELL)); $this->map(Items::NETHER_BRICK(), self::id(Ids::NETHERBRICK)); $this->map(Items::NETHER_QUARTZ(), self::id(Ids::QUARTZ)); $this->map(Items::NETHER_STAR(), self::id(Ids::NETHER_STAR)); - $this->map(Items::NIGHT_VISION_POTION(), self::potion(PotionType::NIGHT_VISION())); - $this->map(Items::NIGHT_VISION_SPLASH_POTION(), self::splashPotion(PotionType::NIGHT_VISION())); $this->map(Items::OAK_BOAT(), self::id(Ids::OAK_BOAT)); $this->map(Items::OAK_SIGN(), self::id(Ids::OAK_SIGN)); $this->map(Items::ORANGE_BED(), self::bed(DyeColor::ORANGE())); @@ -509,10 +450,9 @@ final class ItemSerializer{ $this->map(Items::PINK_DYE(), self::id(Ids::PINK_DYE)); $this->map(Items::PLAYER_HEAD(), self::skull(SkullType::PLAYER())); $this->map(Items::POISONOUS_POTATO(), self::id(Ids::POISONOUS_POTATO)); - $this->map(Items::POISON_POTION(), self::potion(PotionType::POISON())); - $this->map(Items::POISON_SPLASH_POTION(), self::splashPotion(PotionType::POISON())); $this->map(Items::POPPED_CHORUS_FRUIT(), self::id(Ids::POPPED_CHORUS_FRUIT)); $this->map(Items::POTATO(), self::id(Ids::POTATO)); + $this->map(Items::POTION(), fn(Potion $item) => new Data(Ids::POTION, PotionTypeIdMap::getInstance()->toId($item->getType()))); $this->map(Items::PRISMARINE_CRYSTALS(), self::id(Ids::PRISMARINE_CRYSTALS)); $this->map(Items::PRISMARINE_SHARD(), self::id(Ids::PRISMARINE_SHARD)); $this->map(Items::PUFFERFISH(), self::id(Ids::PUFFERFISH)); @@ -545,20 +485,15 @@ final class ItemSerializer{ $this->map(Items::REDSTONE_DUST(), self::id(Ids::REDSTONE)); $this->map(Items::RED_BED(), self::bed(DyeColor::RED())); $this->map(Items::RED_DYE(), self::id(Ids::RED_DYE)); - $this->map(Items::REGENERATION_POTION(), self::potion(PotionType::REGENERATION())); - $this->map(Items::REGENERATION_SPLASH_POTION(), self::splashPotion(PotionType::REGENERATION())); $this->map(Items::ROTTEN_FLESH(), self::id(Ids::ROTTEN_FLESH)); $this->map(Items::SCUTE(), self::id(Ids::SCUTE)); $this->map(Items::SHEARS(), self::id(Ids::SHEARS)); $this->map(Items::SHULKER_SHELL(), self::id(Ids::SHULKER_SHELL)); $this->map(Items::SKELETON_SKULL(), self::skull(SkullType::SKELETON())); $this->map(Items::SLIMEBALL(), self::id(Ids::SLIME_BALL)); - $this->map(Items::SLOWNESS_POTION(), self::potion(PotionType::SLOWNESS())); - $this->map(Items::SLOWNESS_SPLASH_POTION(), self::splashPotion(PotionType::SLOWNESS())); - $this->map(Items::SLOW_FALLING_POTION(), self::potion(PotionType::SLOW_FALLING())); - $this->map(Items::SLOW_FALLING_SPLASH_POTION(), self::splashPotion(PotionType::SLOW_FALLING())); $this->map(Items::SNOWBALL(), self::id(Ids::SNOWBALL)); $this->map(Items::SPIDER_EYE(), self::id(Ids::SPIDER_EYE)); + $this->map(Items::SPLASH_POTION(), fn(SplashPotion $item) => new Data(Ids::SPLASH_POTION, PotionTypeIdMap::getInstance()->toId($item->getType()))); $this->map(Items::SPRUCE_BOAT(), self::id(Ids::SPRUCE_BOAT)); $this->map(Items::SPRUCE_SIGN(), self::id(Ids::SPRUCE_SIGN)); $this->map(Items::SQUID_SPAWN_EGG(), self::id(Ids::SQUID_SPAWN_EGG)); @@ -569,49 +504,17 @@ final class ItemSerializer{ $this->map(Items::STONE_PICKAXE(), self::id(Ids::STONE_PICKAXE)); $this->map(Items::STONE_SHOVEL(), self::id(Ids::STONE_SHOVEL)); $this->map(Items::STONE_SWORD(), self::id(Ids::STONE_SWORD)); - $this->map(Items::STRENGTH_POTION(), self::potion(PotionType::STRENGTH())); - $this->map(Items::STRENGTH_SPLASH_POTION(), self::splashPotion(PotionType::STRENGTH())); $this->map(Items::STRING(), self::id(Ids::STRING)); - $this->map(Items::STRONG_HARMING_POTION(), self::potion(PotionType::STRONG_HARMING())); - $this->map(Items::STRONG_HARMING_SPLASH_POTION(), self::splashPotion(PotionType::STRONG_HARMING())); - $this->map(Items::STRONG_HEALING_POTION(), self::potion(PotionType::STRONG_HEALING())); - $this->map(Items::STRONG_HEALING_SPLASH_POTION(), self::splashPotion(PotionType::STRONG_HEALING())); - $this->map(Items::STRONG_LEAPING_POTION(), self::potion(PotionType::STRONG_LEAPING())); - $this->map(Items::STRONG_LEAPING_SPLASH_POTION(), self::splashPotion(PotionType::STRONG_LEAPING())); - $this->map(Items::STRONG_POISON_POTION(), self::potion(PotionType::STRONG_POISON())); - $this->map(Items::STRONG_POISON_SPLASH_POTION(), self::splashPotion(PotionType::STRONG_POISON())); - $this->map(Items::STRONG_REGENERATION_POTION(), self::potion(PotionType::STRONG_REGENERATION())); - $this->map(Items::STRONG_REGENERATION_SPLASH_POTION(), self::splashPotion(PotionType::STRONG_REGENERATION())); - $this->map(Items::STRONG_STRENGTH_POTION(), self::potion(PotionType::STRONG_STRENGTH())); - $this->map(Items::STRONG_STRENGTH_SPLASH_POTION(), self::splashPotion(PotionType::STRONG_STRENGTH())); - $this->map(Items::STRONG_SWIFTNESS_POTION(), self::potion(PotionType::STRONG_SWIFTNESS())); - $this->map(Items::STRONG_SWIFTNESS_SPLASH_POTION(), self::splashPotion(PotionType::STRONG_SWIFTNESS())); - $this->map(Items::STRONG_TURTLE_MASTER_POTION(), self::potion(PotionType::STRONG_TURTLE_MASTER())); - $this->map(Items::STRONG_TURTLE_MASTER_SPLASH_POTION(), self::splashPotion(PotionType::STRONG_TURTLE_MASTER())); $this->map(Items::SUGAR(), self::id(Ids::SUGAR)); $this->map(Items::SWEET_BERRIES(), self::id(Ids::SWEET_BERRIES)); - $this->map(Items::SWIFTNESS_POTION(), self::potion(PotionType::SWIFTNESS())); - $this->map(Items::SWIFTNESS_SPLASH_POTION(), self::splashPotion(PotionType::SWIFTNESS())); - $this->map(Items::THICK_POTION(), self::potion(PotionType::THICK())); - $this->map(Items::THICK_SPLASH_POTION(), self::splashPotion(PotionType::THICK())); $this->map(Items::TOTEM(), self::id(Ids::TOTEM_OF_UNDYING)); - $this->map(Items::TURTLE_MASTER_POTION(), self::potion(PotionType::TURTLE_MASTER())); - $this->map(Items::TURTLE_MASTER_SPLASH_POTION(), self::splashPotion(PotionType::TURTLE_MASTER())); $this->map(Items::VILLAGER_SPAWN_EGG(), self::id(Ids::VILLAGER_SPAWN_EGG)); - $this->map(Items::WATER_BREATHING_POTION(), self::potion(PotionType::WATER_BREATHING())); - $this->map(Items::WATER_BREATHING_SPLASH_POTION(), self::splashPotion(PotionType::WATER_BREATHING())); $this->map(Items::WATER_BUCKET(), self::id(Ids::WATER_BUCKET)); - $this->map(Items::WATER_POTION(), self::potion(PotionType::WATER())); - $this->map(Items::WATER_SPLASH_POTION(), self::splashPotion(PotionType::WATER())); - $this->map(Items::WEAKNESS_POTION(), self::potion(PotionType::WEAKNESS())); - $this->map(Items::WEAKNESS_SPLASH_POTION(), self::splashPotion(PotionType::WEAKNESS())); $this->map(Items::WHEAT(), self::id(Ids::WHEAT)); $this->map(Items::WHEAT_SEEDS(), self::id(Ids::WHEAT_SEEDS)); $this->map(Items::WHITE_BED(), self::bed(DyeColor::WHITE())); $this->map(Items::WHITE_DYE(), self::id(Ids::WHITE_DYE)); - $this->map(Items::WITHER_POTION(), self::potion(PotionType::WITHER())); $this->map(Items::WITHER_SKELETON_SKULL(), self::skull(SkullType::WITHER_SKELETON())); - $this->map(Items::WITHER_SPLASH_POTION(), self::splashPotion(PotionType::WITHER())); $this->map(Items::WOODEN_AXE(), self::id(Ids::WOODEN_AXE)); $this->map(Items::WOODEN_HOE(), self::id(Ids::WOODEN_HOE)); $this->map(Items::WOODEN_PICKAXE(), self::id(Ids::WOODEN_PICKAXE)); diff --git a/src/item/ItemFactory.php b/src/item/ItemFactory.php index c9c45003b..e4eb558ac 100644 --- a/src/item/ItemFactory.php +++ b/src/item/ItemFactory.php @@ -35,7 +35,6 @@ use pocketmine\data\bedrock\block\BlockStateDeserializeException; use pocketmine\data\bedrock\CompoundTypeIds; use pocketmine\data\bedrock\DyeColorIdMap; use pocketmine\data\bedrock\EntityLegacyIds; -use pocketmine\data\bedrock\PotionTypeIdMap; use pocketmine\data\SavedDataLoadingException; use pocketmine\entity\Entity; use pocketmine\entity\Location; @@ -291,9 +290,8 @@ class ItemFactory{ } foreach(PotionType::getAll() as $type){ - $typeId = PotionTypeIdMap::getInstance()->toId($type); - $this->register(new Potion(new IID(Ids::POTION, $typeId), $type->getDisplayName() . " Potion", $type)); - $this->register(new SplashPotion(new IID(Ids::SPLASH_POTION, $typeId), $type->getDisplayName() . " Splash Potion", $type)); + $this->register((new Potion(new IID(Ids::POTION, 0), "Potion"))->setType($type)); + $this->register((new SplashPotion(new IID(Ids::SPLASH_POTION, 0), "Splash Potion"))->setType($type)); } foreach(TreeType::getAll() as $type){ diff --git a/src/item/Potion.php b/src/item/Potion.php index 1255a5396..3607e5619 100644 --- a/src/item/Potion.php +++ b/src/item/Potion.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace pocketmine\item; +use pocketmine\data\bedrock\PotionTypeIdMap; use pocketmine\entity\Living; use pocketmine\player\Player; @@ -30,13 +31,25 @@ class Potion extends Item implements ConsumableItem{ private PotionType $potionType; - public function __construct(ItemIdentifier $identifier, string $name, PotionType $potionType){ + public function __construct(ItemIdentifier $identifier, string $name){ + $this->potionType = PotionType::WATER(); parent::__construct($identifier, $name); - $this->potionType = $potionType; + } + + public function getMeta() : int{ + return PotionTypeIdMap::getInstance()->toId($this->potionType); } public function getType() : PotionType{ return $this->potionType; } + /** + * @return $this + */ + public function setType(PotionType $type) : self{ + $this->potionType = $type; + return $this; + } + public function getMaxStackSize() : int{ return 1; } diff --git a/src/item/SplashPotion.php b/src/item/SplashPotion.php index be5952306..39db4d6d7 100644 --- a/src/item/SplashPotion.php +++ b/src/item/SplashPotion.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace pocketmine\item; +use pocketmine\data\bedrock\PotionTypeIdMap; use pocketmine\entity\Location; use pocketmine\entity\projectile\SplashPotion as SplashPotionEntity; use pocketmine\entity\projectile\Throwable; @@ -32,13 +33,25 @@ class SplashPotion extends ProjectileItem{ private PotionType $potionType; - public function __construct(ItemIdentifier $identifier, string $name, PotionType $potionType){ + public function __construct(ItemIdentifier $identifier, string $name){ + $this->potionType = PotionType::WATER(); parent::__construct($identifier, $name); - $this->potionType = $potionType; + } + + public function getMeta() : int{ + return PotionTypeIdMap::getInstance()->toId($this->potionType); } public function getType() : PotionType{ return $this->potionType; } + /** + * @return $this + */ + public function setType(PotionType $type) : self{ + $this->potionType = $type; + return $this; + } + public function getMaxStackSize() : int{ return 1; } diff --git a/src/item/StringToItemParser.php b/src/item/StringToItemParser.php index 2e33d4853..a6824ccd7 100644 --- a/src/item/StringToItemParser.php +++ b/src/item/StringToItemParser.php @@ -950,8 +950,8 @@ final class StringToItemParser extends StringToTParser{ $result->register("apple_enchanted", fn() => Items::ENCHANTED_GOLDEN_APPLE()); $result->register("appleenchanted", fn() => Items::ENCHANTED_GOLDEN_APPLE()); $result->register("arrow", fn() => Items::ARROW()); - $result->register("awkward_potion", fn() => Items::AWKWARD_POTION()); - $result->register("awkward_splash_potion", fn() => Items::AWKWARD_SPLASH_POTION()); + $result->register("awkward_potion", fn() => Items::POTION()->setType(PotionType::AWKWARD())); + $result->register("awkward_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::AWKWARD())); $result->register("baked_potato", fn() => Items::BAKED_POTATO()); $result->register("baked_potatoes", fn() => Items::BAKED_POTATO()); $result->register("bed", fn() => Items::WHITE_BED()); @@ -1072,8 +1072,8 @@ final class StringToItemParser extends StringToTParser{ $result->register("experience_bottle", fn() => Items::EXPERIENCE_BOTTLE()); $result->register("feather", fn() => Items::FEATHER()); $result->register("fermented_spider_eye", fn() => Items::FERMENTED_SPIDER_EYE()); - $result->register("fire_resistance_potion", fn() => Items::FIRE_RESISTANCE_POTION()); - $result->register("fire_resistance_splash_potion", fn() => Items::FIRE_RESISTANCE_SPLASH_POTION()); + $result->register("fire_resistance_potion", fn() => Items::POTION()->setType(PotionType::FIRE_RESISTANCE())); + $result->register("fire_resistance_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::FIRE_RESISTANCE())); $result->register("fish", fn() => Items::RAW_FISH()); $result->register("fishing_rod", fn() => Items::FISHING_ROD()); $result->register("flint", fn() => Items::FLINT()); @@ -1109,14 +1109,14 @@ final class StringToItemParser extends StringToTParser{ $result->register("gray_dye", fn() => Items::GRAY_DYE()); $result->register("green_dye", fn() => Items::GREEN_DYE()); $result->register("gunpowder", fn() => Items::GUNPOWDER()); - $result->register("harming_potion", fn() => Items::HARMING_POTION()); - $result->register("harming_splash_potion", fn() => Items::HARMING_SPLASH_POTION()); - $result->register("healing_potion", fn() => Items::HEALING_POTION()); - $result->register("healing_splash_potion", fn() => Items::HEALING_SPLASH_POTION()); + $result->register("harming_potion", fn() => Items::POTION()->setType(PotionType::HARMING())); + $result->register("harming_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::HARMING())); + $result->register("healing_potion", fn() => Items::POTION()->setType(PotionType::HEALING())); + $result->register("healing_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::HEALING())); $result->register("heart_of_the_sea", fn() => Items::HEART_OF_THE_SEA()); $result->register("ink_sac", fn() => Items::INK_SAC()); - $result->register("invisibility_potion", fn() => Items::INVISIBILITY_POTION()); - $result->register("invisibility_splash_potion", fn() => Items::INVISIBILITY_SPLASH_POTION()); + $result->register("invisibility_potion", fn() => Items::POTION()->setType(PotionType::INVISIBILITY())); + $result->register("invisibility_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::INVISIBILITY())); $result->register("iron_axe", fn() => Items::IRON_AXE()); $result->register("iron_boots", fn() => Items::IRON_BOOTS()); $result->register("iron_chestplate", fn() => Items::IRON_CHESTPLATE()); @@ -1131,8 +1131,8 @@ final class StringToItemParser extends StringToTParser{ $result->register("jungle_boat", fn() => Items::JUNGLE_BOAT()); $result->register("lapis_lazuli", fn() => Items::LAPIS_LAZULI()); $result->register("lava_bucket", fn() => Items::LAVA_BUCKET()); - $result->register("leaping_potion", fn() => Items::LEAPING_POTION()); - $result->register("leaping_splash_potion", fn() => Items::LEAPING_SPLASH_POTION()); + $result->register("leaping_potion", fn() => Items::POTION()->setType(PotionType::LEAPING())); + $result->register("leaping_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LEAPING())); $result->register("leather", fn() => Items::LEATHER()); $result->register("leather_boots", fn() => Items::LEATHER_BOOTS()); $result->register("leather_cap", fn() => Items::LEATHER_CAP()); @@ -1144,34 +1144,34 @@ final class StringToItemParser extends StringToTParser{ $result->register("light_blue_dye", fn() => Items::LIGHT_BLUE_DYE()); $result->register("light_gray_dye", fn() => Items::LIGHT_GRAY_DYE()); $result->register("lime_dye", fn() => Items::LIME_DYE()); - $result->register("long_fire_resistance_potion", fn() => Items::LONG_FIRE_RESISTANCE_POTION()); - $result->register("long_fire_resistance_splash_potion", fn() => Items::LONG_FIRE_RESISTANCE_SPLASH_POTION()); - $result->register("long_invisibility_potion", fn() => Items::LONG_INVISIBILITY_POTION()); - $result->register("long_invisibility_splash_potion", fn() => Items::LONG_INVISIBILITY_SPLASH_POTION()); - $result->register("long_leaping_potion", fn() => Items::LONG_LEAPING_POTION()); - $result->register("long_leaping_splash_potion", fn() => Items::LONG_LEAPING_SPLASH_POTION()); - $result->register("long_mundane_potion", fn() => Items::LONG_MUNDANE_POTION()); - $result->register("long_mundane_splash_potion", fn() => Items::LONG_MUNDANE_SPLASH_POTION()); - $result->register("long_night_vision_potion", fn() => Items::LONG_NIGHT_VISION_POTION()); - $result->register("long_night_vision_splash_potion", fn() => Items::LONG_NIGHT_VISION_SPLASH_POTION()); - $result->register("long_poison_potion", fn() => Items::LONG_POISON_POTION()); - $result->register("long_poison_splash_potion", fn() => Items::LONG_POISON_SPLASH_POTION()); - $result->register("long_regeneration_potion", fn() => Items::LONG_REGENERATION_POTION()); - $result->register("long_regeneration_splash_potion", fn() => Items::LONG_REGENERATION_SPLASH_POTION()); - $result->register("long_slow_falling_potion", fn() => Items::LONG_SLOW_FALLING_POTION()); - $result->register("long_slow_falling_splash_potion", fn() => Items::LONG_SLOW_FALLING_SPLASH_POTION()); - $result->register("long_slowness_potion", fn() => Items::LONG_SLOWNESS_POTION()); - $result->register("long_slowness_splash_potion", fn() => Items::LONG_SLOWNESS_SPLASH_POTION()); - $result->register("long_strength_potion", fn() => Items::LONG_STRENGTH_POTION()); - $result->register("long_strength_splash_potion", fn() => Items::LONG_STRENGTH_SPLASH_POTION()); - $result->register("long_swiftness_potion", fn() => Items::LONG_SWIFTNESS_POTION()); - $result->register("long_swiftness_splash_potion", fn() => Items::LONG_SWIFTNESS_SPLASH_POTION()); - $result->register("long_turtle_master_potion", fn() => Items::LONG_TURTLE_MASTER_POTION()); - $result->register("long_turtle_master_splash_potion", fn() => Items::LONG_TURTLE_MASTER_SPLASH_POTION()); - $result->register("long_water_breathing_potion", fn() => Items::LONG_WATER_BREATHING_POTION()); - $result->register("long_water_breathing_splash_potion", fn() => Items::LONG_WATER_BREATHING_SPLASH_POTION()); - $result->register("long_weakness_potion", fn() => Items::LONG_WEAKNESS_POTION()); - $result->register("long_weakness_splash_potion", fn() => Items::LONG_WEAKNESS_SPLASH_POTION()); + $result->register("long_fire_resistance_potion", fn() => Items::POTION()->setType(PotionType::LONG_FIRE_RESISTANCE())); + $result->register("long_fire_resistance_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_FIRE_RESISTANCE())); + $result->register("long_invisibility_potion", fn() => Items::POTION()->setType(PotionType::LONG_INVISIBILITY())); + $result->register("long_invisibility_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_INVISIBILITY())); + $result->register("long_leaping_potion", fn() => Items::POTION()->setType(PotionType::LONG_LEAPING())); + $result->register("long_leaping_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_LEAPING())); + $result->register("long_mundane_potion", fn() => Items::POTION()->setType(PotionType::LONG_MUNDANE())); + $result->register("long_mundane_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_MUNDANE())); + $result->register("long_night_vision_potion", fn() => Items::POTION()->setType(PotionType::LONG_NIGHT_VISION())); + $result->register("long_night_vision_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_NIGHT_VISION())); + $result->register("long_poison_potion", fn() => Items::POTION()->setType(PotionType::LONG_POISON())); + $result->register("long_poison_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_POISON())); + $result->register("long_regeneration_potion", fn() => Items::POTION()->setType(PotionType::LONG_REGENERATION())); + $result->register("long_regeneration_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_REGENERATION())); + $result->register("long_slow_falling_potion", fn() => Items::POTION()->setType(PotionType::LONG_SLOW_FALLING())); + $result->register("long_slow_falling_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_SLOW_FALLING())); + $result->register("long_slowness_potion", fn() => Items::POTION()->setType(PotionType::LONG_SLOWNESS())); + $result->register("long_slowness_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_SLOWNESS())); + $result->register("long_strength_potion", fn() => Items::POTION()->setType(PotionType::LONG_STRENGTH())); + $result->register("long_strength_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_STRENGTH())); + $result->register("long_swiftness_potion", fn() => Items::POTION()->setType(PotionType::LONG_SWIFTNESS())); + $result->register("long_swiftness_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_SWIFTNESS())); + $result->register("long_turtle_master_potion", fn() => Items::POTION()->setType(PotionType::LONG_TURTLE_MASTER())); + $result->register("long_turtle_master_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_TURTLE_MASTER())); + $result->register("long_water_breathing_potion", fn() => Items::POTION()->setType(PotionType::LONG_WATER_BREATHING())); + $result->register("long_water_breathing_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_WATER_BREATHING())); + $result->register("long_weakness_potion", fn() => Items::POTION()->setType(PotionType::LONG_WEAKNESS())); + $result->register("long_weakness_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_WEAKNESS())); $result->register("magenta_dye", fn() => Items::MAGENTA_DYE()); $result->register("magma_cream", fn() => Items::MAGMA_CREAM()); $result->register("melon", fn() => Items::MELON()); @@ -1180,8 +1180,8 @@ final class StringToItemParser extends StringToTParser{ $result->register("milk_bucket", fn() => Items::MILK_BUCKET()); $result->register("minecart", fn() => Items::MINECART()); $result->register("mob_head", fn() => Items::SKELETON_SKULL()); - $result->register("mundane_potion", fn() => Items::MUNDANE_POTION()); - $result->register("mundane_splash_potion", fn() => Items::MUNDANE_SPLASH_POTION()); + $result->register("mundane_potion", fn() => Items::POTION()->setType(PotionType::MUNDANE())); + $result->register("mundane_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::MUNDANE())); $result->register("mushroom_stew", fn() => Items::MUSHROOM_STEW()); $result->register("mutton", fn() => Items::RAW_MUTTON()); $result->register("mutton_cooked", fn() => Items::COOKED_MUTTON()); @@ -1194,21 +1194,21 @@ final class StringToItemParser extends StringToTParser{ $result->register("nether_star", fn() => Items::NETHER_STAR()); $result->register("netherbrick", fn() => Items::NETHER_BRICK()); $result->register("netherstar", fn() => Items::NETHER_STAR()); - $result->register("night_vision_potion", fn() => Items::NIGHT_VISION_POTION()); - $result->register("night_vision_splash_potion", fn() => Items::NIGHT_VISION_SPLASH_POTION()); + $result->register("night_vision_potion", fn() => Items::POTION()->setType(PotionType::NIGHT_VISION())); + $result->register("night_vision_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::NIGHT_VISION())); $result->register("oak_boat", fn() => Items::OAK_BOAT()); $result->register("orange_dye", fn() => Items::ORANGE_DYE()); $result->register("painting", fn() => Items::PAINTING()); $result->register("paper", fn() => Items::PAPER()); $result->register("pink_dye", fn() => Items::PINK_DYE()); $result->register("player_head", fn() => Items::PLAYER_HEAD()); - $result->register("poison_potion", fn() => Items::POISON_POTION()); - $result->register("poison_splash_potion", fn() => Items::POISON_SPLASH_POTION()); + $result->register("poison_potion", fn() => Items::POTION()->setType(PotionType::POISON())); + $result->register("poison_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::POISON())); $result->register("poisonous_potato", fn() => Items::POISONOUS_POTATO()); $result->register("popped_chorus_fruit", fn() => Items::POPPED_CHORUS_FRUIT()); $result->register("porkchop", fn() => Items::RAW_PORKCHOP()); $result->register("potato", fn() => Items::POTATO()); - $result->register("potion", fn() => Items::WATER_POTION()); + $result->register("potion", fn() => Items::POTION()); $result->register("prismarine_crystals", fn() => Items::PRISMARINE_CRYSTALS()); $result->register("prismarine_shard", fn() => Items::PRISMARINE_SHARD()); $result->register("puffer_fish", fn() => Items::PUFFERFISH()); @@ -1244,8 +1244,8 @@ final class StringToItemParser extends StringToTParser{ $result->register("red_dye", fn() => Items::RED_DYE()); $result->register("redstone", fn() => Items::REDSTONE_DUST()); $result->register("redstone_dust", fn() => Items::REDSTONE_DUST()); - $result->register("regeneration_potion", fn() => Items::REGENERATION_POTION()); - $result->register("regeneration_splash_potion", fn() => Items::REGENERATION_SPLASH_POTION()); + $result->register("regeneration_potion", fn() => Items::POTION()->setType(PotionType::REGENERATION())); + $result->register("regeneration_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::REGENERATION())); $result->register("rotten_flesh", fn() => Items::ROTTEN_FLESH()); $result->register("salmon", fn() => Items::RAW_SALMON()); $result->register("scute", fn() => Items::SCUTE()); @@ -1256,14 +1256,14 @@ final class StringToItemParser extends StringToTParser{ $result->register("skull", fn() => Items::SKELETON_SKULL()); $result->register("slime_ball", fn() => Items::SLIMEBALL()); $result->register("slimeball", fn() => Items::SLIMEBALL()); - $result->register("slow_falling_potion", fn() => Items::SLOW_FALLING_POTION()); - $result->register("slow_falling_splash_potion", fn() => Items::SLOW_FALLING_SPLASH_POTION()); - $result->register("slowness_potion", fn() => Items::SLOWNESS_POTION()); - $result->register("slowness_splash_potion", fn() => Items::SLOWNESS_SPLASH_POTION()); + $result->register("slow_falling_potion", fn() => Items::POTION()->setType(PotionType::SLOW_FALLING())); + $result->register("slow_falling_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::SLOW_FALLING())); + $result->register("slowness_potion", fn() => Items::POTION()->setType(PotionType::SLOWNESS())); + $result->register("slowness_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::SLOWNESS())); $result->register("snowball", fn() => Items::SNOWBALL()); $result->register("speckled_melon", fn() => Items::GLISTERING_MELON()); $result->register("spider_eye", fn() => Items::SPIDER_EYE()); - $result->register("splash_potion", fn() => Items::WATER_SPLASH_POTION()); + $result->register("splash_potion", fn() => Items::SPLASH_POTION()); $result->register("spruce_boat", fn() => Items::SPRUCE_BOAT()); $result->register("squid_spawn_egg", fn() => Items::SQUID_SPAWN_EGG()); $result->register("steak", fn() => Items::STEAK()); @@ -1274,49 +1274,49 @@ final class StringToItemParser extends StringToTParser{ $result->register("stone_pickaxe", fn() => Items::STONE_PICKAXE()); $result->register("stone_shovel", fn() => Items::STONE_SHOVEL()); $result->register("stone_sword", fn() => Items::STONE_SWORD()); - $result->register("strength_potion", fn() => Items::STRENGTH_POTION()); - $result->register("strength_splash_potion", fn() => Items::STRENGTH_SPLASH_POTION()); + $result->register("strength_potion", fn() => Items::POTION()->setType(PotionType::STRENGTH())); + $result->register("strength_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::STRENGTH())); $result->register("string", fn() => Items::STRING()); - $result->register("strong_harming_potion", fn() => Items::STRONG_HARMING_POTION()); - $result->register("strong_harming_splash_potion", fn() => Items::STRONG_HARMING_SPLASH_POTION()); - $result->register("strong_healing_potion", fn() => Items::STRONG_HEALING_POTION()); - $result->register("strong_healing_splash_potion", fn() => Items::STRONG_HEALING_SPLASH_POTION()); - $result->register("strong_leaping_potion", fn() => Items::STRONG_LEAPING_POTION()); - $result->register("strong_leaping_splash_potion", fn() => Items::STRONG_LEAPING_SPLASH_POTION()); - $result->register("strong_poison_potion", fn() => Items::STRONG_POISON_POTION()); - $result->register("strong_poison_splash_potion", fn() => Items::STRONG_POISON_SPLASH_POTION()); - $result->register("strong_regeneration_potion", fn() => Items::STRONG_REGENERATION_POTION()); - $result->register("strong_regeneration_splash_potion", fn() => Items::STRONG_REGENERATION_SPLASH_POTION()); - $result->register("strong_strength_potion", fn() => Items::STRONG_STRENGTH_POTION()); - $result->register("strong_strength_splash_potion", fn() => Items::STRONG_STRENGTH_SPLASH_POTION()); - $result->register("strong_swiftness_potion", fn() => Items::STRONG_SWIFTNESS_POTION()); - $result->register("strong_swiftness_splash_potion", fn() => Items::STRONG_SWIFTNESS_SPLASH_POTION()); - $result->register("strong_turtle_master_potion", fn() => Items::STRONG_TURTLE_MASTER_POTION()); - $result->register("strong_turtle_master_splash_potion", fn() => Items::STRONG_TURTLE_MASTER_SPLASH_POTION()); + $result->register("strong_harming_potion", fn() => Items::POTION()->setType(PotionType::STRONG_HARMING())); + $result->register("strong_harming_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::STRONG_HARMING())); + $result->register("strong_healing_potion", fn() => Items::POTION()->setType(PotionType::STRONG_HEALING())); + $result->register("strong_healing_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::STRONG_HEALING())); + $result->register("strong_leaping_potion", fn() => Items::POTION()->setType(PotionType::STRONG_LEAPING())); + $result->register("strong_leaping_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::STRONG_LEAPING())); + $result->register("strong_poison_potion", fn() => Items::POTION()->setType(PotionType::STRONG_POISON())); + $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_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())); + $result->register("strong_swiftness_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::STRONG_SWIFTNESS())); + $result->register("strong_turtle_master_potion", fn() => Items::POTION()->setType(PotionType::STRONG_TURTLE_MASTER())); + $result->register("strong_turtle_master_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::STRONG_TURTLE_MASTER())); $result->register("sugar", fn() => Items::SUGAR()); $result->register("sweet_berries", fn() => Items::SWEET_BERRIES()); - $result->register("swiftness_potion", fn() => Items::SWIFTNESS_POTION()); - $result->register("swiftness_splash_potion", fn() => Items::SWIFTNESS_SPLASH_POTION()); - $result->register("thick_potion", fn() => Items::THICK_POTION()); - $result->register("thick_splash_potion", fn() => Items::THICK_SPLASH_POTION()); + $result->register("swiftness_potion", fn() => Items::POTION()->setType(PotionType::SWIFTNESS())); + $result->register("swiftness_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::SWIFTNESS())); + $result->register("thick_potion", fn() => Items::POTION()->setType(PotionType::THICK())); + $result->register("thick_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::THICK())); $result->register("totem", fn() => Items::TOTEM()); - $result->register("turtle_master_potion", fn() => Items::TURTLE_MASTER_POTION()); - $result->register("turtle_master_splash_potion", fn() => Items::TURTLE_MASTER_SPLASH_POTION()); + $result->register("turtle_master_potion", fn() => Items::POTION()->setType(PotionType::TURTLE_MASTER())); + $result->register("turtle_master_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::TURTLE_MASTER())); $result->register("turtle_shell_piece", fn() => Items::SCUTE()); $result->register("villager_spawn_egg", fn() => Items::VILLAGER_SPAWN_EGG()); - $result->register("water_breathing_potion", fn() => Items::WATER_BREATHING_POTION()); - $result->register("water_breathing_splash_potion", fn() => Items::WATER_BREATHING_SPLASH_POTION()); + $result->register("water_breathing_potion", fn() => Items::POTION()->setType(PotionType::WATER_BREATHING())); + $result->register("water_breathing_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::WATER_BREATHING())); $result->register("water_bucket", fn() => Items::WATER_BUCKET()); - $result->register("water_potion", fn() => Items::WATER_POTION()); - $result->register("water_splash_potion", fn() => Items::WATER_SPLASH_POTION()); - $result->register("weakness_potion", fn() => Items::WEAKNESS_POTION()); - $result->register("weakness_splash_potion", fn() => Items::WEAKNESS_SPLASH_POTION()); + $result->register("water_potion", fn() => Items::POTION()->setType(PotionType::WATER())); + $result->register("water_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::WATER())); + $result->register("weakness_potion", fn() => Items::POTION()->setType(PotionType::WEAKNESS())); + $result->register("weakness_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::WEAKNESS())); $result->register("wheat", fn() => Items::WHEAT()); $result->register("wheat_seeds", fn() => Items::WHEAT_SEEDS()); $result->register("white_dye", fn() => Items::WHITE_DYE()); - $result->register("wither_potion", fn() => Items::WITHER_POTION()); + $result->register("wither_potion", fn() => Items::POTION()->setType(PotionType::WITHER())); $result->register("wither_skeleton_skull", fn() => Items::WITHER_SKELETON_SKULL()); - $result->register("wither_splash_potion", fn() => Items::WITHER_SPLASH_POTION()); + $result->register("wither_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::WITHER())); $result->register("wooden_axe", fn() => Items::WOODEN_AXE()); $result->register("wooden_hoe", fn() => Items::WOODEN_HOE()); $result->register("wooden_pickaxe", fn() => Items::WOODEN_PICKAXE()); diff --git a/src/item/VanillaItems.php b/src/item/VanillaItems.php index 1a569ca9e..f220e512b 100644 --- a/src/item/VanillaItems.php +++ b/src/item/VanillaItems.php @@ -37,8 +37,6 @@ use pocketmine\utils\CloningRegistryTrait; * @method static ItemBlock AIR() * @method static Apple APPLE() * @method static Arrow ARROW() - * @method static Potion AWKWARD_POTION() - * @method static SplashPotion AWKWARD_SPLASH_POTION() * @method static BakedPotato BAKED_POTATO() * @method static Bamboo BAMBOO() * @method static Banner BANNER() @@ -148,8 +146,6 @@ use pocketmine\utils\CloningRegistryTrait; * @method static ExperienceBottle EXPERIENCE_BOTTLE() * @method static Item FEATHER() * @method static Item FERMENTED_SPIDER_EYE() - * @method static Potion FIRE_RESISTANCE_POTION() - * @method static SplashPotion FIRE_RESISTANCE_SPLASH_POTION() * @method static FishingRod FISHING_ROD() * @method static Item FLINT() * @method static FlintSteel FLINT_AND_STEEL() @@ -175,14 +171,8 @@ use pocketmine\utils\CloningRegistryTrait; * @method static Bed GREEN_BED() * @method static Dye GREEN_DYE() * @method static Item GUNPOWDER() - * @method static Potion HARMING_POTION() - * @method static SplashPotion HARMING_SPLASH_POTION() - * @method static Potion HEALING_POTION() - * @method static SplashPotion HEALING_SPLASH_POTION() * @method static Item HEART_OF_THE_SEA() * @method static Item INK_SAC() - * @method static Potion INVISIBILITY_POTION() - * @method static SplashPotion INVISIBILITY_SPLASH_POTION() * @method static Axe IRON_AXE() * @method static Armor IRON_BOOTS() * @method static Armor IRON_CHESTPLATE() @@ -198,8 +188,6 @@ use pocketmine\utils\CloningRegistryTrait; * @method static ItemBlockWallOrFloor JUNGLE_SIGN() * @method static Item LAPIS_LAZULI() * @method static LiquidBucket LAVA_BUCKET() - * @method static Potion LEAPING_POTION() - * @method static SplashPotion LEAPING_SPLASH_POTION() * @method static Item LEATHER() * @method static Armor LEATHER_BOOTS() * @method static Armor LEATHER_CAP() @@ -211,34 +199,6 @@ use pocketmine\utils\CloningRegistryTrait; * @method static Dye LIGHT_GRAY_DYE() * @method static Bed LIME_BED() * @method static Dye LIME_DYE() - * @method static Potion LONG_FIRE_RESISTANCE_POTION() - * @method static SplashPotion LONG_FIRE_RESISTANCE_SPLASH_POTION() - * @method static Potion LONG_INVISIBILITY_POTION() - * @method static SplashPotion LONG_INVISIBILITY_SPLASH_POTION() - * @method static Potion LONG_LEAPING_POTION() - * @method static SplashPotion LONG_LEAPING_SPLASH_POTION() - * @method static Potion LONG_MUNDANE_POTION() - * @method static SplashPotion LONG_MUNDANE_SPLASH_POTION() - * @method static Potion LONG_NIGHT_VISION_POTION() - * @method static SplashPotion LONG_NIGHT_VISION_SPLASH_POTION() - * @method static Potion LONG_POISON_POTION() - * @method static SplashPotion LONG_POISON_SPLASH_POTION() - * @method static Potion LONG_REGENERATION_POTION() - * @method static SplashPotion LONG_REGENERATION_SPLASH_POTION() - * @method static Potion LONG_SLOWNESS_POTION() - * @method static SplashPotion LONG_SLOWNESS_SPLASH_POTION() - * @method static Potion LONG_SLOW_FALLING_POTION() - * @method static SplashPotion LONG_SLOW_FALLING_SPLASH_POTION() - * @method static Potion LONG_STRENGTH_POTION() - * @method static SplashPotion LONG_STRENGTH_SPLASH_POTION() - * @method static Potion LONG_SWIFTNESS_POTION() - * @method static SplashPotion LONG_SWIFTNESS_SPLASH_POTION() - * @method static Potion LONG_TURTLE_MASTER_POTION() - * @method static SplashPotion LONG_TURTLE_MASTER_SPLASH_POTION() - * @method static Potion LONG_WATER_BREATHING_POTION() - * @method static SplashPotion LONG_WATER_BREATHING_SPLASH_POTION() - * @method static Potion LONG_WEAKNESS_POTION() - * @method static SplashPotion LONG_WEAKNESS_SPLASH_POTION() * @method static Bed MAGENTA_BED() * @method static Dye MAGENTA_DYE() * @method static Item MAGMA_CREAM() @@ -246,15 +206,11 @@ use pocketmine\utils\CloningRegistryTrait; * @method static MelonSeeds MELON_SEEDS() * @method static MilkBucket MILK_BUCKET() * @method static Minecart MINECART() - * @method static Potion MUNDANE_POTION() - * @method static SplashPotion MUNDANE_SPLASH_POTION() * @method static MushroomStew MUSHROOM_STEW() * @method static Item NAUTILUS_SHELL() * @method static Item NETHER_BRICK() * @method static Item NETHER_QUARTZ() * @method static Item NETHER_STAR() - * @method static Potion NIGHT_VISION_POTION() - * @method static SplashPotion NIGHT_VISION_SPLASH_POTION() * @method static Boat OAK_BOAT() * @method static ItemBlockWallOrFloor OAK_SIGN() * @method static Bed ORANGE_BED() @@ -265,10 +221,9 @@ use pocketmine\utils\CloningRegistryTrait; * @method static Dye PINK_DYE() * @method static Skull PLAYER_HEAD() * @method static PoisonousPotato POISONOUS_POTATO() - * @method static Potion POISON_POTION() - * @method static SplashPotion POISON_SPLASH_POTION() * @method static Item POPPED_CHORUS_FRUIT() * @method static Potato POTATO() + * @method static Potion POTION() * @method static Item PRISMARINE_CRYSTALS() * @method static Item PRISMARINE_SHARD() * @method static Pufferfish PUFFERFISH() @@ -301,20 +256,15 @@ use pocketmine\utils\CloningRegistryTrait; * @method static Redstone REDSTONE_DUST() * @method static Bed RED_BED() * @method static Dye RED_DYE() - * @method static Potion REGENERATION_POTION() - * @method static SplashPotion REGENERATION_SPLASH_POTION() * @method static RottenFlesh ROTTEN_FLESH() * @method static Item SCUTE() * @method static Shears SHEARS() * @method static Item SHULKER_SHELL() * @method static Skull SKELETON_SKULL() * @method static Item SLIMEBALL() - * @method static Potion SLOWNESS_POTION() - * @method static SplashPotion SLOWNESS_SPLASH_POTION() - * @method static Potion SLOW_FALLING_POTION() - * @method static SplashPotion SLOW_FALLING_SPLASH_POTION() * @method static Snowball SNOWBALL() * @method static SpiderEye SPIDER_EYE() + * @method static SplashPotion SPLASH_POTION() * @method static Boat SPRUCE_BOAT() * @method static ItemBlockWallOrFloor SPRUCE_SIGN() * @method static SpawnEgg SQUID_SPAWN_EGG() @@ -325,49 +275,17 @@ use pocketmine\utils\CloningRegistryTrait; * @method static Pickaxe STONE_PICKAXE() * @method static Shovel STONE_SHOVEL() * @method static Sword STONE_SWORD() - * @method static Potion STRENGTH_POTION() - * @method static SplashPotion STRENGTH_SPLASH_POTION() * @method static StringItem STRING() - * @method static Potion STRONG_HARMING_POTION() - * @method static SplashPotion STRONG_HARMING_SPLASH_POTION() - * @method static Potion STRONG_HEALING_POTION() - * @method static SplashPotion STRONG_HEALING_SPLASH_POTION() - * @method static Potion STRONG_LEAPING_POTION() - * @method static SplashPotion STRONG_LEAPING_SPLASH_POTION() - * @method static Potion STRONG_POISON_POTION() - * @method static SplashPotion STRONG_POISON_SPLASH_POTION() - * @method static Potion STRONG_REGENERATION_POTION() - * @method static SplashPotion STRONG_REGENERATION_SPLASH_POTION() - * @method static Potion STRONG_STRENGTH_POTION() - * @method static SplashPotion STRONG_STRENGTH_SPLASH_POTION() - * @method static Potion STRONG_SWIFTNESS_POTION() - * @method static SplashPotion STRONG_SWIFTNESS_SPLASH_POTION() - * @method static Potion STRONG_TURTLE_MASTER_POTION() - * @method static SplashPotion STRONG_TURTLE_MASTER_SPLASH_POTION() * @method static Item SUGAR() * @method static SweetBerries SWEET_BERRIES() - * @method static Potion SWIFTNESS_POTION() - * @method static SplashPotion SWIFTNESS_SPLASH_POTION() - * @method static Potion THICK_POTION() - * @method static SplashPotion THICK_SPLASH_POTION() * @method static Totem TOTEM() - * @method static Potion TURTLE_MASTER_POTION() - * @method static SplashPotion TURTLE_MASTER_SPLASH_POTION() * @method static SpawnEgg VILLAGER_SPAWN_EGG() - * @method static Potion WATER_BREATHING_POTION() - * @method static SplashPotion WATER_BREATHING_SPLASH_POTION() * @method static LiquidBucket WATER_BUCKET() - * @method static Potion WATER_POTION() - * @method static SplashPotion WATER_SPLASH_POTION() - * @method static Potion WEAKNESS_POTION() - * @method static SplashPotion WEAKNESS_SPLASH_POTION() * @method static Item WHEAT() * @method static WheatSeeds WHEAT_SEEDS() * @method static Bed WHITE_BED() * @method static Dye WHITE_DYE() - * @method static Potion WITHER_POTION() * @method static Skull WITHER_SKELETON_SKULL() - * @method static SplashPotion WITHER_SPLASH_POTION() * @method static Axe WOODEN_AXE() * @method static Hoe WOODEN_HOE() * @method static Pickaxe WOODEN_PICKAXE() @@ -408,8 +326,6 @@ final class VanillaItems{ self::register("air", $factory->get(Ids::AIR, 0, 0)); self::register("apple", $factory->get(Ids::APPLE)); self::register("arrow", $factory->get(Ids::ARROW)); - self::register("awkward_potion", $factory->get(Ids::POTION, 4)); - self::register("awkward_splash_potion", $factory->get(Ids::SPLASH_POTION, 4)); self::register("baked_potato", $factory->get(Ids::BAKED_POTATO)); self::register("bamboo", $factory->get(Ids::BAMBOO)); self::register("banner", $factory->get(Ids::BANNER)); @@ -519,8 +435,6 @@ final class VanillaItems{ self::register("experience_bottle", $factory->get(Ids::BOTTLE_O_ENCHANTING)); self::register("feather", $factory->get(Ids::FEATHER)); self::register("fermented_spider_eye", $factory->get(Ids::FERMENTED_SPIDER_EYE)); - self::register("fire_resistance_potion", $factory->get(Ids::POTION, 12)); - self::register("fire_resistance_splash_potion", $factory->get(Ids::SPLASH_POTION, 12)); self::register("fishing_rod", $factory->get(Ids::FISHING_ROD)); self::register("flint", $factory->get(Ids::FLINT)); self::register("flint_and_steel", $factory->get(Ids::FLINT_AND_STEEL)); @@ -546,14 +460,8 @@ final class VanillaItems{ self::register("green_bed", $factory->get(Ids::BED, 13)); self::register("green_dye", $factory->get(Ids::DYE, 2)); self::register("gunpowder", $factory->get(Ids::GUNPOWDER)); - self::register("harming_potion", $factory->get(Ids::POTION, 23)); - self::register("harming_splash_potion", $factory->get(Ids::SPLASH_POTION, 23)); - self::register("healing_potion", $factory->get(Ids::POTION, 21)); - self::register("healing_splash_potion", $factory->get(Ids::SPLASH_POTION, 21)); self::register("heart_of_the_sea", $factory->get(Ids::HEART_OF_THE_SEA)); self::register("ink_sac", $factory->get(Ids::DYE)); - self::register("invisibility_potion", $factory->get(Ids::POTION, 7)); - self::register("invisibility_splash_potion", $factory->get(Ids::SPLASH_POTION, 7)); self::register("iron_axe", $factory->get(Ids::IRON_AXE)); self::register("iron_boots", $factory->get(Ids::IRON_BOOTS)); self::register("iron_chestplate", $factory->get(Ids::IRON_CHESTPLATE)); @@ -569,8 +477,6 @@ final class VanillaItems{ self::register("jungle_sign", $factory->get(Ids::JUNGLE_SIGN)); self::register("lapis_lazuli", $factory->get(Ids::DYE, 4)); self::register("lava_bucket", $factory->get(Ids::BUCKET, 10)); - self::register("leaping_potion", $factory->get(Ids::POTION, 9)); - self::register("leaping_splash_potion", $factory->get(Ids::SPLASH_POTION, 9)); self::register("leather", $factory->get(Ids::LEATHER)); self::register("leather_boots", $factory->get(Ids::LEATHER_BOOTS)); self::register("leather_cap", $factory->get(Ids::LEATHER_CAP)); @@ -582,34 +488,6 @@ final class VanillaItems{ self::register("light_gray_dye", $factory->get(Ids::DYE, 7)); self::register("lime_bed", $factory->get(Ids::BED, 5)); self::register("lime_dye", $factory->get(Ids::DYE, 10)); - self::register("long_fire_resistance_potion", $factory->get(Ids::POTION, 13)); - self::register("long_fire_resistance_splash_potion", $factory->get(Ids::SPLASH_POTION, 13)); - self::register("long_invisibility_potion", $factory->get(Ids::POTION, 8)); - self::register("long_invisibility_splash_potion", $factory->get(Ids::SPLASH_POTION, 8)); - self::register("long_leaping_potion", $factory->get(Ids::POTION, 10)); - self::register("long_leaping_splash_potion", $factory->get(Ids::SPLASH_POTION, 10)); - self::register("long_mundane_potion", $factory->get(Ids::POTION, 2)); - self::register("long_mundane_splash_potion", $factory->get(Ids::SPLASH_POTION, 2)); - self::register("long_night_vision_potion", $factory->get(Ids::POTION, 6)); - self::register("long_night_vision_splash_potion", $factory->get(Ids::SPLASH_POTION, 6)); - self::register("long_poison_potion", $factory->get(Ids::POTION, 26)); - self::register("long_poison_splash_potion", $factory->get(Ids::SPLASH_POTION, 26)); - self::register("long_regeneration_potion", $factory->get(Ids::POTION, 29)); - self::register("long_regeneration_splash_potion", $factory->get(Ids::SPLASH_POTION, 29)); - self::register("long_slow_falling_potion", $factory->get(Ids::POTION, 41)); - self::register("long_slow_falling_splash_potion", $factory->get(Ids::SPLASH_POTION, 41)); - self::register("long_slowness_potion", $factory->get(Ids::POTION, 18)); - self::register("long_slowness_splash_potion", $factory->get(Ids::SPLASH_POTION, 18)); - self::register("long_strength_potion", $factory->get(Ids::POTION, 32)); - self::register("long_strength_splash_potion", $factory->get(Ids::SPLASH_POTION, 32)); - self::register("long_swiftness_potion", $factory->get(Ids::POTION, 15)); - self::register("long_swiftness_splash_potion", $factory->get(Ids::SPLASH_POTION, 15)); - self::register("long_turtle_master_potion", $factory->get(Ids::POTION, 38)); - self::register("long_turtle_master_splash_potion", $factory->get(Ids::SPLASH_POTION, 38)); - self::register("long_water_breathing_potion", $factory->get(Ids::POTION, 20)); - self::register("long_water_breathing_splash_potion", $factory->get(Ids::SPLASH_POTION, 20)); - self::register("long_weakness_potion", $factory->get(Ids::POTION, 35)); - self::register("long_weakness_splash_potion", $factory->get(Ids::SPLASH_POTION, 35)); self::register("magenta_bed", $factory->get(Ids::BED, 2)); self::register("magenta_dye", $factory->get(Ids::DYE, 13)); self::register("magma_cream", $factory->get(Ids::MAGMA_CREAM)); @@ -617,15 +495,11 @@ final class VanillaItems{ self::register("melon_seeds", $factory->get(Ids::MELON_SEEDS)); self::register("milk_bucket", $factory->get(Ids::BUCKET, 1)); self::register("minecart", $factory->get(Ids::MINECART)); - self::register("mundane_potion", $factory->get(Ids::POTION, 1)); - self::register("mundane_splash_potion", $factory->get(Ids::SPLASH_POTION, 1)); self::register("mushroom_stew", $factory->get(Ids::MUSHROOM_STEW)); self::register("nautilus_shell", $factory->get(Ids::NAUTILUS_SHELL)); self::register("nether_brick", $factory->get(Ids::NETHERBRICK)); self::register("nether_quartz", $factory->get(Ids::NETHER_QUARTZ)); self::register("nether_star", $factory->get(Ids::NETHERSTAR)); - self::register("night_vision_potion", $factory->get(Ids::POTION, 5)); - self::register("night_vision_splash_potion", $factory->get(Ids::SPLASH_POTION, 5)); self::register("oak_boat", $factory->get(Ids::BOAT)); self::register("oak_sign", $factory->get(Ids::SIGN)); self::register("orange_bed", $factory->get(Ids::BED, 1)); @@ -635,11 +509,10 @@ final class VanillaItems{ self::register("pink_bed", $factory->get(Ids::BED, 6)); self::register("pink_dye", $factory->get(Ids::DYE, 9)); self::register("player_head", $factory->get(Ids::MOB_HEAD, 3)); - self::register("poison_potion", $factory->get(Ids::POTION, 25)); - self::register("poison_splash_potion", $factory->get(Ids::SPLASH_POTION, 25)); self::register("poisonous_potato", $factory->get(Ids::POISONOUS_POTATO)); self::register("popped_chorus_fruit", $factory->get(Ids::CHORUS_FRUIT_POPPED)); self::register("potato", $factory->get(Ids::POTATO)); + self::register("potion", $factory->get(Ids::POTION)); self::register("prismarine_crystals", $factory->get(Ids::PRISMARINE_CRYSTALS)); self::register("prismarine_shard", $factory->get(Ids::PRISMARINE_SHARD)); self::register("pufferfish", $factory->get(Ids::PUFFERFISH)); @@ -672,20 +545,15 @@ final class VanillaItems{ self::register("red_bed", $factory->get(Ids::BED, 14)); self::register("red_dye", $factory->get(Ids::DYE, 1)); self::register("redstone_dust", $factory->get(Ids::REDSTONE)); - self::register("regeneration_potion", $factory->get(Ids::POTION, 28)); - self::register("regeneration_splash_potion", $factory->get(Ids::SPLASH_POTION, 28)); self::register("rotten_flesh", $factory->get(Ids::ROTTEN_FLESH)); self::register("scute", $factory->get(Ids::TURTLE_SHELL_PIECE)); self::register("shears", $factory->get(Ids::SHEARS)); self::register("shulker_shell", $factory->get(Ids::SHULKER_SHELL)); self::register("skeleton_skull", $factory->get(Ids::MOB_HEAD)); self::register("slimeball", $factory->get(Ids::SLIMEBALL)); - self::register("slow_falling_potion", $factory->get(Ids::POTION, 40)); - self::register("slow_falling_splash_potion", $factory->get(Ids::SPLASH_POTION, 40)); - self::register("slowness_potion", $factory->get(Ids::POTION, 17)); - self::register("slowness_splash_potion", $factory->get(Ids::SPLASH_POTION, 17)); self::register("snowball", $factory->get(Ids::SNOWBALL)); self::register("spider_eye", $factory->get(Ids::SPIDER_EYE)); + self::register("splash_potion", $factory->get(Ids::SPLASH_POTION)); self::register("spruce_boat", $factory->get(Ids::BOAT, 1)); self::register("spruce_sign", $factory->get(Ids::SPRUCE_SIGN)); self::register("squid_spawn_egg", $factory->get(Ids::SPAWN_EGG, 17)); @@ -696,49 +564,17 @@ final class VanillaItems{ self::register("stone_pickaxe", $factory->get(Ids::STONE_PICKAXE)); self::register("stone_shovel", $factory->get(Ids::STONE_SHOVEL)); self::register("stone_sword", $factory->get(Ids::STONE_SWORD)); - self::register("strength_potion", $factory->get(Ids::POTION, 31)); - self::register("strength_splash_potion", $factory->get(Ids::SPLASH_POTION, 31)); self::register("string", $factory->get(Ids::STRING)); - self::register("strong_harming_potion", $factory->get(Ids::POTION, 24)); - self::register("strong_harming_splash_potion", $factory->get(Ids::SPLASH_POTION, 24)); - self::register("strong_healing_potion", $factory->get(Ids::POTION, 22)); - self::register("strong_healing_splash_potion", $factory->get(Ids::SPLASH_POTION, 22)); - self::register("strong_leaping_potion", $factory->get(Ids::POTION, 11)); - self::register("strong_leaping_splash_potion", $factory->get(Ids::SPLASH_POTION, 11)); - self::register("strong_poison_potion", $factory->get(Ids::POTION, 27)); - self::register("strong_poison_splash_potion", $factory->get(Ids::SPLASH_POTION, 27)); - self::register("strong_regeneration_potion", $factory->get(Ids::POTION, 30)); - self::register("strong_regeneration_splash_potion", $factory->get(Ids::SPLASH_POTION, 30)); - self::register("strong_strength_potion", $factory->get(Ids::POTION, 33)); - self::register("strong_strength_splash_potion", $factory->get(Ids::SPLASH_POTION, 33)); - self::register("strong_swiftness_potion", $factory->get(Ids::POTION, 16)); - self::register("strong_swiftness_splash_potion", $factory->get(Ids::SPLASH_POTION, 16)); - self::register("strong_turtle_master_potion", $factory->get(Ids::POTION, 39)); - self::register("strong_turtle_master_splash_potion", $factory->get(Ids::SPLASH_POTION, 39)); self::register("sugar", $factory->get(Ids::SUGAR)); self::register("sweet_berries", $factory->get(Ids::SWEET_BERRIES)); - self::register("swiftness_potion", $factory->get(Ids::POTION, 14)); - self::register("swiftness_splash_potion", $factory->get(Ids::SPLASH_POTION, 14)); - self::register("thick_potion", $factory->get(Ids::POTION, 3)); - self::register("thick_splash_potion", $factory->get(Ids::SPLASH_POTION, 3)); self::register("totem", $factory->get(Ids::TOTEM)); - self::register("turtle_master_potion", $factory->get(Ids::POTION, 37)); - self::register("turtle_master_splash_potion", $factory->get(Ids::SPLASH_POTION, 37)); self::register("villager_spawn_egg", $factory->get(Ids::SPAWN_EGG, 15)); - self::register("water_breathing_potion", $factory->get(Ids::POTION, 19)); - self::register("water_breathing_splash_potion", $factory->get(Ids::SPLASH_POTION, 19)); self::register("water_bucket", $factory->get(Ids::BUCKET, 8)); - self::register("water_potion", $factory->get(Ids::POTION)); - self::register("water_splash_potion", $factory->get(Ids::SPLASH_POTION)); - self::register("weakness_potion", $factory->get(Ids::POTION, 34)); - self::register("weakness_splash_potion", $factory->get(Ids::SPLASH_POTION, 34)); self::register("wheat", $factory->get(Ids::WHEAT)); self::register("wheat_seeds", $factory->get(Ids::SEEDS)); self::register("white_bed", $factory->get(Ids::BED)); self::register("white_dye", $factory->get(Ids::DYE, 19)); - self::register("wither_potion", $factory->get(Ids::POTION, 36)); self::register("wither_skeleton_skull", $factory->get(Ids::MOB_HEAD, 1)); - self::register("wither_splash_potion", $factory->get(Ids::SPLASH_POTION, 36)); self::register("wooden_axe", $factory->get(Ids::WOODEN_AXE)); self::register("wooden_hoe", $factory->get(Ids::WOODEN_HOE)); self::register("wooden_pickaxe", $factory->get(Ids::WOODEN_PICKAXE));