mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-20 15:41:33 +00:00
Another fix
This commit is contained in:
@@ -131,6 +131,12 @@ class Item{
|
||||
|
||||
}
|
||||
|
||||
public function useOn($object){
|
||||
if($this->isTool()){
|
||||
$this->meta++;
|
||||
}
|
||||
}
|
||||
|
||||
final public function isTool(){
|
||||
return ($this->isPickaxe() !== false or $this->isAxe() !== false or $this->isShovel() !== false or $this->isSword() !== false or $this->isHoe() !== false);
|
||||
}
|
||||
|
@@ -33,7 +33,7 @@ class DirtBlock extends SolidBlock{
|
||||
|
||||
public function onActivate(Item $item, Player $player){
|
||||
if($item->isHoe()){
|
||||
$item->meta++;
|
||||
$item->useOn($this);
|
||||
$this->level->setBlock($this, BlockAPI::get(FARMLAND, 0));
|
||||
return true;
|
||||
}
|
||||
|
@@ -41,7 +41,7 @@ class GrassBlock extends SolidBlock{
|
||||
TallGrassObject::growGrass($this->level, $this, new Random());
|
||||
return true;
|
||||
}elseif($item->isHoe()){
|
||||
$item->meta++;
|
||||
$item->useOn($this);
|
||||
$this->level->setBlock($this, new FarmlandBlock());
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user