FIx DeadBush can be placed at any block

DeadBush can be placed only at SAND PODZOL HARDENED_CLAY and STAINED_CLAY
This commit is contained in:
dog194 2016-04-22 22:32:08 +08:00
commit 3b5495bfb2

View file

@ -23,6 +23,7 @@ namespace pocketmine\block;
use pocketmine\level\Level;
use pocketmine\item\Item;
use pocketmine\Player;
class DeadBush extends Flowable{
@ -36,6 +37,15 @@ class DeadBush extends Flowable{
return "Dead Bush";
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0);
if($down->getId() === Block::SAND or $down->getId() === Block::PODZOL or
$down->getId() === Block::HARDENED_CLAY or $down->getId() === Block::STAINED_CLAY){
$this->getLevel()->setBlock($block, $this, true);
return true;
}
return false;
}
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){