FallableTrait: fixed logic for block replacement

closes #5126

I don't know why it wasn't done this way to begin with. FallingBlock always used canBeReplaced()...
This commit is contained in:
Dylan K. Taylor 2022-07-06 16:16:49 +01:00
parent f031c3c602
commit 269b6ed16a
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -24,9 +24,6 @@ declare(strict_types=1);
namespace pocketmine\block\utils;
use pocketmine\block\Block;
use pocketmine\block\BlockLegacyIds;
use pocketmine\block\Fire;
use pocketmine\block\Liquid;
use pocketmine\block\VanillaBlocks;
use pocketmine\entity\Location;
use pocketmine\entity\object\FallingBlock;
@ -50,7 +47,7 @@ trait FallableTrait{
public function onNearbyBlockChange() : void{
$pos = $this->getPosition();
$down = $pos->getWorld()->getBlock($pos->getSide(Facing::DOWN));
if($down->getId() === BlockLegacyIds::AIR || $down instanceof Liquid || $down instanceof Fire){
if($down->canBeReplaced()){
$pos->getWorld()->setBlock($pos, VanillaBlocks::AIR());
$block = $this;