Block: Clean up internal constructor inconsistencies

I don't dare look how big this commit is or how many bugs it introduced...
This commit is contained in:
Dylan K. Taylor
2019-02-20 19:21:51 +00:00
parent e93464f318
commit 89fce7712a
141 changed files with 427 additions and 1609 deletions

View File

@ -27,24 +27,16 @@ namespace pocketmine\block;
use pocketmine\block\utils\BlockDataValidator;
use pocketmine\event\block\BlockGrowEvent;
use pocketmine\item\Item;
use pocketmine\item\ItemFactory;
use pocketmine\math\Facing;
use pocketmine\math\Vector3;
use pocketmine\Player;
use function mt_rand;
class NetherWartPlant extends Flowable{
protected $id = Block::NETHER_WART_PLANT;
protected $itemId = Item::NETHER_WART;
/** @var int */
protected $age = 0;
public function __construct(){
}
protected function writeStateToMeta() : int{
return $this->age;
}
@ -57,10 +49,6 @@ class NetherWartPlant extends Flowable{
return 0b11;
}
public function getName() : string{
return "Nether Wart";
}
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, Player $player = null) : bool{
$down = $this->getSide(Facing::DOWN);
if($down->getId() === Block::SOUL_SAND){
@ -94,7 +82,7 @@ class NetherWartPlant extends Flowable{
public function getDropsForCompatibleTool(Item $item) : array{
return [
ItemFactory::get($this->getItemId(), 0, ($this->age === 3 ? mt_rand(2, 4) : 1))
$this->getItem()->setCount($this->age === 3 ? mt_rand(2, 4) : 1)
];
}