mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-16 10:49:10 +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\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
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user