Snow layers now fall as expected

This commit is contained in:
Dylan K. Taylor 2019-02-19 10:01:57 +00:00
parent a4c3ee20b2
commit bf71ddb0b5

View File

@ -24,6 +24,8 @@ declare(strict_types=1);
namespace pocketmine\block; namespace pocketmine\block;
use pocketmine\block\utils\BlockDataValidator; use pocketmine\block\utils\BlockDataValidator;
use pocketmine\block\utils\Fallable;
use pocketmine\block\utils\FallableTrait;
use pocketmine\item\Item; use pocketmine\item\Item;
use pocketmine\item\ItemFactory; use pocketmine\item\ItemFactory;
use pocketmine\item\TieredTool; use pocketmine\item\TieredTool;
@ -34,7 +36,8 @@ use pocketmine\Player;
use function floor; use function floor;
use function max; use function max;
class SnowLayer extends Flowable{ class SnowLayer extends Flowable implements Fallable{
use FallableTrait;
protected $id = self::SNOW_LAYER; protected $id = self::SNOW_LAYER;
@ -97,12 +100,6 @@ class SnowLayer extends Flowable{
return false; return false;
} }
public function onNearbyBlockChange() : void{
if(!$this->getSide(Facing::DOWN)->isSolid()){
$this->getLevel()->setBlock($this, BlockFactory::get(Block::AIR), false);
}
}
public function ticksRandomly() : bool{ public function ticksRandomly() : bool{
return true; return true;
} }
@ -113,6 +110,10 @@ class SnowLayer extends Flowable{
} }
} }
public function tickFalling() : ?Block{
return null;
}
public function getDropsForCompatibleTool(Item $item) : array{ public function getDropsForCompatibleTool(Item $item) : array{
return [ return [
ItemFactory::get(Item::SNOWBALL, 0, max(1, (int) floor($this->layers / 2))) ItemFactory::get(Item::SNOWBALL, 0, max(1, (int) floor($this->layers / 2)))