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:
Dylan K. Taylor 2021-12-10 16:31:56 +00:00
parent 6ddaed97fa
commit 1ed9302f5a
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -68,7 +68,7 @@ class ItemEntity extends Entity{
if($item->isNull()){
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);
}