mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 02:42:58 +00:00
Eliminate repeated calls to Position->getWorld()
as well as improving readability, it also improves performance in some areas.
This commit is contained in:
@ -151,11 +151,12 @@ class ItemFrame extends Flowable{
|
||||
if($this->framedItem === null){
|
||||
return false;
|
||||
}
|
||||
$world = $this->position->getWorld();
|
||||
if(lcg_value() <= $this->itemDropChance){
|
||||
$this->position->getWorld()->dropItem($this->position->add(0.5, 0.5, 0.5), clone $this->framedItem);
|
||||
$world->dropItem($this->position->add(0.5, 0.5, 0.5), clone $this->framedItem);
|
||||
}
|
||||
$this->setFramedItem(null);
|
||||
$this->position->getWorld()->setBlock($this->position, $this);
|
||||
$world->setBlock($this->position, $this);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user