added RottenFlesh item

This commit is contained in:
Dylan K. Taylor 2017-11-24 10:46:55 +00:00
parent ed195e1167
commit 79fd9b1c96
2 changed files with 53 additions and 1 deletions

View File

@ -149,7 +149,7 @@ class ItemFactory{
self::registerItem(new Steak());
self::registerItem(new RawChicken());
self::registerItem(new CookedChicken());
//TODO: ROTTEN_FLESH
self::registerItem(new RottenFlesh());
//TODO: ENDER_PEARL
self::registerItem(new BlazeRod());
self::registerItem(new Item(Item::GHAST_TEAR, 0, "Ghast Tear"));

View 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 [];
}
}