Running this command when the if condition is true will not change the score at all (value is already preset). This happens even when the score isn't currently set to 0.
/execute store result score @p X if blocks <start> <end> <destination> all
Since "AffectedBlocks" is now part of "result", I expected the command to set the score to the number of blocks found by the "if blocks" section, but that did not happen. The execute command can stand alone as its own command without needing to use "run <some other command>", so that shouldn't be an issue. Adding "run say hi" to the end and activating the command will execute when the if condition is met, but result is set to 1 instead of the expected number of blocks, likely because if stores either a 1(succeeded) or 0(failed). There is currently no way afaik to get the number of affected blocks from testing an area. This wasn't an issue when we had /testforblocks in 1.12. Using /clone isn't acceptable because there is no need to change the blocks, there is only a need to test for a match. I could not find any matches to this issue, or at least nothing appeared to be the same issue that I have.
Comments 3
It is still giving a result of 1 and not a result of how many blocks were affected, again the likely cause is that "if" returns either a 1 or a 0 and the AffectedBlocks stat is just lost. I should note that the area being tested is > 1 block in size. Changing my score to -1, then activating the command sets the score to 1.
/execute store result score @p X if blocks <start> <end> <destination> all
This is inconsistent when using this command:
/execute store result score @p X if entity @e[type=cow]
If I summon 5 cows in a world with no pre-existing cows, and I activate the command, the score will change to 5 as expected.
And that is covered in MC-122216 🙂
You need to put
store result
first, as it applies to the following command 🙂