entity.death event

This commit is contained in:
GameHerobrine 2023-08-21 04:55:35 +03:00
parent d8b44469e7
commit f7aeca11cc
2 changed files with 8 additions and 8 deletions

View file

@ -437,7 +437,7 @@ class Entity extends Position
$this->harm(2, "water"); $this->harm(2, "water");
$hasUpdate = true; $hasUpdate = true;
$waterDone = true; $waterDone = true;
} elseif ($x == ($endX - 1) and $y == $endY and $z == ($endZ - 1 - (($meta % 8) / 9)) and ($this->class === ENTITY_MOB or $this->class === ENTITY_PLAYER) and !$waterDone) { } elseif ($x == ($endX - 1) and $y == $endY and $z == ($endZ - 1) and ($this->class === ENTITY_MOB or $this->class === ENTITY_PLAYER) and !$waterDone) {
$this->air -= 1; $this->air -= 1;
$waterDone = true; $waterDone = true;
$this->updateMetadata(); $this->updateMetadata();
@ -474,7 +474,6 @@ class Entity extends Position
$this->air = 200; $this->air = 200;
} }
break; break;
} }
} }
} }
@ -1402,6 +1401,7 @@ class Entity extends Position
} }
public function makeDead($cause){ public function makeDead($cause){
if($this->server->api->dhandle("entity.death", ["entity" => $this, "cause" => $cause]) === false) return false;
$this->spawnDrops(); $this->spawnDrops();
$this->air = 200; $this->air = 200;
$this->fire = 0; $this->fire = 0;
@ -1413,9 +1413,9 @@ class Entity extends Position
if($this->player instanceof Player){ if($this->player instanceof Player){
$pk = new MoveEntityPacket_PosRot(); $pk = new MoveEntityPacket_PosRot();
$pk->eid = $this->eid; $pk->eid = $this->eid;
$pk->x = - 256; $pk->x = -256;
$pk->y = 128; $pk->y = 128;
$pk->z = - 256; $pk->z = -256;
$pk->yaw = 0; $pk->yaw = 0;
$pk->pitch = 0; $pk->pitch = 0;
$this->server->api->player->broadcastPacket($this->level->players, $pk); $this->server->api->player->broadcastPacket($this->level->players, $pk);
@ -1458,10 +1458,10 @@ class Entity extends Position
$this->speedX /= 2; $this->speedX /= 2;
$this->speedZ /= 2; $this->speedZ /= 2;
$this->speedX -= ($d / $f) * $f1; $this->speedX -= ($d / $f) * $f1;
$this->speedY += 0.40000000596046448; $this->speedY += 0.4;
$this->speedZ -= ($d1 / $f) * $f1; $this->speedZ -= ($d1 / $f) * $f1;
if($this->speedY > 0.40000000596046448){ if($this->speedY > 0.4){
$this->speedY = 0.40000000596046448; $this->speedY = 0.4;
} }
//$this->speedY /= 2; //$this->speedY /= 2;
} }

View file

@ -49,7 +49,7 @@ class EntityAI
} }
public function isStarted($id){ public function isStarted($id){
$task = @$this->getTask($id); $task = $this->getTask($id);
return $task instanceof TaskBase && $task->isStarted; return $task instanceof TaskBase && $task->isStarted;
} }