mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-14 07:25:31 +00:00
Refactor Block->getResistance() -> Block->getBlastResistance() and added some documentation
This commit is contained in:
parent
216fc6fe31
commit
eeedcf7332
@ -74,7 +74,7 @@ class Air extends Transparent{
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getResistance() : float{
|
public function getBlastResistance() : float{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ class Anvil extends Fallable{
|
|||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getResistance() : float{
|
public function getBlastResistance() : float{
|
||||||
return 6000;
|
return 6000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ class Bedrock extends Solid{
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getResistance() : float{
|
public function getBlastResistance() : float{
|
||||||
return 18000000;
|
return 18000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -531,6 +531,7 @@ class Block extends Position implements BlockIds, Metadatable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Returns a base value used to compute block break times.
|
||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
public function getHardness() : float{
|
public function getHardness() : float{
|
||||||
@ -538,9 +539,18 @@ class Block extends Position implements BlockIds, Metadatable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @deprecated
|
||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
public function getResistance() : float{
|
public function getResistance() : float{
|
||||||
|
return $this->getBlastResistance();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the block's resistance to explosions. Usually 5x hardness.
|
||||||
|
* @return float
|
||||||
|
*/
|
||||||
|
public function getBlastResistance() : float{
|
||||||
return $this->getHardness() * 5;
|
return $this->getHardness() * 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ class BrickStairs extends Stair{
|
|||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getResistance() : float{
|
public function getBlastResistance() : float{
|
||||||
return 30;
|
return 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ class Bricks extends Solid{
|
|||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getResistance() : float{
|
public function getBlastResistance() : float{
|
||||||
return 30;
|
return 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ class EnchantingTable extends Transparent{
|
|||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getResistance() : float{
|
public function getBlastResistance() : float{
|
||||||
return 6000;
|
return 6000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ class EndPortalFrame extends Solid{
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getResistance() : float{
|
public function getBlastResistance() : float{
|
||||||
return 18000000;
|
return 18000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ abstract class Flowable extends Transparent{
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getResistance() : float{
|
public function getBlastResistance() : float{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class WoodenStairs extends Stair{
|
|||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getResistance() : float{
|
public function getBlastResistance() : float{
|
||||||
return 15;
|
return 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ class Explosion{
|
|||||||
$block = $this->level->getBlock($vBlock);
|
$block = $this->level->getBlock($vBlock);
|
||||||
|
|
||||||
if($block->getId() !== 0){
|
if($block->getId() !== 0){
|
||||||
$blastForce -= ($block->getResistance() / 5 + 0.3) * $this->stepLen;
|
$blastForce -= ($block->getBlastResistance() / 5 + 0.3) * $this->stepLen;
|
||||||
if($blastForce > 0){
|
if($blastForce > 0){
|
||||||
if(!isset($this->affectedBlocks[$index = Level::blockHash($block->x, $block->y, $block->z)])){
|
if(!isset($this->affectedBlocks[$index = Level::blockHash($block->x, $block->y, $block->z)])){
|
||||||
$this->affectedBlocks[$index] = $block;
|
$this->affectedBlocks[$index] = $block;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user