Return the dropped item entity in Level->dropItem() (#1222)

This commit is contained in:
Sandertv 2017-07-20 13:27:58 +02:00 committed by Dylan K. Taylor
parent 42fb1d1fef
commit 1a7f567a70

View File

@ -1531,6 +1531,8 @@ class Level implements ChunkManager, Metadatable{
* @param Item $item * @param Item $item
* @param Vector3 $motion * @param Vector3 $motion
* @param int $delay * @param int $delay
*
* @return DroppedItem|null
*/ */
public function dropItem(Vector3 $source, Item $item, Vector3 $motion = null, int $delay = 10){ public function dropItem(Vector3 $source, Item $item, Vector3 $motion = null, int $delay = 10){
$motion = $motion ?? new Vector3(lcg_value() * 0.2 - 0.1, 0.2, lcg_value() * 0.2 - 0.1); $motion = $motion ?? new Vector3(lcg_value() * 0.2 - 0.1, 0.2, lcg_value() * 0.2 - 0.1);
@ -1559,7 +1561,9 @@ class Level implements ChunkManager, Metadatable{
])); ]));
$itemEntity->spawnToAll(); $itemEntity->spawnToAll();
return $itemEntity;
} }
return null;
} }
/** /**