mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-03 08:39:53 +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();
|
$inv = $this->getRealInventory();
|
||||||
$pos = $this->getPosition();
|
$pos = $this->getPosition();
|
||||||
|
|
||||||
|
$world = $pos->getWorld();
|
||||||
|
$dropPos = $pos->add(0.5, 0.5, 0.5);
|
||||||
foreach($inv->getContents() as $k => $item){
|
foreach($inv->getContents() as $k => $item){
|
||||||
$pos->getWorld()->dropItem($pos->add(0.5, 0.5, 0.5), $item);
|
$world->dropItem($dropPos, $item);
|
||||||
}
|
}
|
||||||
$inv->clearAll();
|
$inv->clearAll();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user