Merge branch 'stable' into next-minor

# Conflicts:
#	src/pocketmine/Player.php
#	src/pocketmine/block/SnowLayer.php
This commit is contained in:
Dylan K. Taylor
2020-06-01 13:42:59 +01:00
15 changed files with 93 additions and 38 deletions

View File

@ -124,4 +124,12 @@ class DoublePlant extends Flowable{
return parent::getAffectedBlocks();
}
public function getFlameEncouragement() : int{
return 60;
}
public function getFlammability() : int{
return 100;
}
}

View File

@ -42,7 +42,7 @@ class SnowLayer extends Flowable{
}
public function canBeReplaced() : bool{
return true;
return $this->meta < 7; //8 snow layers
}
public function getHardness() : float{
@ -57,9 +57,15 @@ class SnowLayer extends Flowable{
return TieredTool::TIER_WOODEN;
}
private function canBeSupportedBy(Block $b) : bool{
return $b->isSolid() or ($b->getId() === $this->getId() and $b->getDamage() === 7);
}
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, Player $player = null) : bool{
if($blockReplace->getSide(Vector3::SIDE_DOWN)->isSolid()){
//TODO: fix placement
if($blockReplace->getId() === $this->getId() and $blockReplace->getDamage() < 7){
$this->setDamage($blockReplace->getDamage() + 1);
}
if($this->canBeSupportedBy($blockReplace->getSide(Vector3::SIDE_DOWN))){
$this->getLevelNonNull()->setBlock($blockReplace, $this, true);
return true;
@ -69,7 +75,7 @@ class SnowLayer extends Flowable{
}
public function onNearbyBlockChange() : void{
if(!$this->getSide(Vector3::SIDE_DOWN)->isSolid()){
if(!$this->canBeSupportedBy($this->getSide(Vector3::SIDE_DOWN))){
$this->getLevelNonNull()->setBlock($this, BlockFactory::get(Block::AIR), false, false);
}
}