From 0a4e0e32280f2002046d363fc922891f1eda1b01 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Mon, 8 Sep 2014 07:40:19 +0200 Subject: [PATCH] Fixed Item drop delay --- src/pocketmine/Player.php | 2 +- src/pocketmine/level/Level.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index aae760bd9..e2278f1b6 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -1903,7 +1903,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{ $this->inventory->setItemInHand(Item::get(Item::AIR, 0, 1)); $motion = $this->getDirectionVector()->multiply(0.4); - $this->getLevel()->dropItem($this->add(0, 1.3, 0), $item, $motion); + $this->getLevel()->dropItem($this->add(0, 1.3, 0), $item, $motion, 40); if($this->inAction === true){ $this->inAction = false; diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index 0442fbb56..8ec56acdf 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -925,7 +925,7 @@ class Level implements ChunkManager, Metadatable{ * @param Item $item * @param Vector3 $motion */ - public function dropItem(Vector3 $source, Item $item, Vector3 $motion = null){ + public function dropItem(Vector3 $source, Item $item, Vector3 $motion = null, $delay = 10){ $motion = $motion === null ? new Vector3(lcg_value() * 0.2 - 0.1, 0.2, lcg_value() * 0.2 - 0.1) : $motion; if($item->getID() !== Item::AIR and $item->getCount() > 0){ $itemEntity = new DroppedItem($this->getChunkAt($source->getX() >> 4, $source->getZ() >> 4), new Compound("", [ @@ -950,7 +950,7 @@ class Level implements ChunkManager, Metadatable{ "Damage" => new Short("Damage", $item->getDamage()), "Count" => new Byte("Count", $item->getCount()) ]), - "PickupDelay" => new Short("PickupDelay", 50) + "PickupDelay" => new Short("PickupDelay", $delay) ])); $itemEntity->spawnToAll();