mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-16 02:38:54 +00:00
Resolved #3937
This commit is contained in:
parent
e5937926cd
commit
3b51d2c217
@ -53,11 +53,9 @@ use pocketmine\nbt\tag\Float;
|
||||
use pocketmine\nbt\tag\Int;
|
||||
use pocketmine\nbt\tag\Short;
|
||||
use pocketmine\nbt\tag\String;
|
||||
use pocketmine\network\Network;
|
||||
use pocketmine\network\protocol\MobEffectPacket;
|
||||
use pocketmine\network\protocol\RemoveEntityPacket;
|
||||
use pocketmine\network\protocol\SetEntityDataPacket;
|
||||
|
||||
use pocketmine\Player;
|
||||
use pocketmine\plugin\Plugin;
|
||||
use pocketmine\Server;
|
||||
@ -86,7 +84,7 @@ abstract class Entity extends Location implements Metadatable{
|
||||
const DATA_SILENT = 4;
|
||||
const DATA_POTION_COLOR = 7;
|
||||
const DATA_POTION_AMBIENT = 8;
|
||||
const DATA_NO_AI = 15;
|
||||
const DATA_NO_AI = 15;
|
||||
|
||||
|
||||
const DATA_FLAG_ONFIRE = 0;
|
||||
@ -564,7 +562,7 @@ abstract class Entity extends Location implements Metadatable{
|
||||
|
||||
/**
|
||||
* @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){
|
||||
$pk = new SetEntityDataPacket();
|
||||
@ -595,23 +593,24 @@ abstract class Entity extends Location implements Metadatable{
|
||||
* @param EntityDamageEvent $source
|
||||
*
|
||||
*/
|
||||
public function attack($damage, EntityDamageEvent $source){
|
||||
if($this->hasEffect(Effect::FIRE_RESISTANCE)
|
||||
and $source->getCause() === EntityDamageEvent::CAUSE_FIRE
|
||||
and $source->getCause() === EntityDamageEvent::CAUSE_FIRE_TICK
|
||||
and $source->getCause() === EntityDamageEvent::CAUSE_LAVA){
|
||||
$source->setCancelled();
|
||||
}
|
||||
public function attack($damage, EntityDamageEvent $source){
|
||||
if($this->hasEffect(Effect::FIRE_RESISTANCE)
|
||||
and $source->getCause() === EntityDamageEvent::CAUSE_FIRE
|
||||
and $source->getCause() === EntityDamageEvent::CAUSE_FIRE_TICK
|
||||
and $source->getCause() === EntityDamageEvent::CAUSE_LAVA
|
||||
){
|
||||
$source->setCancelled();
|
||||
}
|
||||
|
||||
$this->server->getPluginManager()->callEvent($source);
|
||||
if($source->isCancelled()){
|
||||
return;
|
||||
}
|
||||
$this->server->getPluginManager()->callEvent($source);
|
||||
if($source->isCancelled()){
|
||||
return;
|
||||
}
|
||||
|
||||
$this->setLastDamageCause($source);
|
||||
$this->setLastDamageCause($source);
|
||||
|
||||
$this->setHealth($this->getHealth() - $source->getFinalDamage());
|
||||
}
|
||||
$this->setHealth($this->getHealth() - $source->getFinalDamage());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $amount
|
||||
@ -619,13 +618,13 @@ abstract class Entity extends Location implements Metadatable{
|
||||
*
|
||||
*/
|
||||
public function heal($amount, EntityRegainHealthEvent $source){
|
||||
$this->server->getPluginManager()->callEvent($source);
|
||||
if($source->isCancelled()){
|
||||
return;
|
||||
}
|
||||
$this->server->getPluginManager()->callEvent($source);
|
||||
if($source->isCancelled()){
|
||||
return;
|
||||
}
|
||||
|
||||
$this->setHealth($this->getHealth() + $source->getAmount());
|
||||
}
|
||||
$this->setHealth($this->getHealth() + $source->getAmount());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
@ -774,7 +773,7 @@ abstract class Entity extends Location implements Metadatable{
|
||||
}
|
||||
|
||||
if($direction === 5){
|
||||
$this->motionY = $force;
|
||||
$this->motionZ = $force;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1548,7 +1547,7 @@ abstract class Entity extends Location implements Metadatable{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $propertyId;
|
||||
* @param int $propertyId
|
||||
* @param int $id
|
||||
* @param bool $value
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user