Quick fix for melons and pumpkins, close #965

This commit is contained in:
Dylan K. Taylor 2017-06-04 16:57:51 +01:00
parent 2b02fcfe2c
commit 6686bd4442
2 changed files with 4 additions and 2 deletions

View File

@ -24,6 +24,7 @@ namespace pocketmine\block;
use pocketmine\event\block\BlockGrowEvent; use pocketmine\event\block\BlockGrowEvent;
use pocketmine\item\Item; use pocketmine\item\Item;
use pocketmine\level\Level; use pocketmine\level\Level;
use pocketmine\math\Vector3;
use pocketmine\Server; use pocketmine\Server;
class MelonStem extends Crops{ class MelonStem extends Crops{
@ -40,7 +41,7 @@ class MelonStem extends Crops{
public function onUpdate($type){ public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){ if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isTransparent() === true){ if($this->getSide(Vector3::SIDE_DOWN)->getId() !== Block::FARMLAND){
$this->getLevel()->useBreakOn($this); $this->getLevel()->useBreakOn($this);
return Level::BLOCK_UPDATE_NORMAL; return Level::BLOCK_UPDATE_NORMAL;
} }

View File

@ -24,6 +24,7 @@ namespace pocketmine\block;
use pocketmine\event\block\BlockGrowEvent; use pocketmine\event\block\BlockGrowEvent;
use pocketmine\item\Item; use pocketmine\item\Item;
use pocketmine\level\Level; use pocketmine\level\Level;
use pocketmine\math\Vector3;
use pocketmine\Server; use pocketmine\Server;
class PumpkinStem extends Crops{ class PumpkinStem extends Crops{
@ -40,7 +41,7 @@ class PumpkinStem extends Crops{
public function onUpdate($type){ public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){ if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isTransparent()){ if($this->getSide(Vector3::SIDE_DOWN)->getId() !== Block::FARMLAND){
$this->getLevel()->useBreakOn($this); $this->getLevel()->useBreakOn($this);
return Level::BLOCK_UPDATE_NORMAL; return Level::BLOCK_UPDATE_NORMAL;
} }