Eliminate repeated calls to Position->getWorld()

as well as improving readability, it also improves performance in some areas.
This commit is contained in:
Dylan K. Taylor
2022-07-20 20:44:05 +01:00
parent 24e72ec109
commit 2940547026
39 changed files with 185 additions and 134 deletions

View File

@ -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));
}
}
}