BlockTransaction: Return failure if no blocks were changed

fixes #2813
This commit is contained in:
Dylan K. Taylor 2021-09-10 00:31:28 +01:00
parent 082f0f2d57
commit 334bf1277d
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -95,10 +95,15 @@ class BlockTransaction{
}
}
}
$changedBlocks = 0;
foreach($this->getBlocks() as [$x, $y, $z, $block]){
$this->world->setBlockAt($x, $y, $z, $block);
$oldBlock = $this->world->getBlockAt($x, $y, $z);
if(!$oldBlock->isSameState($block)){
$this->world->setBlockAt($x, $y, $z, $block);
$changedBlocks++;
}
}
return true;
return $changedBlocks !== 0;
}
/**