mojira.dev
MC-112991

Carrot/Warped fungus on a stick usage statistic value is increased even if item is not used

The bug

When you right click with a carrot on a stick it always increases the usage statistic value for it even if you did not really use it.

I know that this is a technique used by map makers, but it would be better to have a generic way to detect right clicks than to rely on situations like this.

How to reproduce

  1. Add an objective with the minecraft.used:minecraft.carrot_on_a_stick criteria, set it to display on your sidebar, and set your score to 0 so it displays

    /scoreboard objectives add carrotOnAStick minecraft.used:minecraft.carrot_on_a_stick
    /scoreboard objectives setdisplay sidebar carrotOnAStick
    /scoreboard players set @s carrotOnAStick 0
  2. Right click with a carrot on a stick while not riding a pig

Code analysis

Based on 1.11.2 decompiled using MCP 9.35 rc1

The method net.minecraft.item.ItemCarrotOnAStick.onItemRightClick(World, EntityPlayer, EnumHand) always increases the usage statistic value.

Linked issues

Attachments

Comments 16

The statistic stat.useItem tracks how many times you use the "use" key while holding an item. For example, if you do /scoreboard objectives add Stick stat.useItem.minecraft.stick it will tell you how many times you right clicked with a stick in your hand.

No, it tracks how often you perform the item's use. stat.useItem.minecraft.stick is never incremented. Items with different uses increment at different times. For example – throwing a snowball, eating a porkchop, attacking with a sword, planting seeds. Simply right-clicking with the seeds won't increment the stat unless they were planted.

Confirmed for 1.13.1.

Confirmed for 1.13.2-pre2.

I'd like to point out that this issue creates a gateway for custom active items to be implemented in maps. Carrot on a stick can be used as a "unversral right click detector", and paired with a resource pack durability predecate for textures, to generate up to 26 custom items - or even more if negative durability values are used.

The rare case of having to detect a pig speed boosted with a carrot on a stick over unmodded custom items, this is a tough choice indeed

6 more comments

Can confirm in 21w13a.

Can confirm in 21w15a.

Can confirm in 21w17a.

Please don't fix this this is essential for mapmaking.

As I already pointed out in the past, there are alternatives, such as fishing rods, where it's not a mistake. That said, this got a WF resolution, meaning that they won't go out their way to fix it, but if it gets fixed, they won't reverse it.

marcono1234

(Unassigned)

Confirmed

Items

carrot_on_a_stick, interact, scoreboard, statistics

Minecraft 1.11.2, Minecraft 1.12, Minecraft 1.12.2, Minecraft 17w47b, Minecraft 18w01a, ..., 21w05b, 21w06a, 21w13a, 21w15a, 21w17a

Retrieved