Implemented food and hunger

This commit is contained in:
PEMapModder
2016-02-10 22:49:48 +08:00
parent 1082e32fd7
commit 329a525ea1
47 changed files with 724 additions and 323 deletions

View File

@ -23,11 +23,9 @@ namespace pocketmine\entity;
use pocketmine\event\entity\EntityDamageEvent;
use pocketmine\event\entity\EntityRegainHealthEvent;
use pocketmine\network\Network;
use pocketmine\network\protocol\MobEffectPacket;
use pocketmine\Player;
class Effect{
const SPEED = 1;
const SLOWNESS = 2;
@ -46,15 +44,15 @@ class Effect{
const FIRE_RESISTANCE = 12;
const WATER_BREATHING = 13;
const INVISIBILITY = 14;
//const BLINDNESS = 15;
//const NIGHT_VISION = 16;
//const HUNGER = 17;
const BLINDNESS = 15;
const NIGHT_VISION = 16;
const HUNGER = 17; // TODO implement
const WEAKNESS = 18;
const POISON = 19;
const WITHER = 20;
const HEALTH_BOOST = 21;
//const ABSORPTION = 22;
//const SATURATION = 23;
const ABSORPTION = 22; // TODO implement
const SATURATION = 23;
/** @var Effect[] */
protected static $effects;
@ -76,17 +74,20 @@ class Effect{
self::$effects[Effect::FIRE_RESISTANCE] = new Effect(Effect::FIRE_RESISTANCE, "%potion.fireResistance", 228, 154, 58);
self::$effects[Effect::WATER_BREATHING] = new Effect(Effect::WATER_BREATHING, "%potion.waterBreathing", 46, 82, 153);
self::$effects[Effect::INVISIBILITY] = new Effect(Effect::INVISIBILITY, "%potion.invisibility", 127, 131, 146);
//Hunger
self::$effects[Effect::WEAKNESS] = new Effect(Effect::WEAKNESS, "%potion.weakness", 72, 77, 72 , true);
// TODO Blindness %potion.blindness
// TODO Night Vision %potion.nightVision
// TODO Hunger %potion.hunger
self::$effects[Effect::WEAKNESS] = new Effect(Effect::WEAKNESS, "%potion.weakness", 72, 77, 72, true);
self::$effects[Effect::POISON] = new Effect(Effect::POISON, "%potion.poison", 78, 147, 49, true);
self::$effects[Effect::WITHER] = new Effect(Effect::WITHER, "%potion.wither", 53, 42, 39, true);
self::$effects[Effect::HEALTH_BOOST] = new Effect(Effect::HEALTH_BOOST, "%potion.healthBoost", 248, 125, 35);
//Absorption
//Saturation
// TODO Absorption %potion.absorption
// TODO Saturation %potion.saturation
}
/**
* @param int $id
*
* @return $this
*/
public static function getEffect($id){