Position: rename getWorldNonNull() to getWorld(), remove original getWorld()

This commit is contained in:
Dylan K. Taylor
2020-06-29 21:19:46 +01:00
parent fc22fd80d8
commit 670ad9eb9d
81 changed files with 259 additions and 275 deletions

View File

@ -76,12 +76,12 @@ class Cactus extends Transparent{
public function onNearbyBlockChange() : void{
$down = $this->getSide(Facing::DOWN);
if($down->getId() !== BlockLegacyIds::SAND and !$down->isSameType($this)){
$this->pos->getWorldNonNull()->useBreakOn($this->pos);
$this->pos->getWorld()->useBreakOn($this->pos);
}else{
foreach(Facing::HORIZONTAL as $side){
$b = $this->getSide($side);
if($b->isSolid()){
$this->pos->getWorldNonNull()->useBreakOn($this->pos);
$this->pos->getWorld()->useBreakOn($this->pos);
break;
}
}
@ -96,23 +96,23 @@ class Cactus extends Transparent{
if(!$this->getSide(Facing::DOWN)->isSameType($this)){
if($this->age === 15){
for($y = 1; $y < 3; ++$y){
$b = $this->pos->getWorldNonNull()->getBlockAt($this->pos->x, $this->pos->y + $y, $this->pos->z);
$b = $this->pos->getWorld()->getBlockAt($this->pos->x, $this->pos->y + $y, $this->pos->z);
if($b->getId() === BlockLegacyIds::AIR){
$ev = new BlockGrowEvent($b, VanillaBlocks::CACTUS());
$ev->call();
if($ev->isCancelled()){
break;
}
$this->pos->getWorldNonNull()->setBlock($b->pos, $ev->getNewState());
$this->pos->getWorld()->setBlock($b->pos, $ev->getNewState());
}else{
break;
}
}
$this->age = 0;
$this->pos->getWorldNonNull()->setBlock($this->pos, $this);
$this->pos->getWorld()->setBlock($this->pos, $this);
}else{
++$this->age;
$this->pos->getWorldNonNull()->setBlock($this->pos, $this);
$this->pos->getWorld()->setBlock($this->pos, $this);
}
}
}