This commit is contained in:
PEMapModder 2016-02-12 14:08:59 +08:00
parent e5937926cd
commit 3b51d2c217

View File

@ -53,11 +53,9 @@ use pocketmine\nbt\tag\Float;
use pocketmine\nbt\tag\Int; use pocketmine\nbt\tag\Int;
use pocketmine\nbt\tag\Short; use pocketmine\nbt\tag\Short;
use pocketmine\nbt\tag\String; use pocketmine\nbt\tag\String;
use pocketmine\network\Network;
use pocketmine\network\protocol\MobEffectPacket; use pocketmine\network\protocol\MobEffectPacket;
use pocketmine\network\protocol\RemoveEntityPacket; use pocketmine\network\protocol\RemoveEntityPacket;
use pocketmine\network\protocol\SetEntityDataPacket; use pocketmine\network\protocol\SetEntityDataPacket;
use pocketmine\Player; use pocketmine\Player;
use pocketmine\plugin\Plugin; use pocketmine\plugin\Plugin;
use pocketmine\Server; use pocketmine\Server;
@ -86,7 +84,7 @@ abstract class Entity extends Location implements Metadatable{
const DATA_SILENT = 4; const DATA_SILENT = 4;
const DATA_POTION_COLOR = 7; const DATA_POTION_COLOR = 7;
const DATA_POTION_AMBIENT = 8; const DATA_POTION_AMBIENT = 8;
const DATA_NO_AI = 15; const DATA_NO_AI = 15;
const DATA_FLAG_ONFIRE = 0; const DATA_FLAG_ONFIRE = 0;
@ -564,7 +562,7 @@ abstract class Entity extends Location implements Metadatable{
/** /**
* @param Player[]|Player $player * @param Player[]|Player $player
* @param array $data Properly formatted entity data, defaults to everything * @param array $data Properly formatted entity data, defaults to everything
*/ */
public function sendData($player, array $data = null){ public function sendData($player, array $data = null){
$pk = new SetEntityDataPacket(); $pk = new SetEntityDataPacket();
@ -595,23 +593,24 @@ abstract class Entity extends Location implements Metadatable{
* @param EntityDamageEvent $source * @param EntityDamageEvent $source
* *
*/ */
public function attack($damage, EntityDamageEvent $source){ public function attack($damage, EntityDamageEvent $source){
if($this->hasEffect(Effect::FIRE_RESISTANCE) if($this->hasEffect(Effect::FIRE_RESISTANCE)
and $source->getCause() === EntityDamageEvent::CAUSE_FIRE and $source->getCause() === EntityDamageEvent::CAUSE_FIRE
and $source->getCause() === EntityDamageEvent::CAUSE_FIRE_TICK and $source->getCause() === EntityDamageEvent::CAUSE_FIRE_TICK
and $source->getCause() === EntityDamageEvent::CAUSE_LAVA){ and $source->getCause() === EntityDamageEvent::CAUSE_LAVA
$source->setCancelled(); ){
} $source->setCancelled();
}
$this->server->getPluginManager()->callEvent($source); $this->server->getPluginManager()->callEvent($source);
if($source->isCancelled()){ if($source->isCancelled()){
return; return;
} }
$this->setLastDamageCause($source); $this->setLastDamageCause($source);
$this->setHealth($this->getHealth() - $source->getFinalDamage()); $this->setHealth($this->getHealth() - $source->getFinalDamage());
} }
/** /**
* @param float $amount * @param float $amount
@ -619,13 +618,13 @@ abstract class Entity extends Location implements Metadatable{
* *
*/ */
public function heal($amount, EntityRegainHealthEvent $source){ public function heal($amount, EntityRegainHealthEvent $source){
$this->server->getPluginManager()->callEvent($source); $this->server->getPluginManager()->callEvent($source);
if($source->isCancelled()){ if($source->isCancelled()){
return; return;
} }
$this->setHealth($this->getHealth() + $source->getAmount()); $this->setHealth($this->getHealth() + $source->getAmount());
} }
/** /**
* @return int * @return int
@ -774,7 +773,7 @@ abstract class Entity extends Location implements Metadatable{
} }
if($direction === 5){ if($direction === 5){
$this->motionY = $force; $this->motionZ = $force;
return true; return true;
} }
@ -1548,7 +1547,7 @@ abstract class Entity extends Location implements Metadatable{
} }
/** /**
* @param int $propertyId; * @param int $propertyId
* @param int $id * @param int $id
* @param bool $value * @param bool $value
*/ */