mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 03:59:43 +00:00
Entity Motion packet (WiP)
This commit is contained in:
parent
f8179f0f7c
commit
862947ab6b
4 changed files with 32 additions and 4 deletions
|
|
@ -235,20 +235,22 @@ class Entity extends stdClass{
|
|||
$y = (int) round($this->y - 1);
|
||||
$z = (int) round($this->z - 0.5);
|
||||
if($this->speedX != 0){
|
||||
$this->x += $this->speedX;
|
||||
$this->x += $this->speedX * 4;
|
||||
}
|
||||
if($this->speedY != 0){
|
||||
$this->y += $this->speedY;
|
||||
$this->y += $this->speedY * 4;
|
||||
}
|
||||
if($this->speedZ != 0){
|
||||
$this->z += $this->speedZ;
|
||||
$this->z += $this->speedZ * 4;
|
||||
}
|
||||
$b = $this->server->api->level->getBlock($x, $y, $z);
|
||||
if(isset(Material::$transparent[$b[0]])){
|
||||
$this->speedY -= 0.32;
|
||||
$this->speedY -= 0.04 * 4;
|
||||
$this->server->api->dhandle("entity.motion", $this);
|
||||
}elseif($this->speedY < 0){
|
||||
$this->y = $y + 1;
|
||||
$this->speedY = 0;
|
||||
$this->server->api->dhandle("entity.motion", $this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue