From 96b61fbb92ac934bc0efa3f539edec0c0f3538c1 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Sun, 12 Oct 2014 16:20:30 +0200 Subject: [PATCH] Made Wheat crops extend Crop class --- src/pocketmine/block/Wheat.php | 58 +--------------------------------- 1 file changed, 1 insertion(+), 57 deletions(-) diff --git a/src/pocketmine/block/Wheat.php b/src/pocketmine/block/Wheat.php index 42f323fc0..7db1c20e1 100644 --- a/src/pocketmine/block/Wheat.php +++ b/src/pocketmine/block/Wheat.php @@ -25,65 +25,9 @@ use pocketmine\item\Item; use pocketmine\level\Level; use pocketmine\Player; -class Wheat extends Flowable{ +class Wheat extends Crops{ public function __construct($meta = 0){ parent::__construct(self::WHEAT_BLOCK, $meta, "Wheat Block"); - $this->isActivable = true; - $this->hardness = 0; - } - - public function getBoundingBox(){ - return null; - } - - - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ - $down = $this->getSide(0); - if($down->getID() === self::FARMLAND){ - $this->getLevel()->setBlock($block, $this, true, true); - - return true; - } - - return false; - } - - public function onActivate(Item $item, Player $player = null){ - if($item->getID() === Item::DYE and $item->getDamage() === 0x0F){ //Bonemeal - $this->meta += mt_rand(2, 5); - if($this->meta > 7){ - $this->meta = 7; - } - $this->getLevel()->setBlock($this, $this, true); - if(($player->gamemode & 0x01) === 0){ - $item->count--; - } - - return true; - } - - return false; - } - - public function onUpdate($type){ - if($type === Level::BLOCK_UPDATE_NORMAL){ - if($this->getSide(0)->isTransparent === true){ //Replace with common break method - //TODO - //Server::getInstance()->api->entity->drop($this, Item::get(WHEAT_SEEDS, 0, 1)); - $this->getLevel()->setBlock($this, new Air(), false, false, true); - - return Level::BLOCK_UPDATE_NORMAL; - } - }elseif($type === Level::BLOCK_UPDATE_RANDOM){ - if(mt_rand(0, 2) == 1){ - if($this->meta < 0x07){ - ++$this->meta; - $this->getLevel()->setBlock($this, $this, true); - } - } - } - - return false; } public function getDrops(Item $item){