22declare(strict_types=1);
34 protected bool $top =
false;
40 public function isTop() : bool{ return $this->top; }
43 public function setTop(
bool $top) : self{
49 $down = $blockReplace->getSide(
Facing::DOWN);
50 if($down->hasTypeTag(BlockTypeTags::DIRT) && $blockReplace->
getSide(Facing::UP)->canBeReplaced()){
53 $tx->
addBlock($blockReplace->position, $this)->addBlock($blockReplace->position->getSide(Facing::UP), $top);
64 $other = $this->getSide($this->top ?
Facing::DOWN :
Facing::UP);
69 $other->top !== $this->top
74 $down = $this->getSide(
Facing::DOWN);
75 if(!$this->isValidHalfPlant() || (!$this->top && !$down->hasTypeTag(BlockTypeTags::DIRT) && !$down->hasTypeTag(BlockTypeTags::MUD))){
76 $this->position->getWorld()->useBreakOn($this->position);
81 return $this->top ? parent::getDrops($item) : [];
85 if($this->isValidHalfPlant()){
86 return [$this, $this->getSide($this->top ? Facing::DOWN : Facing::UP)];
89 return parent::getAffectedBlocks();
getSide(int $side, int $step=1)
hasSameTypeId(Block $other)
describeBlockOnlyState(RuntimeDataDescriber $w)
place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player=null)
addBlock(Vector3 $pos, Block $state)