mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
movement tweaks
This commit is contained in:
parent
efca0f8398
commit
90d1865cb1
4 changed files with 18 additions and 9 deletions
|
|
@ -579,7 +579,7 @@ class Entity extends Position
|
|||
for($z = $z0; $z < $z1; ++$z){
|
||||
$pos = new Vector3($x, $y, $z);
|
||||
$b = $this->level->getBlock($pos);
|
||||
if(($b->y == ($y1 - 1) && $b->getID() === WATER) || $b->getID() === STILL_WATER){
|
||||
if($b->y == ($y1 - 1) && ($b->getID() === WATER || $b->getID() === STILL_WATER)){
|
||||
$water = true;
|
||||
}
|
||||
if($b != false && $b->isSolid){
|
||||
|
|
@ -603,6 +603,15 @@ class Entity extends Position
|
|||
$horizontalMultiplyFactor = $b->slipperiness * 0.91;
|
||||
}
|
||||
}
|
||||
if($this->inWater){
|
||||
$this->speedX *= 0.8;
|
||||
$this->speedY *= 0.8;
|
||||
$this->speedZ *= 0.8;
|
||||
}else{
|
||||
$this->speedX *= $horizontalMultiplyFactor;
|
||||
$this->speedY *= 0.98;
|
||||
$this->speedZ *= $horizontalMultiplyFactor;
|
||||
}
|
||||
if($this->speedX != 0){
|
||||
$this->x += $this->speedX;
|
||||
$update = true;
|
||||
|
|
@ -639,9 +648,10 @@ class Entity extends Position
|
|||
$update = true;
|
||||
}
|
||||
$this->onGround = $support;
|
||||
|
||||
|
||||
|
||||
if($this->hasGravity){
|
||||
$this->speedY -= ($this->class === ENTITY_FALLING) ? 0.04 : ($this->class === ENTITY_ITEM ? 0.06 : 0.08); // TODO: replace with $gravity
|
||||
$this->speedY -= $this->inWater ? 0.02 : (($this->class === ENTITY_FALLING) ? 0.04 : ($this->class === ENTITY_ITEM ? 0.06 : 0.08)); // TODO: replace with $gravity
|
||||
$update = true;
|
||||
} elseif($this->lastX != $this->x || $this->lastZ != $this->z || $this->lastY != $this->z){
|
||||
// $this->speedX = 0;
|
||||
|
|
@ -659,9 +669,7 @@ class Entity extends Position
|
|||
$this->server->api->handle("entity.motion", $this);
|
||||
}
|
||||
}
|
||||
$this->speedX *= $horizontalMultiplyFactor;
|
||||
$this->speedY *= 0.98;
|
||||
$this->speedZ *= $horizontalMultiplyFactor;
|
||||
|
||||
} elseif($this->player instanceof Player){
|
||||
if($isFlying === true and ($this->player->gamemode & 0x01) === 0x00){
|
||||
if($this->fallY === false or $this->fallStart === false){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue