From da9937933bcc65119623f39179eca17580561030 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 7 Jul 2022 01:06:17 +0100 Subject: [PATCH] Implemented honey bottle --- src/data/bedrock/item/ItemDeserializer.php | 2 +- src/data/bedrock/item/ItemSerializer.php | 1 + src/item/HoneyBottle.php | 54 ++++++++++++++++++++++ src/item/StringToItemParser.php | 1 + src/item/VanillaItems.php | 2 + 5 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 src/item/HoneyBottle.php diff --git a/src/data/bedrock/item/ItemDeserializer.php b/src/data/bedrock/item/ItemDeserializer.php index 7ac959b4d..d4711f891 100644 --- a/src/data/bedrock/item/ItemDeserializer.php +++ b/src/data/bedrock/item/ItemDeserializer.php @@ -380,7 +380,7 @@ final class ItemDeserializer{ $this->map(Ids::GUNPOWDER, fn() => Items::GUNPOWDER()); $this->map(Ids::HEART_OF_THE_SEA, fn() => Items::HEART_OF_THE_SEA()); //TODO: minecraft:hoglin_spawn_egg - //TODO: minecraft:honey_bottle + $this->map(Ids::HONEY_BOTTLE, fn() => Items::HONEY_BOTTLE()); $this->map(Ids::HONEYCOMB, fn() => Items::HONEYCOMB()); $this->map(Ids::HOPPER, fn() => Blocks::HOPPER()->asItem()); //TODO: minecraft:hopper_minecart diff --git a/src/data/bedrock/item/ItemSerializer.php b/src/data/bedrock/item/ItemSerializer.php index 4d57071c9..c6998aa1e 100644 --- a/src/data/bedrock/item/ItemSerializer.php +++ b/src/data/bedrock/item/ItemSerializer.php @@ -405,6 +405,7 @@ final class ItemSerializer{ $this->map(Items::GUNPOWDER(), self::id(Ids::GUNPOWDER)); $this->map(Items::HEART_OF_THE_SEA(), self::id(Ids::HEART_OF_THE_SEA)); $this->map(Items::HONEYCOMB(), self::id(Ids::HONEYCOMB)); + $this->map(Items::HONEY_BOTTLE(), self::id(Ids::HONEY_BOTTLE)); $this->map(Items::INK_SAC(), self::id(Ids::INK_SAC)); $this->map(Items::IRON_AXE(), self::id(Ids::IRON_AXE)); $this->map(Items::IRON_BOOTS(), self::id(Ids::IRON_BOOTS)); diff --git a/src/item/HoneyBottle.php b/src/item/HoneyBottle.php new file mode 100644 index 000000000..a9f563b46 --- /dev/null +++ b/src/item/HoneyBottle.php @@ -0,0 +1,54 @@ +getEffects()->remove(VanillaEffects::POISON()); + } +} diff --git a/src/item/StringToItemParser.php b/src/item/StringToItemParser.php index c3843a113..bb94ca31f 100644 --- a/src/item/StringToItemParser.php +++ b/src/item/StringToItemParser.php @@ -1226,6 +1226,7 @@ final class StringToItemParser extends StringToTParser{ $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("honey_bottle", fn() => Items::HONEY_BOTTLE()); $result->register("honeycomb", fn() => Items::HONEYCOMB()); $result->register("ink_sac", fn() => Items::INK_SAC()); $result->register("invisibility_potion", fn() => Items::POTION()->setType(PotionType::INVISIBILITY())); diff --git a/src/item/VanillaItems.php b/src/item/VanillaItems.php index bb25c1709..ffdab1910 100644 --- a/src/item/VanillaItems.php +++ b/src/item/VanillaItems.php @@ -180,6 +180,7 @@ use pocketmine\world\World; * @method static Item GUNPOWDER() * @method static Item HEART_OF_THE_SEA() * @method static Item HONEYCOMB() + * @method static HoneyBottle HONEY_BOTTLE() * @method static Item INK_SAC() * @method static Axe IRON_AXE() * @method static Armor IRON_BOOTS() @@ -425,6 +426,7 @@ final class VanillaItems{ self::register("golden_carrot", new GoldenCarrot(new IID(Ids::GOLDEN_CARROT), "Golden Carrot")); self::register("gunpowder", new Item(new IID(Ids::GUNPOWDER), "Gunpowder")); self::register("heart_of_the_sea", new Item(new IID(Ids::HEART_OF_THE_SEA), "Heart of the Sea")); + self::register("honey_bottle", new HoneyBottle(new IID(Ids::HONEY_BOTTLE), "Honey Bottle")); self::register("honeycomb", new Item(new IID(Ids::HONEYCOMB), "Honeycomb")); self::register("ink_sac", new Item(new IID(Ids::INK_SAC), "Ink Sac")); self::register("iron_ingot", new Item(new IID(Ids::IRON_INGOT), "Iron Ingot"));