mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-13 06:55:29 +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;
|
namespace pocketmine\item;
|
||||||
|
|
||||||
|
use pocketmine\block\BlockToolType;
|
||||||
|
|
||||||
class Axe extends TieredTool{
|
class Axe extends TieredTool{
|
||||||
|
|
||||||
public function isAxe(){
|
public function isAxe(){
|
||||||
return $this->tier;
|
return $this->tier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getBlockToolType() : int{
|
||||||
|
return BlockToolType::TYPE_AXE;
|
||||||
|
}
|
||||||
|
|
||||||
public function getAttackPoints() : int{
|
public function getAttackPoints() : int{
|
||||||
return self::getBaseDamageFromTier($this->tier) - 1;
|
return self::getBaseDamageFromTier($this->tier) - 1;
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ namespace pocketmine\item;
|
|||||||
|
|
||||||
use pocketmine\block\Block;
|
use pocketmine\block\Block;
|
||||||
use pocketmine\block\BlockFactory;
|
use pocketmine\block\BlockFactory;
|
||||||
|
use pocketmine\block\BlockToolType;
|
||||||
use pocketmine\entity\Entity;
|
use pocketmine\entity\Entity;
|
||||||
use pocketmine\item\enchantment\Enchantment;
|
use pocketmine\item\enchantment\Enchantment;
|
||||||
use pocketmine\level\Level;
|
use pocketmine\level\Level;
|
||||||
@ -741,6 +742,16 @@ class Item implements ItemIds, \JsonSerializable{
|
|||||||
return false;
|
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.
|
* Returns the maximum amount of damage this item can take before it breaks.
|
||||||
*
|
*
|
||||||
|
@ -23,12 +23,18 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace pocketmine\item;
|
namespace pocketmine\item;
|
||||||
|
|
||||||
|
use pocketmine\block\BlockToolType;
|
||||||
|
|
||||||
class Pickaxe extends TieredTool{
|
class Pickaxe extends TieredTool{
|
||||||
|
|
||||||
public function isPickaxe(){
|
public function isPickaxe(){
|
||||||
return $this->tier;
|
return $this->tier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getBlockToolType() : int{
|
||||||
|
return BlockToolType::TYPE_PICKAXE;
|
||||||
|
}
|
||||||
|
|
||||||
public function getAttackPoints() : int{
|
public function getAttackPoints() : int{
|
||||||
return self::getBaseDamageFromTier($this->tier) - 2;
|
return self::getBaseDamageFromTier($this->tier) - 2;
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,8 @@ declare(strict_types=1);
|
|||||||
namespace pocketmine\item;
|
namespace pocketmine\item;
|
||||||
|
|
||||||
|
|
||||||
|
use pocketmine\block\BlockToolType;
|
||||||
|
|
||||||
class Shears extends Tool{
|
class Shears extends Tool{
|
||||||
public function __construct(int $meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
parent::__construct(self::SHEARS, $meta, "Shears");
|
parent::__construct(self::SHEARS, $meta, "Shears");
|
||||||
@ -36,4 +38,8 @@ class Shears extends Tool{
|
|||||||
public function isShears(){
|
public function isShears(){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getBlockToolType() : int{
|
||||||
|
return BlockToolType::TYPE_SHEARS;
|
||||||
|
}
|
||||||
}
|
}
|
@ -23,12 +23,18 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace pocketmine\item;
|
namespace pocketmine\item;
|
||||||
|
|
||||||
|
use pocketmine\block\BlockToolType;
|
||||||
|
|
||||||
class Shovel extends TieredTool{
|
class Shovel extends TieredTool{
|
||||||
|
|
||||||
public function isShovel(){
|
public function isShovel(){
|
||||||
return $this->tier;
|
return $this->tier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getBlockToolType() : int{
|
||||||
|
return BlockToolType::TYPE_SHOVEL;
|
||||||
|
}
|
||||||
|
|
||||||
public function getAttackPoints() : int{
|
public function getAttackPoints() : int{
|
||||||
return self::getBaseDamageFromTier($this->tier) - 3;
|
return self::getBaseDamageFromTier($this->tier) - 3;
|
||||||
}
|
}
|
||||||
|
@ -23,12 +23,18 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace pocketmine\item;
|
namespace pocketmine\item;
|
||||||
|
|
||||||
|
use pocketmine\block\BlockToolType;
|
||||||
|
|
||||||
class Sword extends TieredTool{
|
class Sword extends TieredTool{
|
||||||
|
|
||||||
public function isSword(){
|
public function isSword(){
|
||||||
return $this->tier;
|
return $this->tier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getBlockToolType() : int{
|
||||||
|
return BlockToolType::TYPE_SWORD;
|
||||||
|
}
|
||||||
|
|
||||||
public function getAttackPoints() : int{
|
public function getAttackPoints() : int{
|
||||||
return self::getBaseDamageFromTier($this->tier);
|
return self::getBaseDamageFromTier($this->tier);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user