public function drop(Position $pos, Item $item) { if ($item->getID() === AIR or $item->count <= 0) { return; } $data = array("x" => $pos->x + mt_rand(-10, 10) / 50, "y" => $pos->y + 0.19, "z" => $pos->z + mt_rand(-10, 10) / 50, "level" => $pos->level, "speedY" => mt_rand(5, 8) / 2, "item" => $item); if ($this->server->api->handle("item.drop", $data) !== false) { for ($count = $item->count; $count > 0;) { $item->count = min($item->getMaxStackSize(), $count); $count -= $item->count; $e = $this->add($pos->level, ENTITY_ITEM, $item->getID(), $data); $this->spawnToAll($e); $this->server->api->handle("entity.motion", $e); } } }