mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-18 12:04:46 +00:00
Implemented sweet berries (#4164)
this doesn't implement the server-side logic for the "stickiness" (slowdown) because we don't have the system needed for it yet. It also doesn't have parity with vanilla on the damage.
This commit is contained in:
@@ -326,7 +326,7 @@ class ItemFactory{
|
||||
//TODO: minecraft:shield
|
||||
//TODO: minecraft:sparkler
|
||||
//TODO: minecraft:spawn_egg
|
||||
//TODO: minecraft:sweet_berries
|
||||
$this->register(new SweetBerries(new ItemIdentifier(ItemIds::SWEET_BERRIES, 0), "Sweet Berries"));
|
||||
//TODO: minecraft:tnt_minecart
|
||||
//TODO: minecraft:trident
|
||||
//TODO: minecraft:turtle_helmet
|
||||
|
42
src/item/SweetBerries.php
Normal file
42
src/item/SweetBerries.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?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\block\Block;
|
||||
use pocketmine\block\VanillaBlocks;
|
||||
|
||||
class SweetBerries extends Food{
|
||||
|
||||
public function getFoodRestore() : int{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public function getSaturationRestore() : float{
|
||||
return 1.2;
|
||||
}
|
||||
|
||||
public function getBlock(?int $clickedFace = null) : Block{
|
||||
return VanillaBlocks::SWEET_BERRY_BUSH();
|
||||
}
|
||||
}
|
@@ -334,6 +334,7 @@ use function assert;
|
||||
* @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()
|
||||
@@ -700,6 +701,7 @@ final class VanillaItems{
|
||||
self::register("strong_turtle_master_potion", $factory->get(373, 39));
|
||||
self::register("strong_turtle_master_splash_potion", $factory->get(438, 39));
|
||||
self::register("sugar", $factory->get(353));
|
||||
self::register("sweet_berries", $factory->get(477));
|
||||
self::register("swiftness_potion", $factory->get(373, 14));
|
||||
self::register("swiftness_splash_potion", $factory->get(438, 14));
|
||||
self::register("thick_potion", $factory->get(373, 3));
|
||||
|
Reference in New Issue
Block a user