mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 10:53:05 +00:00
Use entity IDs in EntityDamageBy*EntityEvents, fixed memory leaks related to PvP/PvE/PvM (#418)
This commit is contained in:
@ -1652,6 +1652,7 @@ abstract class Entity extends Location implements Metadatable{
|
||||
}
|
||||
|
||||
$this->namedtag = null;
|
||||
$this->lastDamageCause = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -123,13 +123,15 @@ abstract class Living extends Entity implements Damageable{
|
||||
$e = $source->getChild();
|
||||
}
|
||||
|
||||
if($e->isOnFire() > 0){
|
||||
$this->setOnFire(2 * $this->server->getDifficulty());
|
||||
}
|
||||
if($e !== null){
|
||||
if($e->isOnFire() > 0){
|
||||
$this->setOnFire(2 * $this->server->getDifficulty());
|
||||
}
|
||||
|
||||
$deltaX = $this->x - $e->x;
|
||||
$deltaZ = $this->z - $e->z;
|
||||
$this->knockBack($e, $damage, $deltaX, $deltaZ, $source->getKnockBack());
|
||||
$deltaX = $this->x - $e->x;
|
||||
$deltaZ = $this->z - $e->z;
|
||||
$this->knockBack($e, $damage, $deltaX, $deltaZ, $source->getKnockBack());
|
||||
}
|
||||
}
|
||||
|
||||
$pk = new EntityEventPacket();
|
||||
|
@ -60,7 +60,9 @@ class Squid extends WaterAnimal implements Ageable{
|
||||
if($source instanceof EntityDamageByEntityEvent){
|
||||
$this->swimSpeed = mt_rand(150, 350) / 2000;
|
||||
$e = $source->getDamager();
|
||||
$this->swimDirection = (new Vector3($this->x - $e->x, $this->y - $e->y, $this->z - $e->z))->normalize();
|
||||
if($e !== null){
|
||||
$this->swimDirection = (new Vector3($this->x - $e->x, $this->y - $e->y, $this->z - $e->z))->normalize();
|
||||
}
|
||||
|
||||
$pk = new EntityEventPacket();
|
||||
$pk->eid = $this->getId();
|
||||
|
Reference in New Issue
Block a user