-
Bug
-
Resolution: Unresolved
-
None
-
Minecraft 1.12, Minecraft 1.12.1 Pre-Release 1, Minecraft 1.12.1, Minecraft 1.13, Minecraft 1.13.1-pre1, Minecraft 1.13.1, Minecraft 1.13.2, Minecraft 19w03b, Minecraft 19w03c, 1.16.2 Pre-release 1, 20w46a, 1.16.5, 21w05b, 21w06a, 21w08b, 1.20.1, 23w32a
-
Confirmed
-
(Unassigned)
The bug
The tooltip of items which apply effects like tipped arrows or potions is supposed to not show the duration if it is less than or equal to 20. It does however not consider the duration factor which is for example for tipped arrows 1 / 8 resulting in the tooltip showing 0:00 as duration.
How to reproduce
This can currently easily be reproduced using MC-98310. Once that bug is fixed this bug cannot be seen without looking at or modifying the code.
- Use the following command
/give @p tipped_arrow{custom_potion_effects:[{id:speed,amplifier:0b,duration:20}]}
- Hover over the item to see the tooltip
→ No duration is shown because it is not greater than 20 - Use the following command
/give @p tipped_arrow{custom_potion_effects:[{id:speed,amplifier:0b,duration:21}]}
- Hover over the item to see the tooltip
→ It shows "0:00" as duration
Code analysis
Based on 1.12 decompiled using MCP 9.40 PRE 1
The method net.minecraft.potion.PotionUtils.addPotionTooltip(ItemStack, List<String>, float) does not take the durationFactor into account when testing if the duration is higher than 20. It should instead test for the following:
potioneffect.getDuration() * durationFactor > 20
- relates to
-
MC-98310 Custom lingering potions & tipped arrows show incorrect duration
- Reopened