mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 12:09:43 +00:00
new autojump
This commit is contained in:
parent
f7745aa69c
commit
f7fed3cd74
4 changed files with 33 additions and 33 deletions
|
|
@ -43,9 +43,9 @@ class MobController
|
|||
return false;
|
||||
}
|
||||
|
||||
$ox = ($x > 0 ? 1 : ($x < 0 ? -1 : 0));
|
||||
$oy = ($y > 0 ? 1 : ($y < 0 ? -1 : 0));
|
||||
$oz = ($z > 0 ? 1 : ($z < 0 ? -1 : 0));
|
||||
$ox = $x <=> 1;
|
||||
$oy = $y <=> 1;
|
||||
$oz = $z <=> 1;
|
||||
$xf = $this->entity->x + ($this->entity->getSpeedModifer() * $ox * $this->entity->getSpeed());
|
||||
$zf = $this->entity->z + ($this->entity->getSpeedModifer() * $oz * $this->entity->getSpeed());
|
||||
$a = $b = $c = $d = 0;
|
||||
|
|
@ -100,10 +100,14 @@ class MobController
|
|||
return true;
|
||||
}
|
||||
|
||||
public function canJump(){
|
||||
return $this->isJumping() && $this->jumpTimeout <= 0 && $this->entity->onGround;
|
||||
}
|
||||
|
||||
public function movementTick(){
|
||||
if($this->isJumping() && $this->jumpTimeout <= 0 && $this->entity->onGround){
|
||||
if($this->canJump()){
|
||||
$this->jumpTimeout = 10;
|
||||
$this->entity->speedY = 0.40;
|
||||
$this->entity->speedY = 0.50;
|
||||
}
|
||||
if($this->jumpTimeout > 0) --$this->jumpTimeout;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue