Added health boost potion effect, added Player->sendTip(), MCPE 0.11.0 build 4

This commit is contained in:
Shoghi Cervantes 2015-04-15 12:33:16 +02:00
parent 79adbdeafe
commit 68ea9b067f
5 changed files with 18 additions and 4 deletions

View File

@ -2531,6 +2531,13 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
$this->dataPacket($pk->setChannel(Network::CHANNEL_TEXT));
}
public function sendTip($message){
$pk = new TextPacket();
$pk->type = TextPacket::TYPE_TIP;
$pk->message = $message;
$this->dataPacket($pk->setChannel(Network::CHANNEL_TEXT));
}
/**
* @param string $message Message to be broadcasted
* @param string $reason Reason showed in console

View File

@ -74,7 +74,7 @@ namespace pocketmine {
const VERSION = "1.5dev";
const API_VERSION = "1.12.0";
const CODENAME = "活発(Kappatsu)フグ(Fugu)";
const MINECRAFT_VERSION = "v0.11.0 alpha build 3";
const MINECRAFT_VERSION = "v0.11.0 alpha build 4";
/*
* Startup code. Do not look at it, it may harm you.

View File

@ -51,7 +51,7 @@ class Effect{
const WEAKNESS = 18;
const POISON = 19;
const WITHER = 20;
//const HEALTH_BOOST = 21;
const HEALTH_BOOST = 21;
//const ABSORPTION = 22;
//const SATURATION = 23;
@ -79,7 +79,7 @@ class Effect{
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);
//Health Boost
self::$effects[Effect::HEALTH_BOOST] = new Effect(Effect::HEALTH_BOOST, "%potion.healthBoost", 248, 125, 35);
//Absorption
//Saturation
}

View File

@ -308,6 +308,10 @@ abstract class Entity extends Location implements Metadatable{
$this->effects[$effect->getId()] = $effect;
$this->recalculateEffectColor();
if($effect->getId() === Effect::HEALTH_BOOST){
$this->setHealth($this->getHealth() + 4 * ($effect->getAmplifier() + 1));
}
}
protected function recalculateEffectColor(){
@ -592,7 +596,7 @@ abstract class Entity extends Location implements Metadatable{
* @return int
*/
public function getMaxHealth(){
return $this->maxHealth;
return $this->maxHealth + ($this->hasEffect(Effect::HEALTH_BOOST) ? 4 * ($this->getEffect(Effect::HEALTH_BOOST)->getAmplifier() + 1) : 0);
}
/**

View File

@ -32,6 +32,7 @@ class TextPacket extends DataPacket{
const TYPE_CHAT = 1;
const TYPE_TRANSLATION = 2;
const TYPE_POPUP = 3;
const TYPE_TIP = 4;
public $type;
public $source;
@ -49,6 +50,7 @@ class TextPacket extends DataPacket{
$this->source = $this->getString();
case self::TYPE_RAW:
case self::TYPE_POPUP:
case self::TYPE_TIP:
$this->message = $this->getString();
break;
@ -69,6 +71,7 @@ class TextPacket extends DataPacket{
$this->putString($this->source);
case self::TYPE_RAW:
case self::TYPE_POPUP:
case self::TYPE_TIP:
$this->putString($this->message);
break;