Addition of Coarse Dirt (#1396)

This commit is contained in:
Sandertv
2017-09-23 23:25:03 +02:00
committed by Dylan K. Taylor
parent e1d10f595a
commit 6e961ae897
2 changed files with 9 additions and 1 deletions

View File

@ -44,13 +44,20 @@ class Dirt extends Solid{
}
public function getName() : string{
if($this->meta === 1){
return "Coarse Dirt";
}
return "Dirt";
}
public function onActivate(Item $item, Player $player = null) : bool{
if($item->isHoe()){
$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;
}