mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-13 09:19:42 +00:00
Added health boost potion effect, added Player->sendTip(), MCPE 0.11.0 build 4
This commit is contained in:
parent
79adbdeafe
commit
68ea9b067f
@ -2531,6 +2531,13 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
|||||||
$this->dataPacket($pk->setChannel(Network::CHANNEL_TEXT));
|
$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 $message Message to be broadcasted
|
||||||
* @param string $reason Reason showed in console
|
* @param string $reason Reason showed in console
|
||||||
|
@ -74,7 +74,7 @@ namespace pocketmine {
|
|||||||
const VERSION = "1.5dev";
|
const VERSION = "1.5dev";
|
||||||
const API_VERSION = "1.12.0";
|
const API_VERSION = "1.12.0";
|
||||||
const CODENAME = "活発(Kappatsu)フグ(Fugu)";
|
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.
|
* Startup code. Do not look at it, it may harm you.
|
||||||
|
@ -51,7 +51,7 @@ class Effect{
|
|||||||
const WEAKNESS = 18;
|
const WEAKNESS = 18;
|
||||||
const POISON = 19;
|
const POISON = 19;
|
||||||
const WITHER = 20;
|
const WITHER = 20;
|
||||||
//const HEALTH_BOOST = 21;
|
const HEALTH_BOOST = 21;
|
||||||
//const ABSORPTION = 22;
|
//const ABSORPTION = 22;
|
||||||
//const SATURATION = 23;
|
//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::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::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::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
|
//Absorption
|
||||||
//Saturation
|
//Saturation
|
||||||
}
|
}
|
||||||
|
@ -308,6 +308,10 @@ abstract class Entity extends Location implements Metadatable{
|
|||||||
$this->effects[$effect->getId()] = $effect;
|
$this->effects[$effect->getId()] = $effect;
|
||||||
|
|
||||||
$this->recalculateEffectColor();
|
$this->recalculateEffectColor();
|
||||||
|
|
||||||
|
if($effect->getId() === Effect::HEALTH_BOOST){
|
||||||
|
$this->setHealth($this->getHealth() + 4 * ($effect->getAmplifier() + 1));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function recalculateEffectColor(){
|
protected function recalculateEffectColor(){
|
||||||
@ -592,7 +596,7 @@ abstract class Entity extends Location implements Metadatable{
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getMaxHealth(){
|
public function getMaxHealth(){
|
||||||
return $this->maxHealth;
|
return $this->maxHealth + ($this->hasEffect(Effect::HEALTH_BOOST) ? 4 * ($this->getEffect(Effect::HEALTH_BOOST)->getAmplifier() + 1) : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -32,6 +32,7 @@ class TextPacket extends DataPacket{
|
|||||||
const TYPE_CHAT = 1;
|
const TYPE_CHAT = 1;
|
||||||
const TYPE_TRANSLATION = 2;
|
const TYPE_TRANSLATION = 2;
|
||||||
const TYPE_POPUP = 3;
|
const TYPE_POPUP = 3;
|
||||||
|
const TYPE_TIP = 4;
|
||||||
|
|
||||||
public $type;
|
public $type;
|
||||||
public $source;
|
public $source;
|
||||||
@ -49,6 +50,7 @@ class TextPacket extends DataPacket{
|
|||||||
$this->source = $this->getString();
|
$this->source = $this->getString();
|
||||||
case self::TYPE_RAW:
|
case self::TYPE_RAW:
|
||||||
case self::TYPE_POPUP:
|
case self::TYPE_POPUP:
|
||||||
|
case self::TYPE_TIP:
|
||||||
$this->message = $this->getString();
|
$this->message = $this->getString();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -69,6 +71,7 @@ class TextPacket extends DataPacket{
|
|||||||
$this->putString($this->source);
|
$this->putString($this->source);
|
||||||
case self::TYPE_RAW:
|
case self::TYPE_RAW:
|
||||||
case self::TYPE_POPUP:
|
case self::TYPE_POPUP:
|
||||||
|
case self::TYPE_TIP:
|
||||||
$this->putString($this->message);
|
$this->putString($this->message);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user