mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 08:44:01 +00:00
SurvivalBlockBreakHandler: remove useless code
This commit is contained in:
parent
1d22761d27
commit
4f816d03a7
@ -1518,8 +1518,8 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!$this->isCreative()){
|
||||
$this->blockBreakHandler = SurvivalBlockBreakHandler::createIfNecessary($this, $pos, $target, $face, 16);
|
||||
if(!$this->isCreative() && !$block->getBreakInfo()->breaksInstantly()){
|
||||
$this->blockBreakHandler = new SurvivalBlockBreakHandler($this, $pos, $target, $face, 16);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -59,7 +59,7 @@ final class SurvivalBlockBreakHandler{
|
||||
/** @var float */
|
||||
private $breakProgress = 0;
|
||||
|
||||
private function __construct(Player $player, Vector3 $blockPos, Block $block, int $targetedFace, int $maxPlayerDistance, int $fxTickInterval = self::DEFAULT_FX_INTERVAL_TICKS){
|
||||
public function __construct(Player $player, Vector3 $blockPos, Block $block, int $targetedFace, int $maxPlayerDistance, int $fxTickInterval = self::DEFAULT_FX_INTERVAL_TICKS){
|
||||
$this->player = $player;
|
||||
$this->blockPos = $blockPos;
|
||||
$this->block = $block;
|
||||
@ -76,14 +76,6 @@ final class SurvivalBlockBreakHandler{
|
||||
}
|
||||
}
|
||||
|
||||
public static function createIfNecessary(Player $player, Vector3 $blockPos, Block $block, int $targetedFace, int $maxPlayerDistance, int $fxTickInterval = self::DEFAULT_FX_INTERVAL_TICKS) : ?self{
|
||||
$breakInfo = $block->getBreakInfo();
|
||||
if(!$breakInfo->breaksInstantly()){
|
||||
return new self($player, $blockPos, $block, $targetedFace, $maxPlayerDistance, $fxTickInterval);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the calculated break speed as percentage progress per game tick.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user