From d9e84bf1eb842f761319ae6d4127c0846c0db164 Mon Sep 17 00:00:00 2001 From: GameHerobrine Date: Mon, 9 May 2022 18:00:48 +0300 Subject: [PATCH 1/2] using bonemeal on crops will not instantly grow them(tested on 0.8.1) --- src/material/block/plant/Beetroot.php | 5 ++++- src/material/block/plant/Carrot.php | 5 ++++- src/material/block/plant/MelonStem.php | 5 ++++- src/material/block/plant/PotatoBlock.php | 5 ++++- src/material/block/plant/PumpkinStem.php | 5 ++++- src/material/block/plant/Wheat.php | 5 ++++- 6 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/material/block/plant/Beetroot.php b/src/material/block/plant/Beetroot.php index fecad0da..7332ce4f 100644 --- a/src/material/block/plant/Beetroot.php +++ b/src/material/block/plant/Beetroot.php @@ -38,7 +38,10 @@ class BeetrootBlock extends FlowableBlock{ public function onActivate(Item $item, Player $player){ if($item->getID() === DYE and $item->getMetadata() === 0x0F){ //Bonemeal - $this->meta = 0x07; + $this->meta += mt_rand(0, 3) + 2; + if ($this->meta > 7) { + $this->meta = 7; + } $this->level->setBlock($this, $this, true, false, true); if(($player->gamemode & 0x01) === 0){ $player->removeItem(DYE,0x0F,1); diff --git a/src/material/block/plant/Carrot.php b/src/material/block/plant/Carrot.php index a6e36da3..a0259743 100644 --- a/src/material/block/plant/Carrot.php +++ b/src/material/block/plant/Carrot.php @@ -38,7 +38,10 @@ class CarrotBlock extends FlowableBlock{ public function onActivate(Item $item, Player $player){ if($item->getID() === DYE and $item->getMetadata() === 0x0F){ //Bonemeal - $this->meta = 0x07; + $this->meta += mt_rand(0, 3) + 2; + if ($this->meta > 7) { + $this->meta = 7; + } $this->level->setBlock($this, $this, true, false, true); if(($player->gamemode & 0x01) === 0){ $player->removeItem(DYE,0x0F,1); diff --git a/src/material/block/plant/MelonStem.php b/src/material/block/plant/MelonStem.php index bdd32ad2..6c3db3e2 100644 --- a/src/material/block/plant/MelonStem.php +++ b/src/material/block/plant/MelonStem.php @@ -69,7 +69,10 @@ class MelonStemBlock extends FlowableBlock{ public function onActivate(Item $item, Player $player){ if($item->getID() === DYE and $item->getMetadata() === 0x0F){ //Bonemeal - $this->meta = 0x07; + $this->meta += mt_rand(0, 3) + 2; + if ($this->meta > 7) { + $this->meta = 7; + } $this->level->setBlock($this, $this, true, false, true); if(($player->gamemode & 0x01) === 0){ $player->removeItem(DYE,0x0F,1); diff --git a/src/material/block/plant/PotatoBlock.php b/src/material/block/plant/PotatoBlock.php index 67fcf239..a943b48b 100644 --- a/src/material/block/plant/PotatoBlock.php +++ b/src/material/block/plant/PotatoBlock.php @@ -38,7 +38,10 @@ class PotatoBlock extends FlowableBlock{ public function onActivate(Item $item, Player $player){ if($item->getID() === DYE and $item->getMetadata() === 0x0F){ //Bonemeal - $this->meta = 0x07; + $this->meta += mt_rand(0, 3) + 2; + if ($this->meta > 7) { + $this->meta = 7; + } $this->level->setBlock($this, $this, true, false, true); if(($player->gamemode & 0x01) === 0){ $player->removeItem(DYE,0x0F,1); diff --git a/src/material/block/plant/PumpkinStem.php b/src/material/block/plant/PumpkinStem.php index 5f47b40c..0a6ff839 100644 --- a/src/material/block/plant/PumpkinStem.php +++ b/src/material/block/plant/PumpkinStem.php @@ -69,7 +69,10 @@ class PumpkinStemBlock extends FlowableBlock{ public function onActivate(Item $item, Player $player){ if($item->getID() === DYE and $item->getMetadata() === 0x0F){ //Bonemeal - $this->meta = 0x07; + $this->meta += mt_rand(0, 3) + 2; + if ($this->meta > 7) { + $this->meta = 7; + } $this->level->setBlock($this, $this, true, false, true); if(($player->gamemode & 0x01) === 0){ $player->removeItem(DYE,0x0F,1); diff --git a/src/material/block/plant/Wheat.php b/src/material/block/plant/Wheat.php index c43c80ac..1d23b39e 100644 --- a/src/material/block/plant/Wheat.php +++ b/src/material/block/plant/Wheat.php @@ -38,7 +38,10 @@ class WheatBlock extends FlowableBlock{ public function onActivate(Item $item, Player $player){ if($item->getID() === DYE and $item->getMetadata() === 0x0F){ //Bonemeal - $this->meta = 0x07; + $this->meta += mt_rand(0, 3) + 2; + if ($this->meta > 7) { + $this->meta = 7; + } $this->level->setBlock($this, $this, true, false, true); if(($player->gamemode & 0x01) === 0){ $player->removeItem(DYE,0x0F,1); From 34329ea49393bdd6be61ace951ec80471ee8babb Mon Sep 17 00:00:00 2001 From: GameHerobrine Date: Mon, 9 May 2022 18:03:55 +0300 Subject: [PATCH 2/2] using bonemeal on crops will not instantly grow them(tested on 0.8.1) --- src/material/block/plant/Beetroot.php | 4 ++-- src/material/block/plant/Carrot.php | 4 ++-- src/material/block/plant/MelonStem.php | 4 ++-- src/material/block/plant/PotatoBlock.php | 4 ++-- src/material/block/plant/PumpkinStem.php | 4 ++-- src/material/block/plant/Wheat.php | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/material/block/plant/Beetroot.php b/src/material/block/plant/Beetroot.php index 7332ce4f..6b5372ab 100644 --- a/src/material/block/plant/Beetroot.php +++ b/src/material/block/plant/Beetroot.php @@ -40,8 +40,8 @@ class BeetrootBlock extends FlowableBlock{ if($item->getID() === DYE and $item->getMetadata() === 0x0F){ //Bonemeal $this->meta += mt_rand(0, 3) + 2; if ($this->meta > 7) { - $this->meta = 7; - } + $this->meta = 7; + } $this->level->setBlock($this, $this, true, false, true); if(($player->gamemode & 0x01) === 0){ $player->removeItem(DYE,0x0F,1); diff --git a/src/material/block/plant/Carrot.php b/src/material/block/plant/Carrot.php index a0259743..ff72b88a 100644 --- a/src/material/block/plant/Carrot.php +++ b/src/material/block/plant/Carrot.php @@ -40,8 +40,8 @@ class CarrotBlock extends FlowableBlock{ if($item->getID() === DYE and $item->getMetadata() === 0x0F){ //Bonemeal $this->meta += mt_rand(0, 3) + 2; if ($this->meta > 7) { - $this->meta = 7; - } + $this->meta = 7; + } $this->level->setBlock($this, $this, true, false, true); if(($player->gamemode & 0x01) === 0){ $player->removeItem(DYE,0x0F,1); diff --git a/src/material/block/plant/MelonStem.php b/src/material/block/plant/MelonStem.php index 6c3db3e2..3ca92ad9 100644 --- a/src/material/block/plant/MelonStem.php +++ b/src/material/block/plant/MelonStem.php @@ -71,8 +71,8 @@ class MelonStemBlock extends FlowableBlock{ if($item->getID() === DYE and $item->getMetadata() === 0x0F){ //Bonemeal $this->meta += mt_rand(0, 3) + 2; if ($this->meta > 7) { - $this->meta = 7; - } + $this->meta = 7; + } $this->level->setBlock($this, $this, true, false, true); if(($player->gamemode & 0x01) === 0){ $player->removeItem(DYE,0x0F,1); diff --git a/src/material/block/plant/PotatoBlock.php b/src/material/block/plant/PotatoBlock.php index a943b48b..562b7954 100644 --- a/src/material/block/plant/PotatoBlock.php +++ b/src/material/block/plant/PotatoBlock.php @@ -40,8 +40,8 @@ class PotatoBlock extends FlowableBlock{ if($item->getID() === DYE and $item->getMetadata() === 0x0F){ //Bonemeal $this->meta += mt_rand(0, 3) + 2; if ($this->meta > 7) { - $this->meta = 7; - } + $this->meta = 7; + } $this->level->setBlock($this, $this, true, false, true); if(($player->gamemode & 0x01) === 0){ $player->removeItem(DYE,0x0F,1); diff --git a/src/material/block/plant/PumpkinStem.php b/src/material/block/plant/PumpkinStem.php index 0a6ff839..8e0a2aa1 100644 --- a/src/material/block/plant/PumpkinStem.php +++ b/src/material/block/plant/PumpkinStem.php @@ -71,8 +71,8 @@ class PumpkinStemBlock extends FlowableBlock{ if($item->getID() === DYE and $item->getMetadata() === 0x0F){ //Bonemeal $this->meta += mt_rand(0, 3) + 2; if ($this->meta > 7) { - $this->meta = 7; - } + $this->meta = 7; + } $this->level->setBlock($this, $this, true, false, true); if(($player->gamemode & 0x01) === 0){ $player->removeItem(DYE,0x0F,1); diff --git a/src/material/block/plant/Wheat.php b/src/material/block/plant/Wheat.php index 1d23b39e..d29b5b6f 100644 --- a/src/material/block/plant/Wheat.php +++ b/src/material/block/plant/Wheat.php @@ -40,8 +40,8 @@ class WheatBlock extends FlowableBlock{ if($item->getID() === DYE and $item->getMetadata() === 0x0F){ //Bonemeal $this->meta += mt_rand(0, 3) + 2; if ($this->meta > 7) { - $this->meta = 7; - } + $this->meta = 7; + } $this->level->setBlock($this, $this, true, false, true); if(($player->gamemode & 0x01) === 0){ $player->removeItem(DYE,0x0F,1);