Merge commit 'a2543ff80d2906bccda1a4e2fdbd9d8e7d147fb3'

This commit is contained in:
Dylan K. Taylor
2020-04-18 17:33:05 +01:00
76 changed files with 286 additions and 238 deletions

View File

@ -57,20 +57,20 @@ class Sugarcane extends Flowable{
if($item instanceof Fertilizer){
if(!$this->getSide(Facing::DOWN)->isSameType($this)){
for($y = 1; $y < 3; ++$y){
$b = $this->pos->getWorld()->getBlockAt($this->pos->x, $this->pos->y + $y, $this->pos->z);
$b = $this->pos->getWorldNonNull()->getBlockAt($this->pos->x, $this->pos->y + $y, $this->pos->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->pos->getWorldNonNull()->setBlock($b->pos, $ev->getNewState());
}else{
break;
}
}
$this->age = 0;
$this->pos->getWorld()->setBlock($this->pos, $this);
$this->pos->getWorldNonNull()->setBlock($this->pos, $this);
}
$item->pop();
@ -84,7 +84,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->pos->getWorldNonNull()->useBreakOn($this->pos);
}
}
@ -96,17 +96,17 @@ class Sugarcane extends Flowable{
if(!$this->getSide(Facing::DOWN)->isSameType($this)){
if($this->age === 15){
for($y = 1; $y < 3; ++$y){
$b = $this->pos->getWorld()->getBlockAt($this->pos->x, $this->pos->y + $y, $this->pos->z);
$b = $this->pos->getWorldNonNull()->getBlockAt($this->pos->x, $this->pos->y + $y, $this->pos->z);
if($b->getId() === BlockLegacyIds::AIR){
$this->pos->getWorld()->setBlock($b->pos, VanillaBlocks::SUGARCANE());
$this->pos->getWorldNonNull()->setBlock($b->pos, VanillaBlocks::SUGARCANE());
break;
}
}
$this->age = 0;
$this->pos->getWorld()->setBlock($this->pos, $this);
$this->pos->getWorldNonNull()->setBlock($this->pos, $this);
}else{
++$this->age;
$this->pos->getWorld()->setBlock($this->pos, $this);
$this->pos->getWorldNonNull()->setBlock($this->pos, $this);
}
}
}