mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-12 00:39:45 +00:00
Implemented honey bottle
This commit is contained in:
parent
2142eb3cc9
commit
da9937933b
@ -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
|
||||
|
@ -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));
|
||||
|
54
src/item/HoneyBottle.php
Normal file
54
src/item/HoneyBottle.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\item;
|
||||
|
||||
use pocketmine\entity\effect\VanillaEffects;
|
||||
use pocketmine\entity\Living;
|
||||
|
||||
final class HoneyBottle extends Food{
|
||||
|
||||
public function getMaxStackSize() : int{
|
||||
return 16;
|
||||
}
|
||||
|
||||
public function requiresHunger() : bool{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getFoodRestore() : int{
|
||||
return 6;
|
||||
}
|
||||
|
||||
public function getSaturationRestore() : float{
|
||||
return 1.2;
|
||||
}
|
||||
|
||||
public function getResidue() : Item{
|
||||
return VanillaItems::GLASS_BOTTLE();
|
||||
}
|
||||
|
||||
public function onConsume(Living $consumer) : void{
|
||||
$consumer->getEffects()->remove(VanillaEffects::POISON());
|
||||
}
|
||||
}
|
@ -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()));
|
||||
|
@ -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"));
|
||||
|
Loading…
x
Reference in New Issue
Block a user