mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-01 07:39:57 +00:00
ItemEntity: clone items given to the constructor directly
this fixes some bizarre mutability issues that occurred when using World->dropItem() with the same object multiple times.
This commit is contained in:
parent
6ddaed97fa
commit
1ed9302f5a
@ -68,7 +68,7 @@ class ItemEntity extends Entity{
|
|||||||
if($item->isNull()){
|
if($item->isNull()){
|
||||||
throw new \InvalidArgumentException("Item entity must have a non-air item with a count of at least 1");
|
throw new \InvalidArgumentException("Item entity must have a non-air item with a count of at least 1");
|
||||||
}
|
}
|
||||||
$this->item = $item;
|
$this->item = clone $item;
|
||||||
parent::__construct($location, $nbt);
|
parent::__construct($location, $nbt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user