mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 08:44:01 +00:00
BlockBreakInfo: Expose hardness multipliers as constants
This commit is contained in:
parent
7a35fdb1bb
commit
1d8f0033af
@ -27,6 +27,16 @@ use pocketmine\item\Item;
|
||||
use function get_class;
|
||||
|
||||
class BlockBreakInfo{
|
||||
/**
|
||||
* If the tool is the correct type and high enough harvest level (tool tier), base break time is hardness multiplied
|
||||
* by this value.
|
||||
*/
|
||||
public const COMPATIBLE_TOOL_MULTIPLIER = 1.5;
|
||||
/**
|
||||
* If the tool is an incorrect type or too low harvest level (tool tier), base break time is hardness multiplied by
|
||||
* this value.
|
||||
*/
|
||||
public const INCOMPATIBLE_TOOL_MULTIPLIER = 5.0;
|
||||
|
||||
private float $hardness;
|
||||
private float $blastResistance;
|
||||
@ -121,9 +131,9 @@ class BlockBreakInfo{
|
||||
public function getBreakTime(Item $item) : float{
|
||||
$base = $this->hardness;
|
||||
if($this->isToolCompatible($item)){
|
||||
$base *= 1.5;
|
||||
$base *= self::COMPATIBLE_TOOL_MULTIPLIER;
|
||||
}else{
|
||||
$base *= 5;
|
||||
$base *= self::INCOMPATIBLE_TOOL_MULTIPLIER;
|
||||
}
|
||||
|
||||
$efficiency = $item->getMiningEfficiency(($this->toolType & $item->getBlockToolType()) !== 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user