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:
@ -48,9 +48,10 @@ class BarrelInventory extends SimpleInventory implements BlockInventory{
|
||||
|
||||
protected function animateBlock(bool $isOpen) : void{
|
||||
$holder = $this->getHolder();
|
||||
$block = $holder->getWorld()->getBlock($holder);
|
||||
$world = $holder->getWorld();
|
||||
$block = $world->getBlock($holder);
|
||||
if($block instanceof Barrel){
|
||||
$holder->getWorld()->setBlock($holder, $block->setOpen($isOpen));
|
||||
$world->setBlock($holder, $block->setOpen($isOpen));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user