Instant growth using bonemeal

This commit is contained in:
Shoghi Cervantes Pueyo 2013-02-04 19:00:21 +01:00
parent fee04cd0d9
commit 7e7f1892fd
3 changed files with 18 additions and 41 deletions

View file

@ -28,6 +28,7 @@ the Free Software Foundation, either version 3 of the License, or
class MelonStemBlock extends TransparentBlock{
public function __construct($meta = 0){
parent::__construct(MELON_STEM, $meta, "Melon Stem");
$this->isActivable = true;
}
public function place(BlockAPI $level, Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
if($block->inWorld === true){
@ -40,6 +41,14 @@ class MelonStemBlock extends TransparentBlock{
return false;
}
public function onActivate(BlockAPI $level, Item $item, Player $player){
if($item->getID() === DYE and $item->getMetadata() === 0x0F){ //Bonemeal
$level->setBlock($this, $this->id, 0x07);
return true;
}
return false;
}
public function getDrops(Item $item, Player $player){
return array(
array(MELON_SEEDS, 0, mt_rand(0, 2)),