diff --git a/src/API/BlockAPI.php b/src/API/BlockAPI.php index 204e57501..1126043cb 100644 --- a/src/API/BlockAPI.php +++ b/src/API/BlockAPI.php @@ -291,47 +291,6 @@ class BlockAPI{ $cancelPlace = true; } break; - case 2: - if($target[0] === 2 and $data["block"] === 351 and $data["meta"] === 0x0F){ //Bonemeal - for($c = 0; $c < 15; ++$c){ - $x = mt_rand($target[2][0] - 2, $target[2][0] + 2); - $z = mt_rand($target[2][2] - 2, $target[2][2] + 2); - $b = $this->server->api->level->getBlock($x, $target[2][1] + 1, $z); - $d = $this->server->api->level->getBlock($x, $target[2][1], $z); - if($b[0] === 0 and $d[0] === 2){ - $arr = array( - array(37, 0), - array(38, 0), - array(31, 1), - array(31, 1), - array(31, 1), - array(31, 1), - array(0, 0), - ); - $t = $arr[mt_rand(0, count($arr) - 1)]; - $this->server->api->level->setBlock($x, $target[2][1] + 1, $z, $t[0], $t[1]); - } - } - $cancelPlace = true; - break; - } - case 3: - if($data["block"] === 292){ //Hoe - $data["block"] = 60; - $data["meta"] = 0; - $this->server->handle("player.block.update", $data); - $cancelPlace = true; - } - break; - case 59: - case 105: - if($data["block"] === 351 and $data["meta"] === 0x0F){ //Bonemeal - $data["block"] = $target[0]; - $data["meta"] = 0x07; - $this->server->handle("player.block.place", $data); - $cancelPlace = true; - } - break; default: $cancelPlace = true; break; diff --git a/src/classes/material/block/plant/MelonStem.php b/src/classes/material/block/plant/MelonStem.php index 9f8f69248..cd8be5de6 100644 --- a/src/classes/material/block/plant/MelonStem.php +++ b/src/classes/material/block/plant/MelonStem.php @@ -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)), diff --git a/src/classes/material/block/plant/Wheat.php b/src/classes/material/block/plant/Wheat.php index 19f601004..2bb0236a8 100644 --- a/src/classes/material/block/plant/Wheat.php +++ b/src/classes/material/block/plant/Wheat.php @@ -28,6 +28,7 @@ the Free Software Foundation, either version 3 of the License, or class WheatBlock extends FlowableBlock{ public function __construct($meta = 0){ parent::__construct(WHEAT_BLOCK, $meta, "Wheat Block"); + $this->isActivable = true; } public function place(BlockAPI $level, Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ @@ -41,6 +42,14 @@ class WheatBlock extends FlowableBlock{ 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){ $drops = array(); if($this->meta >= 0x07){