The bug
The statistic minecraft.used:minecraft.firework_rocket
is incremented when a firework rocket is launched normally, but not when it is used to boost an elytra.
There appears to be no reliable way to detect the usage of a rocket as a booster using commands.
Steps to Reproduce:
Run the following commands:
/scoreboard objectives add firework minecraft.used:minecraft.firework_rocket
/scoreboard objectives setdisplay sidebar firework
/scoreboard players set @a firework 0
Launch a firework rocket on the ground normally.
→ ✔ The scores increased by 1.
Fly with an elytra and boost yourself with a firework rocket.
→ ❌ The score does not increase.
Code analysis
Code analysis by @unknown can be found in this comment.
Linked issues
is duplicated by 5
Attachments
Comments 11
Can confirm in 21w05b. Here are some steps to reproduce this issue:
Steps to Reproduce:
Run the following commands:
/scoreboard objectives add firework minecraft.used:minecraft.firework_rocket
/scoreboard objectives setdisplay sidebar firework
/scoreboard players set @a firework 0
Launch a firework rocket on the ground normally.
→ ✔ The scores increased by 1.Fly with an elytra and boost yourself with a firework rocket.
→ ❌ The score does not increase.
This happens because the stats are increased automatically when a right click on a block succeeds, and all items that can be right clicked in the air have their own code to increase stats. The fireworks don't have any of that code, so they use the automatic stat increasing system when right clicked on a block, but no stats are modified when it's right clicked in air (to boost elytra flight).
The fix would be to add that one line of code to increase the use stats when fireworks are right clicked in air. Using MCP names, that would be
playerIn.addStat(StatList.getObjectUseStats(this));
inside
ItemFireworks.onItemRightClick
.