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

Macro arguments entered as floats are converted to scientific notation

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 1.20.2 Pre-release 2
    • 1.20.2 Pre-release 1
    • None
    • Confirmed
    • Commands
    • Normal
    • Platform

      The fix for MC-264658 in 1.20.2 Pre-Release 1 seems to have intended to make any numeric type work as a macro argument. However, numbers that can be represented in scientific notation are still passed into functions as such. Which is very problematic, as this cannot be used in most commands.

      How to Reproduce:
      1. Write a data pack namespace that contains a function file called "test" with the following contents.

      $teleport @s ~ ~$(y) ~ ~ ~
      

      2. In the in-game chat, run the following command.

      function <your_namespace>:test {y:0.0005f}
      

      3. Observe the error (which can also be seen in the attached screenshot).
      What Is Expected:

      As can be seen in the error, the macro argument of 0.0005f is interpreted as "5.0E-4", resulting in the following command being parsed.

      teleport @s ~ ~5.0E-4 ~ ~ ~
      

      Due to this interpretation, the teleport command is unable to work.

            timurn [Mojang] Timur Nazarov
            Picarrow Picarrow
            Votes:
            14 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: