mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 19:49:44 +00:00
mob fall damage
This commit is contained in:
parent
3e3a020d2e
commit
6b68b88572
2 changed files with 21 additions and 4 deletions
|
|
@ -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){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue