Added various blocks made from mangrove, crimson and warped wood

This commit is contained in:
Dylan K. Taylor
2022-07-03 19:01:34 +01:00
parent 6176f0d9df
commit dd615c775d
24 changed files with 568 additions and 136 deletions

View File

@ -24,7 +24,7 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\PillarRotationTrait;
use pocketmine\block\utils\TreeType;
use pocketmine\block\utils\WoodTypeTrait;
use pocketmine\data\runtime\block\BlockDataReader;
use pocketmine\data\runtime\block\BlockDataWriter;
use pocketmine\item\Axe;
@ -34,16 +34,10 @@ use pocketmine\player\Player;
class Wood extends Opaque{
use PillarRotationTrait;
private TreeType $treeType;
use WoodTypeTrait;
private bool $stripped = false;
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo, TreeType $treeType){
parent::__construct($idInfo, $name, $breakInfo);
$this->treeType = $treeType;
}
public function getRequiredTypeDataBits() : int{ return 1; }
protected function decodeType(BlockDataReader $r) : void{
@ -54,13 +48,6 @@ class Wood extends Opaque{
$w->writeBool($this->stripped);
}
/**
* TODO: this is ad hoc, but add an interface for this to all tree-related blocks
*/
public function getTreeType() : TreeType{
return $this->treeType;
}
public function isStripped() : bool{ return $this->stripped; }
/** @return $this */
@ -74,11 +61,11 @@ class Wood extends Opaque{
}
public function getFlameEncouragement() : int{
return 5;
return $this->woodType->isFlammable() ? 5 : 0;
}
public function getFlammability() : int{
return 5;
return $this->woodType->isFlammable() ? 5 : 0;
}
public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player = null) : bool{