mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-05 09:39:56 +00:00
Addition of Coarse Dirt (#1396)
This commit is contained in:
parent
e1d10f595a
commit
6e961ae897
@ -44,13 +44,20 @@ class Dirt extends Solid{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getName() : string{
|
public function getName() : string{
|
||||||
|
if($this->meta === 1){
|
||||||
|
return "Coarse Dirt";
|
||||||
|
}
|
||||||
return "Dirt";
|
return "Dirt";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onActivate(Item $item, Player $player = null) : bool{
|
public function onActivate(Item $item, Player $player = null) : bool{
|
||||||
if($item->isHoe()){
|
if($item->isHoe()){
|
||||||
$item->useOn($this);
|
$item->useOn($this);
|
||||||
$this->getLevel()->setBlock($this, BlockFactory::get(Block::FARMLAND, 0), true);
|
if($this->meta === 1){
|
||||||
|
$this->getLevel()->setBlock($this, BlockFactory::get(Block::DIRT), true);
|
||||||
|
}else{
|
||||||
|
$this->getLevel()->setBlock($this, BlockFactory::get(Block::FARMLAND), true);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -83,6 +83,7 @@ class Grass extends Solid{
|
|||||||
$vector->z = mt_rand($this->z - 1, $this->z + 1);
|
$vector->z = mt_rand($this->z - 1, $this->z + 1);
|
||||||
if(
|
if(
|
||||||
$this->level->getBlockIdAt($vector->x, $vector->y, $vector->z) !== Block::DIRT or
|
$this->level->getBlockIdAt($vector->x, $vector->y, $vector->z) !== Block::DIRT or
|
||||||
|
$this->level->getBlockDataAt($vector->x, $vector->y, $vector->z) === 1 or
|
||||||
$this->level->getFullLightAt($vector->x, $vector->y + 1, $vector->z) < 4 or
|
$this->level->getFullLightAt($vector->x, $vector->y + 1, $vector->z) < 4 or
|
||||||
BlockFactory::$lightFilter[$this->level->getBlockIdAt($vector->x, $vector->y + 1, $vector->z)] >= 3
|
BlockFactory::$lightFilter[$this->level->getBlockIdAt($vector->x, $vector->y + 1, $vector->z)] >= 3
|
||||||
){
|
){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user