arrow speed depends on how long were u using an item

This commit is contained in:
GameHerobrine 2023-07-05 10:30:55 +03:00
parent 78a19a7da6
commit d8e242d0b5
3 changed files with 29 additions and 12 deletions

View file

@ -70,6 +70,7 @@ class Entity extends Position
public $random;
public $radius;
public $inAction = false;
public $inActionCounter = 0;
public $hasKnockback;
public $hasJumped;
public $invincible, $crouched, $fire, $health, $status;
@ -499,6 +500,7 @@ class Entity extends Position
if($this->closed === true){
return false;
}
$now = microtime(true);
if($this->check === false){
$this->lastUpdate = $now;
@ -727,19 +729,27 @@ class Entity extends Position
$hasUpdate = true;
}
}
if($this->knockbackTime > 0){
--$this->knockbackTime;
}
if($this->moveTime > 0){
-- $this->moveTime;
--$this->moveTime;
}
if($this->lookTime > 0){
-- $this->lookTime;
--$this->lookTime;
}
if($this->idleTime > 0){
-- $this->idleTime;
--$this->idleTime;
}
if($this->inAction){
++$this->inActionCounter;
}
if($this->lastHeadYaw != $this->headYaw){
$this->sendHeadYaw();
}

View file

@ -59,12 +59,6 @@ class Arrow extends Projectile{
//parent::update();
$this->needsUpdate = true;
$this->speedY -= $this->gravity;
$this->speedX *= 0.99;
$this->speedY *= 0.99;
$this->speedZ *= 0.99;
if($this->speedX != 0 or $this->speedY != 0 or $this->speedZ != 0){
$f = sqrt(($this->speedX * $this->speedX) + ($this->speedZ * $this->speedZ));
$this->yaw = (atan2($this->speedX, $this->speedZ) * 180 / M_PI);
@ -73,6 +67,12 @@ class Arrow extends Projectile{
$this->x += $this->speedX;
$this->y += $this->speedY;
$this->z += $this->speedZ;
$this->speedX *= 0.99;
$this->speedY *= 0.99;
$this->speedZ *= 0.99;
$this->speedY -= $this->gravity;
$this->sendMotion();
$this->updatePosition();
}