Skip to content

BlockBreakInfo ​

class · pocketmine\block\BlockBreakInfo · source

Constants ​

COMPATIBLE_TOOL_MULTIPLIER ​

php
public const COMPATIBLE_TOOL_MULTIPLIER = 1.5

If 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 ​

php
public const INCOMPATIBLE_TOOL_MULTIPLIER = 5.0

If the tool is an incorrect type or too low harvest level (tool tier), base break time is hardness multiplied by this value.

Methods ​

__construct() ​

php
public function __construct(float $hardness, int $toolType = \pocketmine\block\BlockToolType::NONE, int $toolHarvestLevel = 0, ?float $blastResistance = null, ?bool $explosionHarvestable = null)

axe() ​

php
public static function axe(float $hardness, ?\pocketmine\item\ToolTier $toolTier = null, ?float $blastResistance = null) : self

breaksInstantly() ​

php
public function breaksInstantly() : bool

Returns whether this block can be instantly broken.

getBlastResistance() ​

php
public function getBlastResistance() : float

Returns the block's resistance to explosions. Usually 5x hardness.

getBreakTime() ​

php
public function getBreakTime(\pocketmine\item\Item $item) : float

Returns the seconds that this block takes to be broken using an specific Item

getHardness() ​

php
public function getHardness() : float

Returns a base value used to compute block break times.

getToolHarvestLevel() ​

php
public function getToolHarvestLevel() : int

Returns 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() ​

php
public function getToolType() : int

indestructible() ​

php
public static function indestructible(float $blastResistance = 18000003.75) : self

instant() ​

php
public static function instant(int $toolType = \pocketmine\block\BlockToolType::NONE, int $toolHarvestLevel = 0) : self

isBreakable() ​

php
public function isBreakable() : bool

Returns whether the block can be broken at all.

isExplosionHarvestable() ​

php
public function isExplosionHarvestable() : bool

Returns 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() ​

php
public function isToolCompatible(\pocketmine\item\Item $tool) : bool

Returns 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() ​

php
public static function pickaxe(float $hardness, ?\pocketmine\item\ToolTier $toolTier = null, ?float $blastResistance = null) : self

shovel() ​

php
public static function shovel(float $hardness, ?\pocketmine\item\ToolTier $toolTier = null, ?float $blastResistance = null) : self

tier() ​

php
public static function tier(float $hardness, int $toolType, \pocketmine\item\ToolTier $toolTier, ?float $blastResistance = null) : self

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.