BlockBreakInfo
in package
Table of Contents
- 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 = 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.
- $blastResistance : float
- $hardness : float
- $toolHarvestLevel : int
- $toolType : int
- __construct() : mixed
- breaksInstantly() : bool
- Returns whether this block can be instantly broken.
- getBlastResistance() : float
- Returns the block's resistance to explosions. Usually 5x hardness.
- getBreakTime() : float
- Returns the seconds that this block takes to be broken using an specific Item
- getHardness() : float
- Returns a base value used to compute block break times.
- 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.
- getToolType() : int
- indestructible() : self
- instant() : self
- isBreakable() : bool
- Returns whether the block can be broken at all.
- isToolCompatible() : bool
- Returns whether the specified item is the proper tool to use for breaking this block. This checks tool type and harvest level requirement.
Constants
COMPATIBLE_TOOL_MULTIPLIER
If the tool is the correct type and high enough harvest level (tool tier), base break time is hardness multiplied by this value.
public
mixed
COMPATIBLE_TOOL_MULTIPLIER
= 1.5
INCOMPATIBLE_TOOL_MULTIPLIER
If the tool is an incorrect type or too low harvest level (tool tier), base break time is hardness multiplied by this value.
public
mixed
INCOMPATIBLE_TOOL_MULTIPLIER
= 5.0
Properties
$blastResistance
private
float
$blastResistance
$hardness
private
float
$hardness
$toolHarvestLevel
private
int
$toolHarvestLevel
$toolType
private
int
$toolType
Methods
__construct()
public
__construct(float $hardness[, int $toolType = BlockToolType::NONE ][, int $toolHarvestLevel = 0 ][, float|null $blastResistance = null ]) : mixed
Parameters
- $hardness : float
- $toolType : int = BlockToolType::NONE
- $toolHarvestLevel : int = 0
- $blastResistance : float|null = null
-
default 5x hardness
Return values
mixed —breaksInstantly()
Returns whether this block can be instantly broken.
public
breaksInstantly() : bool
Return values
bool —getBlastResistance()
Returns the block's resistance to explosions. Usually 5x hardness.
public
getBlastResistance() : float
Return values
float —getBreakTime()
Returns the seconds that this block takes to be broken using an specific Item
public
getBreakTime(Item $item) : float
Parameters
- $item : Item
Tags
Return values
float —getHardness()
Returns a base value used to compute block break times.
public
getHardness() : float
Return values
float —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.
public
getToolHarvestLevel() : int
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.
Tags
Return values
int —getToolType()
public
getToolType() : int
Return values
int —indestructible()
public
static indestructible([float $blastResistance = 18000000.0 ]) : self
Parameters
- $blastResistance : float = 18000000.0
Return values
self —instant()
public
static instant([int $toolType = BlockToolType::NONE ][, int $toolHarvestLevel = 0 ]) : self
Parameters
- $toolType : int = BlockToolType::NONE
- $toolHarvestLevel : int = 0
Return values
self —isBreakable()
Returns whether the block can be broken at all.
public
isBreakable() : bool
Return values
bool —isToolCompatible()
Returns whether the specified item is the proper tool to use for breaking this block. This checks tool type and harvest level requirement.
public
isToolCompatible(Item $tool) : bool
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.
Parameters
- $tool : Item