PocketMine-MP 5.15.1 git-5ef247620a7c6301a849b54e5ef1009217729fc8
pocketmine\block\BlockBreakInfo Class Reference
+ Collaboration diagram for pocketmine\block\BlockBreakInfo:

Public Member Functions

 __construct (private float $hardness, private int $toolType=BlockToolType::NONE, private int $toolHarvestLevel=0, ?float $blastResistance=null)
 
 breaksInstantly ()
 
 getBlastResistance ()
 
 getBreakTime (Item $item)
 
 getHardness ()
 
 getToolHarvestLevel ()
 
 getToolType ()
 
 isBreakable ()
 
 isToolCompatible (Item $tool)
 

Static Public Member Functions

static axe (float $hardness, ?ToolTier $toolTier=null, ?float $blastResistance=null)
 
static indestructible (float $blastResistance=18000000.0)
 
static instant (int $toolType=BlockToolType::NONE, int $toolHarvestLevel=0)
 
static pickaxe (float $hardness, ?ToolTier $toolTier=null, ?float $blastResistance=null)
 
static shovel (float $hardness, ?ToolTier $toolTier=null, ?float $blastResistance=null)
 
static tier (float $hardness, int $toolType, ToolTier $toolTier, ?float $blastResistance=null)
 

Public Attributes

const COMPATIBLE_TOOL_MULTIPLIER = 1.5
 
const INCOMPATIBLE_TOOL_MULTIPLIER = 5.0
 

Detailed Description

Definition at line 30 of file BlockBreakInfo.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\block\BlockBreakInfo::__construct ( private float  $hardness,
private int  $toolType = BlockToolType::NONE,
private int  $toolHarvestLevel = 0,
?float  $blastResistance = null 
)
Parameters
float | null$blastResistancedefault 5x hardness

Definition at line 47 of file BlockBreakInfo.php.

Member Function Documentation

◆ axe()

static pocketmine\block\BlockBreakInfo::axe ( float  $hardness,
?ToolTier  $toolTier = null,
?float  $blastResistance = null 
)
static

Definition at line 68 of file BlockBreakInfo.php.

◆ breaksInstantly()

pocketmine\block\BlockBreakInfo::breaksInstantly ( )

Returns whether this block can be instantly broken.

Definition at line 97 of file BlockBreakInfo.php.

◆ getBlastResistance()

pocketmine\block\BlockBreakInfo::getBlastResistance ( )

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

Definition at line 104 of file BlockBreakInfo.php.

◆ getBreakTime()

pocketmine\block\BlockBreakInfo::getBreakTime ( Item  $item)

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

Exceptions

InvalidArgumentException if the item efficiency is not a positive number

Definition at line 147 of file BlockBreakInfo.php.

◆ getHardness()

pocketmine\block\BlockBreakInfo::getHardness ( )

Returns a base value used to compute block break times.

Definition at line 83 of file BlockBreakInfo.php.

◆ getToolHarvestLevel()

pocketmine\block\BlockBreakInfo::getToolHarvestLevel ( )

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.

See also
Item::getBlockToolHarvestLevel()

Definition at line 122 of file BlockBreakInfo.php.

◆ getToolType()

pocketmine\block\BlockBreakInfo::getToolType ( )

Definition at line 108 of file BlockBreakInfo.php.

◆ indestructible()

static pocketmine\block\BlockBreakInfo::indestructible ( float  $blastResistance = 18000000.0)
static

Definition at line 76 of file BlockBreakInfo.php.

◆ instant()

static pocketmine\block\BlockBreakInfo::instant ( int  $toolType = BlockToolType::NONE,
int  $toolHarvestLevel = 0 
)
static

Definition at line 72 of file BlockBreakInfo.php.

◆ isBreakable()

pocketmine\block\BlockBreakInfo::isBreakable ( )

Returns whether the block can be broken at all.

Definition at line 90 of file BlockBreakInfo.php.

◆ isToolCompatible()

pocketmine\block\BlockBreakInfo::isToolCompatible ( Item  $tool)

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.

Definition at line 133 of file BlockBreakInfo.php.

◆ pickaxe()

static pocketmine\block\BlockBreakInfo::pickaxe ( float  $hardness,
?ToolTier  $toolTier = null,
?float  $blastResistance = null 
)
static

Definition at line 60 of file BlockBreakInfo.php.

◆ shovel()

static pocketmine\block\BlockBreakInfo::shovel ( float  $hardness,
?ToolTier  $toolTier = null,
?float  $blastResistance = null 
)
static

Definition at line 64 of file BlockBreakInfo.php.

◆ tier()

static pocketmine\block\BlockBreakInfo::tier ( float  $hardness,
int  $toolType,
ToolTier  $toolTier,
?float  $blastResistance = null 
)
static

Definition at line 56 of file BlockBreakInfo.php.

Member Data Documentation

◆ COMPATIBLE_TOOL_MULTIPLIER

const pocketmine\block\BlockBreakInfo::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.

Definition at line 35 of file BlockBreakInfo.php.

◆ INCOMPATIBLE_TOOL_MULTIPLIER

const pocketmine\block\BlockBreakInfo::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.

Definition at line 40 of file BlockBreakInfo.php.


The documentation for this class was generated from the following file: