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
is duplicated by 12
relates to 1
Attachments
Comments 46
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).
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}]}]
How long is the effect when you apply it to a mob/player?