mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
Added Item->getBlockToolType()
This commit is contained in:
parent
55d0684565
commit
db31d13f96
@ -23,12 +23,18 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\item;
|
||||
|
||||
use pocketmine\block\BlockToolType;
|
||||
|
||||
class Axe extends TieredTool{
|
||||
|
||||
public function isAxe(){
|
||||
return $this->tier;
|
||||
}
|
||||
|
||||
public function getBlockToolType() : int{
|
||||
return BlockToolType::TYPE_AXE;
|
||||
}
|
||||
|
||||
public function getAttackPoints() : int{
|
||||
return self::getBaseDamageFromTier($this->tier) - 1;
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ namespace pocketmine\item;
|
||||
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\block\BlockFactory;
|
||||
use pocketmine\block\BlockToolType;
|
||||
use pocketmine\entity\Entity;
|
||||
use pocketmine\item\enchantment\Enchantment;
|
||||
use pocketmine\level\Level;
|
||||
@ -741,6 +742,16 @@ class Item implements ItemIds, \JsonSerializable{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns what type of block-breaking tool this is. Blocks requiring the same tool type as the item will break
|
||||
* faster (except for blocks requiring no tool, which break at the same speed regardless of the tool used)
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getBlockToolType() : int{
|
||||
return BlockToolType::TYPE_NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the maximum amount of damage this item can take before it breaks.
|
||||
*
|
||||
|
@ -23,12 +23,18 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\item;
|
||||
|
||||
use pocketmine\block\BlockToolType;
|
||||
|
||||
class Pickaxe extends TieredTool{
|
||||
|
||||
public function isPickaxe(){
|
||||
return $this->tier;
|
||||
}
|
||||
|
||||
public function getBlockToolType() : int{
|
||||
return BlockToolType::TYPE_PICKAXE;
|
||||
}
|
||||
|
||||
public function getAttackPoints() : int{
|
||||
return self::getBaseDamageFromTier($this->tier) - 2;
|
||||
}
|
||||
|
@ -24,6 +24,8 @@ declare(strict_types=1);
|
||||
namespace pocketmine\item;
|
||||
|
||||
|
||||
use pocketmine\block\BlockToolType;
|
||||
|
||||
class Shears extends Tool{
|
||||
public function __construct(int $meta = 0){
|
||||
parent::__construct(self::SHEARS, $meta, "Shears");
|
||||
@ -36,4 +38,8 @@ class Shears extends Tool{
|
||||
public function isShears(){
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getBlockToolType() : int{
|
||||
return BlockToolType::TYPE_SHEARS;
|
||||
}
|
||||
}
|
@ -23,12 +23,18 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\item;
|
||||
|
||||
use pocketmine\block\BlockToolType;
|
||||
|
||||
class Shovel extends TieredTool{
|
||||
|
||||
public function isShovel(){
|
||||
return $this->tier;
|
||||
}
|
||||
|
||||
public function getBlockToolType() : int{
|
||||
return BlockToolType::TYPE_SHOVEL;
|
||||
}
|
||||
|
||||
public function getAttackPoints() : int{
|
||||
return self::getBaseDamageFromTier($this->tier) - 3;
|
||||
}
|
||||
|
@ -23,12 +23,18 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\item;
|
||||
|
||||
use pocketmine\block\BlockToolType;
|
||||
|
||||
class Sword extends TieredTool{
|
||||
|
||||
public function isSword(){
|
||||
return $this->tier;
|
||||
}
|
||||
|
||||
public function getBlockToolType() : int{
|
||||
return BlockToolType::TYPE_SWORD;
|
||||
}
|
||||
|
||||
public function getAttackPoints() : int{
|
||||
return self::getBaseDamageFromTier($this->tier);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user