From 5e9ce92b555b390cc75dee370d5fb91e1cc7023f Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 25 Mar 2021 23:17:33 +0000 Subject: [PATCH] Explosion: don't depend on air having stateID 0 --- src/block/Air.php | 2 +- src/world/Explosion.php | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/block/Air.php b/src/block/Air.php index f5408c00bf..ae201328f0 100644 --- a/src/block/Air.php +++ b/src/block/Air.php @@ -31,7 +31,7 @@ use pocketmine\math\AxisAlignedBB; class Air extends Transparent{ public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::indestructible(0.0)); + parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::indestructible(-1.0)); } public function canBeFlowedInto() : bool{ diff --git a/src/world/Explosion.php b/src/world/Explosion.php index d750ee0ac2..db27b472e0 100644 --- a/src/world/Explosion.php +++ b/src/world/Explosion.php @@ -130,8 +130,9 @@ class Explosion{ $state = $this->subChunkExplorer->currentSubChunk->getFullBlock($vBlockX & 0x0f, $vBlockY & 0x0f, $vBlockZ & 0x0f); - if($state !== 0){ - $blastForce -= ($blockFactory->blastResistance[$state] / 5 + 0.3) * $this->stepLen; + $blastResistance = $blockFactory->blastResistance[$state]; + if($blastResistance >= 0){ + $blastForce -= ($blastResistance / 5 + 0.3) * $this->stepLen; if($blastForce > 0){ if(!isset($this->affectedBlocks[World::blockHash($vBlockX, $vBlockY, $vBlockZ)])){ $_block = $blockFactory->fromFullBlock($state);