BlockBreakInfo
Constants
COMPATIBLE_TOOL_MULTIPLIER
public const COMPATIBLE_TOOL_MULTIPLIER = 1.5If the tool is the correct type and high enough harvest level (tool tier), base break time is hardness multiplied by this value.
INCOMPATIBLE_TOOL_MULTIPLIER
public const INCOMPATIBLE_TOOL_MULTIPLIER = 5.0If the tool is an incorrect type or too low harvest level (tool tier), base break time is hardness multiplied by this value.
Methods
__construct()
public function __construct(float $hardness, int $toolType = \pocketmine\block\BlockToolType::NONE, int $toolHarvestLevel = 0, ?float $blastResistance = null, ?bool $explosionHarvestable = null)axe()
public static function axe(float $hardness, ?\pocketmine\item\ToolTier $toolTier = null, ?float $blastResistance = null) : selfbreaksInstantly()
public function breaksInstantly() : boolReturns whether this block can be instantly broken.
getBlastResistance()
public function getBlastResistance() : floatReturns the block's resistance to explosions. Usually 5x hardness.
getBreakTime()
public function getBreakTime(\pocketmine\item\Item $item) : floatReturns the seconds that this block takes to be broken using an specific Item
getHardness()
public function getHardness() : floatReturns a base value used to compute block break times.
getToolHarvestLevel()
public function getToolHarvestLevel() : intReturns the level of tool required to harvest the block (for normal blocks). When the tool type matches the block's required tool type, the tool must have a harvest level greater than or equal to this value to be able to successfully harvest the block.
If the block requires a specific minimum tier of tiered tool, the minimum tier required should be returned. Otherwise, 1 should be returned if a tool is required, 0 if not.
getToolType()
public function getToolType() : intindestructible()
public static function indestructible(float $blastResistance = 18000003.75) : selfinstant()
public static function instant(int $toolType = \pocketmine\block\BlockToolType::NONE, int $toolHarvestLevel = 0) : selfisBreakable()
public function isBreakable() : boolReturns whether the block can be broken at all.
isExplosionHarvestable()
public function isExplosionHarvestable() : boolReturns whether an explosion can harvest resources from the block, as if a compatible tool was used. If this returns true, required harvest level and tool type will be ignored when calculating drops for explosions. Otherwise, the block will behave as if it was broken with an empty hand.
Note: If the required harvest level is 0, this has no effect.
isToolCompatible()
public function isToolCompatible(\pocketmine\item\Item $tool) : boolReturns whether the specified item is the proper tool to use for breaking this block. This checks tool type and harvest level requirement.
In most cases this is also used to determine whether block drops should be created or not, except in some special cases such as vines.
pickaxe()
public static function pickaxe(float $hardness, ?\pocketmine\item\ToolTier $toolTier = null, ?float $blastResistance = null) : selfshovel()
public static function shovel(float $hardness, ?\pocketmine\item\ToolTier $toolTier = null, ?float $blastResistance = null) : selftier()
public static function tier(float $hardness, int $toolType, \pocketmine\item\ToolTier $toolTier, ?float $blastResistance = null) : self