mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 19:49:44 +00:00
fixed too big player knockback
This commit is contained in:
parent
731dd8c7df
commit
469002c346
1 changed files with 8 additions and 4 deletions
|
|
@ -1249,6 +1249,10 @@ class Entity extends Position
|
|||
for ($d1 = $entity->z - $this->z; $d * $d + $d1 * $d1 < 0.0001; $d1 = (lcg_value() - lcg_value()) * 0.01) {
|
||||
$d = (lcg_value() - lcg_value()) * 0.01;
|
||||
}
|
||||
if($this->isPlayer()){
|
||||
//force reset speed
|
||||
$this->speedX = $this->speedY = $this->speedZ = 0;
|
||||
}
|
||||
// attackedAtYaw = (float)((Math.atan2($d1, $d) * 180D) / 3.1415927410125732D) >
|
||||
$this->knockBack($d, $d1);
|
||||
if($this->isPlayer()){
|
||||
|
|
@ -1451,14 +1455,14 @@ class Entity extends Position
|
|||
$f = sqrt($d * $d + $d1 * $d1);
|
||||
$f1 = 0.4;
|
||||
$this->speedX /= 2;
|
||||
$this->speedY /= 2;
|
||||
$this->speedZ /= 2;
|
||||
$this->speedX -= ($d / (double) $f) * (double) $f1;
|
||||
$this->speedY += 0.40000000596046448;
|
||||
$this->speedZ -= ($d1 / (double) $f) * (double) $f1;
|
||||
$this->speedX -= ($d / $f) * $f1;
|
||||
$this->speedY += 0.4;
|
||||
$this->speedZ -= ($d1 / $f) * $f1;
|
||||
if($this->speedY > 0.40000000596046448){
|
||||
$this->speedY = 0.40000000596046448;
|
||||
}
|
||||
//$this->speedY /= 2;
|
||||
}
|
||||
|
||||
public function getHealth()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue