mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-23 21:19:44 +00:00
fixed hurt sound playing when spawning player
This commit is contained in:
parent
6e6dc3eb4c
commit
053ac5abb9
2 changed files with 3 additions and 3 deletions
|
|
@ -1742,7 +1742,7 @@ class Player{
|
||||||
$pos = new Position($this->entity->x, $this->entity->y, $this->entity->z, $this->level);
|
$pos = new Position($this->entity->x, $this->entity->y, $this->entity->z, $this->level);
|
||||||
$pData = $this->data->get("position");
|
$pData = $this->data->get("position");
|
||||||
$this->teleport($pos, $pData["yaw"] ?? false, $pData["pitch"] ?? false, true, true);
|
$this->teleport($pos, $pData["yaw"] ?? false, $pData["pitch"] ?? false, true, true);
|
||||||
$this->entity->setHealth($this->data->get("health"), "spawn", true);
|
$this->entity->setHealth($this->data->get("health"), "spawn", true, false);
|
||||||
$this->spawned = true;
|
$this->spawned = true;
|
||||||
$this->server->api->player->spawnAllPlayers($this);
|
$this->server->api->player->spawnAllPlayers($this);
|
||||||
$this->server->api->player->spawnToAllPlayers($this);
|
$this->server->api->player->spawnToAllPlayers($this);
|
||||||
|
|
|
||||||
|
|
@ -1534,7 +1534,7 @@ class Entity extends Position
|
||||||
return $damage;
|
return $damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setHealth($health, $cause = "generic", $force = false)
|
public function setHealth($health, $cause = "generic", $force = false, $allowHarm = true)
|
||||||
{
|
{
|
||||||
$health = (int) $health;
|
$health = (int) $health;
|
||||||
$harm = false;
|
$harm = false;
|
||||||
|
|
@ -1558,7 +1558,7 @@ class Entity extends Position
|
||||||
"cause" => $cause
|
"cause" => $cause
|
||||||
)) !== false or $force === true){
|
)) !== false or $force === true){
|
||||||
$this->health = min(127, max(- 127, $health));
|
$this->health = min(127, max(- 127, $health));
|
||||||
if($harm === true){
|
if($harm === true && $allowHarm){
|
||||||
$pk = new EntityEventPacket;
|
$pk = new EntityEventPacket;
|
||||||
$pk->eid = $this->eid;
|
$pk->eid = $this->eid;
|
||||||
$pk->event = EntityEventPacket::ENTITY_DAMAGE;
|
$pk->event = EntityEventPacket::ENTITY_DAMAGE;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue