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

Calculation bug with saturation/float

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • None
    • Minecraft 1.13.1
    • None
    • At least Minecraft Vanilla 1.12.2 or 1.13.1. On a Server or Singleplayer. I have Java 8 Update 181 and Windows 10.
    • Unconfirmed

      I'll try to keep it very simple. When you eat many potatos (unbaked) from food-level 0 up to 20, then there occurres an calculation bug from Java. You can test it, when you add like 16 times the number 0.6 on a float and look up every number in the calculation. You can see there are some numbers like 1.8000001 or 7.1999993.

      The Problem: When the Saturation starts to raise the health-bar, the Saturation sinks until it reached a very small number (like 1.70392E-6), which minecraft dosn't lower any more, but it isn't 0. When the player dosn't move, then this saturation last for at least a long time and the player won't lose any food-level.

       

      Reconstruate this bug: Go down to like 2 full hearth and 0 food. Then eat normal potatos until you are full and wait what happen. 

       

      To fix this problem you can round every number onto the first decimal.

            Unassigned Unassigned
            Cann99 Can-Leon Petermöller
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: