mojira.dev
MC-98310

Custom lingering potions & tipped arrows show incorrect duration

The bug

When you give a player a lingering potion or tipped arrow with custom effects, it shows the duration incorrectly; for example, if we use this command:

/give @p minecraft:tipped_arrow{custom_potion_effects:[{id:"minecraft:blindness",amplifier:0,duration:60}]}

It doesn't show 3 seconds at all. However if you were to do

/give @p minecraft:tipped_arrow{custom_potion_effects:[{id:"minecraft:blindness",amplifier:0,duration:600}]}

It shows 3 seconds

Video: https://youtu.be/c7bxWXvj-1o

Code analysis

Code analysis by @unknown can be found in this comment.

Linked issues

MC-96147 Custom tipped arrows have their times wrong Resolved MC-100024 command created custom lingering potions and tipped arrows display wrong time in inventory Resolved MC-105910 Custom tipped arrows do not correctly render effect durations in item tooltip Resolved MC-121202 afected arrow effects stay for more time then requried Resolved MC-158828 Lingering Potions created with the CustomPotionEffects tag show incorrect effect time in tooltip Resolved

Attachments

Comments 46

How long is the effect when you apply it to a mob/player?

The duration in

/give @p minecraft:tipped_arrow 1 0 {CustomPotionEffects:[{Id:15,Amplifier:0,Duration:60}]}

is 3 seconds.

and the duration in

/give @p minecraft:tipped_arrow 1 0 {CustomPotionEffects:[{Id:15,Amplifier:0,Duration:600}]}
is 30 seconds.

To convert seconds to ticks, you would do 20 x number of seconds, and that will get you the conversion in ticks.

Converting ticks to second, you do the number of ticks divided by 20, giving you the conversion in seconds.

20 ticks = a second, Which is why this calculation method works.

Like when you look at the duration of a tipped arrow or potion with custom effects that's in one of your slots, it doesn't show the duration correctly. It appears off by 100 ticks but how off it is, is different depending on the potion/tipped arrow duration; which could be a calculation error. (Not the duration of the potion effect from the side of your inventory)

Yes, I was asking for the actual duration the effect lasts when applied. What is off by 100 ticks from what? How many seconds do the Duration:60/Duration:600 effects actually last in-game?

Duration:60 is 3 seconds, Duration: 600 ticks is 30 seconds. So if I applied the effect of Duration 60 on my self, I get blindness for 3 seconds, applying Duration:600 lasts 30 seconds, just as how I specified it to last. Answering the 100 ticks of question thing: Never mind about it being off by 100 ticks, From doing more experiments, it's off but like it's different for each duration number, It's kind of hard to explain this bug since it has weird behavior with showing the duration and knowing how many ticks off it is; but it's not calculating how many ticks are in a second correctly, which is probably why it shows the duration incorrectly.

I still don't understand where the 100 ticks come in. 600 ticks is 20 seconds. You say the display is off by 100 ticks, so it should display 25s (500 ticks) or 35s (700 ticks).

36 more comments

Can confirm in 23w06a

Affects 23w31a and 1.20.1.

Can confirm in 1.20.4

Can confirm in 1.20.6 and 24w21b.

/give @p minecraft:tipped_arrow[minecraft:potion_contents= {custom_effects: [{id: "minecraft:blindness", amplifier: 0b, duration: 60}]}]
/give @p minecraft:tipped_arrow[minecraft:potion_contents= {custom_effects: [{id: "minecraft:blindness", amplifier: 0b, duration: 600}]}]

Can confirm it in 1.21.5
I hope more people will find this thread with “Tipped arrows incorrect duration bug”

Logical_Cyclops

(Unassigned)

Confirmed

Platform

Normal

Commands

CustomPotionEffects, effect-duration, item-description, potion, tipped_arrow, tooltip

Minecraft 1.9 Pre-Release 4, Minecraft 1.9, Minecraft 1.9.1 Pre-Release 1, Minecraft 1.9.1 Pre-Release 2, Minecraft 1.9.1 Pre-Release 3, ..., 1.19.3, 1.20.1, 23w32a, 1.20.4, 1.21

Retrieved