simple autojump, more vanilla speed

This commit is contained in:
GameHerobrine 2024-02-01 07:19:59 +03:00
parent d0a262a3da
commit dee744e709
15 changed files with 52 additions and 35 deletions

View file

@ -129,7 +129,7 @@ abstract class Living extends Entity implements Pathfindable{
if($this->jumping){
if(!$this->inWater){ //TODO also lava
if($this->onGround && $this->jumpTicks <= 0){
//TODO jump $this->jump();
$this->jump();
$this->jumpTicks = 10;
}
}else{
@ -165,6 +165,12 @@ abstract class Living extends Entity implements Pathfindable{
}
public function jump(){
$this->speedY = 0.42;
//TODO also set AirBorne?
}
public function counterUpdate(){
parent::counterUpdate();
if($this->jumpTicks > 0) --$this->jumpTicks;
@ -245,6 +251,10 @@ abstract class Living extends Entity implements Pathfindable{
$this->speedY *= 0.98;
$this->speedX *= $friction;
$this->speedZ *= $friction;
if($this->isCollidedHorizontally && $this->enableAutojump){
$this->ai->mobController->setJumping(true); //non vanilla
}
}
//TODO limbYaw - is it even needed?