mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 02:08:21 +00:00
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:
@ -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)
|
||||
];
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user