mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-14 09:49:50 +00:00
Merge pull request #2631 from 64FF00/master
TallGrass blocks should be only placed on grass blocks
This commit is contained in:
commit
5067b96184
@ -23,6 +23,7 @@ namespace pocketmine\block;
|
|||||||
|
|
||||||
use pocketmine\item\Item;
|
use pocketmine\item\Item;
|
||||||
use pocketmine\level\Level;
|
use pocketmine\level\Level;
|
||||||
|
use pocketmine\Player;
|
||||||
|
|
||||||
class TallGrass extends Flowable{
|
class TallGrass extends Flowable{
|
||||||
|
|
||||||
@ -46,6 +47,17 @@ class TallGrass extends Flowable{
|
|||||||
return $names[$this->meta & 0x03];
|
return $names[$this->meta & 0x03];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
||||||
|
$down = $this->getSide(0);
|
||||||
|
if($down->getId() === self::GRASS){
|
||||||
|
$this->getLevel()->setBlock($block, $this, true);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function onUpdate($type){
|
public function onUpdate($type){
|
||||||
if($type === Level::BLOCK_UPDATE_NORMAL){
|
if($type === Level::BLOCK_UPDATE_NORMAL){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user