diff --git a/src/block/TallGrass.php b/src/block/TallGrass.php index 1811aa0e1..e8f533325 100644 --- a/src/block/TallGrass.php +++ b/src/block/TallGrass.php @@ -37,9 +37,12 @@ class TallGrass extends Flowable{ return true; } + private function canBeSupportedBy(Block $block) : bool{ + return $block->hasTypeTag(BlockTypeTags::DIRT) || $block->hasTypeTag(BlockTypeTags::MUD); + } + public function place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{ - $down = $this->getSide(Facing::DOWN); - if($down->hasTypeTag(BlockTypeTags::DIRT) || $down->hasTypeTag(BlockTypeTags::MUD)){ + if($this->canBeSupportedBy($this->getSide(Facing::DOWN))){ return parent::place($tx, $item, $blockReplace, $blockClicked, $face, $clickVector, $player); } @@ -47,8 +50,7 @@ class TallGrass extends Flowable{ } public function onNearbyBlockChange() : void{ - $down = $this->getSide(Facing::DOWN); - if($down->hasTypeTag(BlockTypeTags::DIRT) || $down->hasTypeTag(BlockTypeTags::MUD)){ //Replace with common break method + if(!$this->canBeSupportedBy($this->getSide(Facing::DOWN))){ //Replace with common break method $this->position->getWorld()->useBreakOn($this->position); } }