'execute store' ignores value validation
The bug
/execute store ignores value validation, allowing you to set values which would be considered invalid when used in the respective command.
Partially relevant /r/Mojira discussion
Affected situations
- bossbar max
- bossbar value
- read-only scoreboard objectives
How to reproduce
bossbar max
- Create a bossbar
/bossbar add custom:test "test" - Try setting a negative maximum
/bossbar set custom:test max -1
→
It fails as expected - Create a scoreboard objective and set a negative score
/scoreboard objectives add test dummy /scoreboard players set value test -1
- Try storing the score as bossbar max
/execute store result bossbar custom:test max run scoreboard players get value test
- Get the bossbar max
/bossbar get custom:test max
→
It shows -1
Read only scoreboard objectives
- Create a read only scoreboard objective and have it displayed on the sidebar
/scoreboard objectives add health health /scoreboard objectives setdisplay sidebar health
- Take damage or heal to update the score (see MC-111729)
- Try setting a value for the health objective
/scoreboard players set @s health -1
→
It fails as expected - Create a scoreboard objective and set a negative score
/scoreboard objectives add test dummy /scoreboard players set value test -1
- Try storing the score as value for the read-only objective
/execute store result score @s health run scoreboard players get value test
→
Your health score changed to -1
Created Issue:
execute store ignores value validation
The bug
/execute store ignores value validation, allowing you to set values which would be considered invalid when used in the respective command.
[Partially relevant /r/Mojira discussion|]
Affected situations
- bossbar max
- bossbar value
- read-only scoreboard objectives
How to reproduce
bossbar max
- Create a bossbar
/bossbar create custom:test "test"- Try setting a negative maximum
/bossbar set custom:test max -1→
It fails as expected
- Create a scoreboard objective and set a negative score
/scoreboard objectives add test dummy /scoreboard players set value test -1- Try storing the score as bossbar max
/execute store result bossbar custom:test max run scoreboard players get value test- Get the bossbar max
/bossbar get custom:test max→
It shows -1
Read only scoreboard objectives
- Create a read only scoreboard objective and have it displayed on the sidebar
/scoreboard objectives add health health /scoreboard objectives setdisplay sidebar health- Take damage or heal to update the score (see MC-111729)
- Try setting a value for the health objective
/scoreboard players set @s health -1→
It fails as expected
- Create a scoreboard objective and set a negative score
/scoreboard objectives add test dummy /scoreboard players set value test -1- Try storing the score as value for the read-only objective
/execute store result score @s health run scoreboard players get value test→
Your health score changed to -1
The bug
/execute store ignores value validation, allowing you to set values which would be considered invalid when used in the respective command.
[Partially relevant /r/Mojira discussion|]
Affected situations
- bossbar max
- bossbar value
- read-only scoreboard objectives
How to reproduce
bossbar max
- Create a bossbar
/bossbar create custom:test "test"- Try setting a negative maximum
/bossbar set custom:test max -1→
It fails as expected
- Create a scoreboard objective and set a negative score
/scoreboard objectives add test dummy /scoreboard players set value test -1- Try storing the score as bossbar max
/execute store result bossbar custom:test max run scoreboard players get value test- Get the bossbar max
/bossbar get custom:test max→
It shows -1
Read only scoreboard objectives
- Create a read only scoreboard objective and have it displayed on the sidebar
/scoreboard objectives add health health /scoreboard objectives setdisplay sidebar health- Take damage or heal to update the score (see MC-111729)
- Try setting a value for the health objective
/scoreboard players set @s health -1→
It fails as expected
- Create a scoreboard objective and set a negative score
/scoreboard objectives add test dummy /scoreboard players set value test -1- Try storing the score as value for the read-only objective
/execute store result score @s health run scoreboard players get value test→
Your health score changed to -1
The bug
/execute store ignores value validation, allowing you to set values which would be considered invalid when used in the respective command.
Partially relevant /r/Mojira discussion
Affected situations
- bossbar max
- bossbar value
- read-only scoreboard objectives
How to reproduce
bossbar max
- Create a bossbar
/bossbar create custom:test "test"- Try setting a negative maximum
/bossbar set custom:test max -1→
It fails as expected
- Create a scoreboard objective and set a negative score
/scoreboard objectives add test dummy /scoreboard players set value test -1- Try storing the score as bossbar max
/execute store result bossbar custom:test max run scoreboard players get value test- Get the bossbar max
/bossbar get custom:test max→
It shows -1
Read only scoreboard objectives
- Create a read only scoreboard objective and have it displayed on the sidebar
/scoreboard objectives add health health /scoreboard objectives setdisplay sidebar health- Take damage or heal to update the score (see MC-111729)
- Try setting a value for the health objective
/scoreboard players set @s health -1→
It fails as expected
- Create a scoreboard objective and set a negative score
/scoreboard objectives add test dummy /scoreboard players set value test -1- Try storing the score as value for the read-only objective
/execute store result score @s health run scoreboard players get value test→
Your health score changed to -1
'execute store' ignores value validation
is duplicated by
The bug
/execute store ignores value validation, allowing you to set values which would be considered invalid when used in the respective command.
Partially relevant /r/Mojira discussion
Affected situations
- bossbar max
- bossbar value
- read-only scoreboard objectives
How to reproduce
bossbar max
- Create a bossbar
/bossbarcreatecustom:test "test"- Try setting a negative maximum
/bossbar set custom:test max -1→
It fails as expected
- Create a scoreboard objective and set a negative score
/scoreboard objectives add test dummy /scoreboard players set value test -1- Try storing the score as bossbar max
/execute store result bossbar custom:test max run scoreboard players get value test- Get the bossbar max
/bossbar get custom:test max→
It shows -1
Read only scoreboard objectives
- Create a read only scoreboard objective and have it displayed on the sidebar
/scoreboard objectives add health health /scoreboard objectives setdisplay sidebar health- Take damage or heal to update the score (see MC-111729)
- Try setting a value for the health objective
/scoreboard players set @s health -1→
It fails as expected
- Create a scoreboard objective and set a negative score
/scoreboard objectives add test dummy /scoreboard players set value test -1- Try storing the score as value for the read-only objective
/execute store result score @s health run scoreboard players get value test→
Your health score changed to -1
The bug
/execute store ignores value validation, allowing you to set values which would be considered invalid when used in the respective command.
Partially relevant /r/Mojira discussion
Affected situations
- bossbar max
- bossbar value
- read-only scoreboard objectives
How to reproduce
bossbar max
- Create a bossbar
/bossbar add custom:test "test"- Try setting a negative maximum
/bossbar set custom:test max -1→
It fails as expected
- Create a scoreboard objective and set a negative score
/scoreboard objectives add test dummy /scoreboard players set value test -1- Try storing the score as bossbar max
/execute store result bossbar custom:test max run scoreboard players get value test- Get the bossbar max
/bossbar get custom:test max→
It shows -1
Read only scoreboard objectives
- Create a read only scoreboard objective and have it displayed on the sidebar
/scoreboard objectives add health health /scoreboard objectives setdisplay sidebar health- Take damage or heal to update the score (see MC-111729)
- Try setting a value for the health objective
/scoreboard players set @s health -1→
It fails as expected
- Create a scoreboard objective and set a negative score
/scoreboard objectives add test dummy /scoreboard players set value test -1- Try storing the score as value for the read-only objective
/execute store result score @s health run scoreboard players get value test→
Your health score changed to -1
relates to
is duplicated by
Possibly duplicates MC-124717, when the pig is dead a max value of 0 is set which is not valid.
Does MC-124717 describe the problem?
Wither's and Ender Dragon's bossbar ignore health value changes if boss has NoAI:1b, it's not the case in the raids however.
How to reproduce
1.type
/effect give @p strenght 999999 20
2.summon a wither or go to the end
3.hit wither/enderdragon and watch the bar go down
4.type
/data merge @e[type=wither,limit=1] {NoAI:1b}
or
/data merge @e[type=ender_dragon,limit=1] {NoAI:1b}
5.hit boss again and see the bar NOT going down
6.type
/data merge @e[type=wither,limit=1] {NoAI:0b}
or
/data merge @e[type=ender_dragon,limit=1] {NoAI:0b}
and watch the bar go down then instead
May be related to MC-124717
Dupe of MC-124717
Reproduce from MC-124717: Malfunctioning boss HP bar
/bossbar add a "The Archer"
/bossbar set a visible true
/bossbar set a players @a
/execute store result bossbar a max run data get entity b c
/bossbar set a value 0
/bossbar set a max 100
/bossbar set a value 75
Look up the boss health bar title shows as The Archer and percentage shows up with zero percent.
then
/bossbar set a value 100
Reproduce from MC-165036: An second boss bar with notched styles is messed up
/bossbar add b "[Mod] Avoma"
/bossbar add c "Nuclear Creeper"
/bossbar set b value 1
/bossbar set b max 1
/bossbar set c value 1
/bossbar set c max 1
/bossbar set b style notched_20
/bossbar set c style notched_20
/bossbar set b visible true
/bossbar set c visible true
/bossbar set b players @a
/bossbar set c players @a
Look up the boss bar title shows as Nuclear Creeper with boss health bar with notched styles has been messed up. 2nd boss bar looks like the LED Dot.
This bug needs to be fixed of 1.17.2
Confirm for 18w22c
I tried to do some tests directly with NBT tags with the following commands in minecraft:repeating_command_block:
When you create bossbar before executing previous commands and after you execute commands, no problems, it works.
But when the targeted entity dies, it broken.
After that, I tried another test with only "set value" of bossbar and no problems even if the targeted entity die and after yo summon another entity.
I think the problem is when you set the max value in the same time you set the value of the bossbar.
the only way I found to solve this problem is to remove the bossbar and recreate it.
New fact, it's only a visual bug, when you test with the "get" command, these are the expected values.
And when you quit the world et reopen it, the problem is solved.
Confirm for 1.13-pre1
I found the best way to fix it, just set the visibility to false, and after reset to true, it works but not as expected by the game ...
Confirm for 1.13-pre2
Confirmed for 1.13.1.
Can confirm in 21w03a.
Can confirm in 21w06a.