mob fall damage

This commit is contained in:
GameHerobrine 2023-02-23 18:54:10 +03:00
parent 3e3a020d2e
commit 6b68b88572
2 changed files with 21 additions and 4 deletions

View file

@ -7,7 +7,7 @@ class Entity extends Position
const CLASS_TYPE = - 1;
public $counter = 0;
public $fallDistance = 0;
public static $updateOnTick, $allowedAI;
public $isCollidable;
public $canBeAttacked;
@ -669,7 +669,7 @@ class Entity extends Position
$this->server->api->handle("entity.motion", $this);
}
}
$this->updateFallState($this->speedY);
} elseif($this->player instanceof Player){
if($isFlying === true and ($this->player->gamemode & 0x01) === 0x00){
if($this->fallY === false or $this->fallStart === false){
@ -729,7 +729,19 @@ class Entity extends Position
$this->needsUpdate = $hasUpdate;
$this->lastUpdate = $now;
}
public function fall(){}
public function updateFallState($fallTick){
if($this->onGround && $this->fallDistance > 0){
$this->fall();
$this->fallDistance = 0;
}elseif($fallTick < 0){
$this->fallDistance -= $fallTick;
}
}
public function updateMovement()
{
if($this->closed === true){