mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
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:
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user