mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-21 02:16:33 +00:00
Fixed Item drop delay
This commit is contained in:
parent
d8c492de4a
commit
0a4e0e3228
@ -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;
|
||||
|
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user