mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-10 21:45:35 +00:00
Another fix
This commit is contained in:
parent
3023df2033
commit
8e127e60a0
@ -1348,11 +1348,9 @@ class Player{
|
|||||||
default:
|
default:
|
||||||
$damage = 1;//$this->server->difficulty;
|
$damage = 1;//$this->server->difficulty;
|
||||||
}
|
}
|
||||||
$this->server->api->entity->harm($data["target"], $damage, $this->eid);
|
$target->harm($damage, $this->eid);
|
||||||
if($slot->isSword() !== false){
|
if($slot->isTool() === true){
|
||||||
$slot->meta++;
|
$slot->useOn($target);
|
||||||
}elseif($slot->isTool() === true){
|
|
||||||
$slot->meta += 2;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -131,6 +131,12 @@ class Item{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function useOn($object){
|
||||||
|
if($this->isTool()){
|
||||||
|
$this->meta++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final public function isTool(){
|
final public function isTool(){
|
||||||
return ($this->isPickaxe() !== false or $this->isAxe() !== false or $this->isShovel() !== false or $this->isSword() !== false or $this->isHoe() !== false);
|
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){
|
public function onActivate(Item $item, Player $player){
|
||||||
if($item->isHoe()){
|
if($item->isHoe()){
|
||||||
$item->meta++;
|
$item->useOn($this);
|
||||||
$this->level->setBlock($this, BlockAPI::get(FARMLAND, 0));
|
$this->level->setBlock($this, BlockAPI::get(FARMLAND, 0));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ class GrassBlock extends SolidBlock{
|
|||||||
TallGrassObject::growGrass($this->level, $this, new Random());
|
TallGrassObject::growGrass($this->level, $this, new Random());
|
||||||
return true;
|
return true;
|
||||||
}elseif($item->isHoe()){
|
}elseif($item->isHoe()){
|
||||||
$item->meta++;
|
$item->useOn($this);
|
||||||
$this->level->setBlock($this, new FarmlandBlock());
|
$this->level->setBlock($this, new FarmlandBlock());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user