From 334bf1277d6897cbc237b7be5f7c5f6ad7d8e8f1 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 10 Sep 2021 00:31:28 +0100 Subject: [PATCH] BlockTransaction: Return failure if no blocks were changed fixes #2813 --- src/world/BlockTransaction.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/world/BlockTransaction.php b/src/world/BlockTransaction.php index f30d761f3..80bf8445f 100644 --- a/src/world/BlockTransaction.php +++ b/src/world/BlockTransaction.php @@ -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; } /**