From 1976e1c6f656feb24305dc27a74bb9c6b5a2cc91 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Pueyo Date: Tue, 29 Jan 2013 19:29:16 +0100 Subject: [PATCH] Item movement fix --- src/classes/Player.php | 3 +++ src/classes/world/Entity.php | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/classes/Player.php b/src/classes/Player.php index d25f3281..e0c774bc 100644 --- a/src/classes/Player.php +++ b/src/classes/Player.php @@ -174,6 +174,9 @@ class Player{ } public function hasItem($type, $damage = false){ + if($type === 0){ + return true; + } foreach($this->inventory as $s => $data){ if($data[0] === $type and ($data[1] === $damage or $damage === false) and $data[2] > 0){ return true; diff --git a/src/classes/world/Entity.php b/src/classes/world/Entity.php index 06d6d3dc..af60ce24 100644 --- a/src/classes/world/Entity.php +++ b/src/classes/world/Entity.php @@ -246,13 +246,13 @@ class Entity extends stdClass{ $b = $this->server->api->level->getBlock($x, $y, $z); if(isset(Material::$transparent[$b[0]])){ $this->speedY -= 0.04 * 4; - $this->server->api->handle("entity.motion", $this); + //$this->server->api->handle("entity.motion", $this); }elseif($this->speedY < 0){ $this->y = $y + 1; $this->speedX = 0; $this->speedY = 0; $this->speedZ = 0; - $this->server->api->handle("entity.motion", $this); + //$this->server->api->handle("entity.motion", $this); } } @@ -437,9 +437,9 @@ class Entity extends stdClass{ $diffTime = microtime(true) - $this->last[5]; $origin = new Vector3($this->last[0], $this->last[1], $this->last[2]); $final = new Vector3($this->x, $this->y, $this->z); - $speedX = abs($this->x - $this->last[0]) / $diffTime; - $speedY = ($this->y - $this->last[1]) / $diffTime; - $speedZ = abs($this->z - $this->last[2]) / $diffTime; + $speedX = ($this->last[0] - $this->x) / $diffTime; + $speedY = ($this->last[1] - $this->y) / $diffTime; + $speedZ = ($this->last[2] - $this->z) / $diffTime; $this->speedX = $speedX; $this->speedY = $speedY; $this->speedZ = $speedZ;