mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 16:00:20 +00:00
ContainerTrait: improve performance of block destroy hook
this was creating useless vector3s for every iteration, as well as repeatedly invoking Position->getWorld() for no reason.
This commit is contained in:
parent
dbc0b9634b
commit
24e72ec109
@ -96,8 +96,10 @@ trait ContainerTrait{
|
||||
$inv = $this->getRealInventory();
|
||||
$pos = $this->getPosition();
|
||||
|
||||
$world = $pos->getWorld();
|
||||
$dropPos = $pos->add(0.5, 0.5, 0.5);
|
||||
foreach($inv->getContents() as $k => $item){
|
||||
$pos->getWorld()->dropItem($pos->add(0.5, 0.5, 0.5), $item);
|
||||
$world->dropItem($dropPos, $item);
|
||||
}
|
||||
$inv->clearAll();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user