Implement new dye types, split bonemeal and cocoa beans into their own classes

This commit is contained in:
Dylan K. Taylor
2019-02-22 11:43:11 +00:00
parent 2bfcd25848
commit 3037f45a0c
9 changed files with 85 additions and 19 deletions

View File

@ -25,6 +25,7 @@ namespace pocketmine\block;
use pocketmine\block\utils\BlockDataValidator;
use pocketmine\event\block\BlockGrowEvent;
use pocketmine\item\Fertilizer;
use pocketmine\item\Item;
use pocketmine\math\Facing;
use pocketmine\math\Vector3;
@ -57,7 +58,7 @@ abstract class Crops extends Flowable{
public function onActivate(Item $item, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
if($this->age < 7 and $item->getId() === Item::DYE and $item->getDamage() === 0x0F){ //Bonemeal
if($this->age < 7 and $item instanceof Fertilizer){
$block = clone $this;
$block->age += mt_rand(2, 5);
if($block->age > 7){