Added TallGrassTrait, remove weirdly specific logic from FortuneDropHelper

this needs to be dealt with before release otherwise we'll be stuck with FortuneDropHelper::grass()
this is the obvious solution and should have been done some time ago - stuff like flammability was already a problem for double tall grass anyway
This commit is contained in:
Dylan K. Taylor
2023-08-01 12:33:36 +01:00
parent 46f24b165a
commit 0a90a5928a
4 changed files with 61 additions and 40 deletions

View File

@ -23,7 +23,7 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\FortuneDropHelper;
use pocketmine\block\utils\TallGrassTrait;
use pocketmine\item\Item;
use pocketmine\math\Facing;
use pocketmine\math\Vector3;
@ -31,10 +31,7 @@ use pocketmine\player\Player;
use pocketmine\world\BlockTransaction;
class TallGrass extends Flowable{
public function canBeReplaced() : bool{
return true;
}
use TallGrassTrait;
private function canBeSupportedBy(Block $block) : bool{
return $block->hasTypeTag(BlockTypeTags::DIRT) || $block->hasTypeTag(BlockTypeTags::MUD);
@ -53,16 +50,4 @@ class TallGrass extends Flowable{
$this->position->getWorld()->useBreakOn($this->position);
}
}
public function getDropsForIncompatibleTool(Item $item) : array{
return FortuneDropHelper::grass($item);
}
public function getFlameEncouragement() : int{
return 60;
}
public function getFlammability() : int{
return 100;
}
}