Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-118863

Effect duration hiding from tooltip does not take duration factor into account

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Resolution: Unresolved
    • Affects Version/s: 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
    • Fix Version/s: None
    • Confirmation Status:
      Confirmed
    • Category:
      (Unassigned)

      Description

      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.

      1. Use the following command
        /give @p tipped_arrow{CustomPotionEffects:[{Id:1b,Amplifier:0b,Duration:20}]}
        
      2. Hover over the item to see the tooltip
        → No duration is shown because it is not greater than 20
      3. Use the following command
        /give @p tipped_arrow{CustomPotionEffects:[{Id:1b,Amplifier:0b,Duration:21}]}
        
      4. 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
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              marcono1234 [Mod] Marcono1234
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                CHK: