From da2b800ea860b4b2534137273d2a68c430f68163 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Pueyo Date: Mon, 28 Jan 2013 23:07:17 +0100 Subject: [PATCH] Changes in item spawning --- src/API/BlockAPI.php | 3 +++ src/classes/world/Entity.php | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/API/BlockAPI.php b/src/API/BlockAPI.php index 06c6de67..6df89a12 100644 --- a/src/API/BlockAPI.php +++ b/src/API/BlockAPI.php @@ -245,6 +245,9 @@ class BlockAPI{ $data["stack"] = min(64, $count); $count -= $data["stack"]; $e = $this->server->api->entity->add(ENTITY_ITEM, $block, $data); + //$e->speedX = mt_rand(-10, 10) / 100; + //$e->speedY = mt_rand(0, 5) / 100; + //$e->speedZ = mt_rand(-10, 10) / 100; $this->server->api->entity->spawnToAll($e->eid); } } diff --git a/src/classes/world/Entity.php b/src/classes/world/Entity.php index 22cd8ee1..c164ad71 100644 --- a/src/classes/world/Entity.php +++ b/src/classes/world/Entity.php @@ -246,11 +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->dhandle("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->server->api->dhandle("entity.motion", $this); + $this->speedZ = 0; + $this->server->api->handle("entity.motion", $this); } }