mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
Added Durable class, fixed some tools not breaking correctly, removed some boilerplate code
This commit is contained in:
@ -1692,9 +1692,6 @@ class Level implements ChunkManager, Metadatable{
|
||||
|
||||
if($item !== null){
|
||||
$item->useOn($target);
|
||||
if($item->isTool() and $item->getDamage() >= $item->getMaxDurability()){
|
||||
$item = ItemFactory::get(Item::AIR, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if($player === null or $player->isSurvival()){
|
||||
@ -1769,11 +1766,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
}
|
||||
|
||||
if(!$player->isSneaking() and $item->onActivate($this, $player, $blockReplace, $blockClicked, $face, $facePos)){
|
||||
if($item->getCount() <= 0){
|
||||
$item = ItemFactory::get(Item::AIR, 0, 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}else{
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user