mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-04 00:55:14 +00:00
added RottenFlesh item
This commit is contained in:
@ -149,7 +149,7 @@ class ItemFactory{
|
|||||||
self::registerItem(new Steak());
|
self::registerItem(new Steak());
|
||||||
self::registerItem(new RawChicken());
|
self::registerItem(new RawChicken());
|
||||||
self::registerItem(new CookedChicken());
|
self::registerItem(new CookedChicken());
|
||||||
//TODO: ROTTEN_FLESH
|
self::registerItem(new RottenFlesh());
|
||||||
//TODO: ENDER_PEARL
|
//TODO: ENDER_PEARL
|
||||||
self::registerItem(new BlazeRod());
|
self::registerItem(new BlazeRod());
|
||||||
self::registerItem(new Item(Item::GHAST_TEAR, 0, "Ghast Tear"));
|
self::registerItem(new Item(Item::GHAST_TEAR, 0, "Ghast Tear"));
|
||||||
|
52
src/pocketmine/item/RottenFlesh.php
Normal file
52
src/pocketmine/item/RottenFlesh.php
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
<?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;
|
||||||
|
|
||||||
|
class RottenFlesh extends Food{
|
||||||
|
|
||||||
|
public function __construct(int $meta = 0){
|
||||||
|
parent::__construct(self::ROTTEN_FLESH, $meta, "Rotten Flesh");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFoodRestore() : int{
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSaturationRestore() : float{
|
||||||
|
return 0.8;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAdditionalEffects() : array{
|
||||||
|
if(lcg_value() <= 0.8){
|
||||||
|
return [
|
||||||
|
Effect::getEffect(Effect::HUNGER)->setDuration(600)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Reference in New Issue
Block a user