Refactor Block & Tile: getPos() to getPosition() (#4395)

this also changes the name of the class property 'pos' to 'position' as well as Block->getPosOffset() to Block->getPositionOffset()
This commit is contained in:
SalmonDE
2021-08-23 15:01:32 +02:00
committed by GitHub
parent 22316976fa
commit 7fd712c1ff
93 changed files with 402 additions and 402 deletions

View File

@ -50,23 +50,23 @@ class Sugarcane extends Flowable{
private function grow() : void{
for($y = 1; $y < 3; ++$y){
if(!$this->pos->getWorld()->isInWorld($this->pos->x, $this->pos->y + $y, $this->pos->z)){
if(!$this->position->getWorld()->isInWorld($this->position->x, $this->position->y + $y, $this->position->z)){
break;
}
$b = $this->pos->getWorld()->getBlockAt($this->pos->x, $this->pos->y + $y, $this->pos->z);
$b = $this->position->getWorld()->getBlockAt($this->position->x, $this->position->y + $y, $this->position->z);
if($b->getId() === BlockLegacyIds::AIR){
$ev = new BlockGrowEvent($b, VanillaBlocks::SUGARCANE());
$ev->call();
if($ev->isCancelled()){
break;
}
$this->pos->getWorld()->setBlock($b->pos, $ev->getNewState());
$this->position->getWorld()->setBlock($b->position, $ev->getNewState());
}else{
break;
}
}
$this->age = 0;
$this->pos->getWorld()->setBlock($this->pos, $this);
$this->position->getWorld()->setBlock($this->position, $this);
}
public function getAge() : int{ return $this->age; }
@ -97,7 +97,7 @@ class Sugarcane extends Flowable{
public function onNearbyBlockChange() : void{
$down = $this->getSide(Facing::DOWN);
if($down->isTransparent() and !$down->isSameType($this)){
$this->pos->getWorld()->useBreakOn($this->pos);
$this->position->getWorld()->useBreakOn($this->position);
}
}
@ -111,7 +111,7 @@ class Sugarcane extends Flowable{
$this->grow();
}else{
++$this->age;
$this->pos->getWorld()->setBlock($this->pos, $this);
$this->position->getWorld()->setBlock($this->position, $this);
}
}
}