mojira.dev
MC-120558

Advancement trigger consume_item not working for single potion item stack

The bug

The advancement trigger consume_item is not working for single potion item stacks when consumed in Survival or Adventure mode.

How to reproduce

  1. Download the attached data pack

[media]
  1. and place it in the datapacks folder of your world

  2. Open the world and drink any potion in Survival mode
    → ❌ The advancement is not granted

  3. Drink any potion in Creative mode
    → ✔ The advancement is granted as expected

Code analysis

Based on 1.12.2 decompiled using MCP 9.40

The method net.minecraft.item.ItemPotion.onItemUseFinish(ItemStack, World, EntityLivingBase) reduces the stack size before applying the potion effects and testing advancement triggers. Therefore when the triggers are tested 0*potion (acting like 0*air) is compared.

Reducing the stack size should probably happen right before the glass bottle is added to the inventory.

Linked issues

Attachments

Comments 5

Can confirm. This seems to affect all uses of the nbt field - most notably, "nbt":"{Potion:\"minecraft:swiftness\"}" (i.e. testing the type of the potion). It also does NOT affect milk buckets (testing the name on them), which is interesting.

Still affects 18w05a, please update!

Hello? This was fixed in 19w35a.

Sorry for not replying, and thanks for testing. I'll do a quick test and then resolve.

Tristan Hudson

(Unassigned)

Confirmed

(Unassigned)

advancement, consume_item, potion

Minecraft 1.12, Minecraft 1.12.1, Minecraft 1.12.2 Pre-Release 1, Minecraft 1.12.2 Pre-Release 2, Minecraft 1.12.2, ..., Minecraft 19w08b, Minecraft 19w09a, Minecraft 19w11a, Minecraft 19w11b, 1.14.4

19w35a

Retrieved