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

Relative decimal coordinates with block related commands are inconsistent

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Fixed
    • Affects Version/s: Minecraft 1.10.2, Minecraft 16w32a
    • Labels:
      None
    • Confirmation Status:
      Confirmed

      Description

      Basically, when you use

      /setblock ~.4 ~ ~ stone

      and stand at the most positive side of a block, right against another block, the stone gets placed in you, wheres

      /setblock ~-.4 ~ ~ stone

      and standing at the most negative side of a block is places it at the block next to you.

      See screenshots.

      This issue occures with the following commands:

      • /fill
      • /setblock
      • /blockdata
      • /testforblock
      • /testforblocks
      • /stats block
      • /replaceitem block

      Happens in both single player and multiplayer, so it's not a desync.

      Expected behaviour:

      • The block besides you gets targeted in both cases.

      Reason this happens:
      With these commands the coordinates ignore on what decimal you were in the first place, it get's rounded down to x.0 z.0.
      So standing on the most positive part, and using ~.9999999 still places the block in you as x/y/z.0 +0.9999999 = x/z.9999999 =x/y/z.
      A simple fix could be to round the numbers only after the final coordinates are calculated, rather then rounding down every coordinate provided.
      So basically, the game said: .7 + .4 = .0+.0 = 0 instead of .7 + .4 = 1.1 = 1.


      Code analysis by [Mod] Marcono1234 can be found in this comment.

        Attachments

        1. 2016-08-04_12.12.19.png
          2016-08-04_12.12.19.png
          243 kB
        2. 2016-08-04_12.12.20.png
          2016-08-04_12.12.20.png
          241 kB
        3. 2016-08-04_12.12.25.png
          2016-08-04_12.12.25.png
          251 kB
        4. 2016-08-04_12.12.26.png
          2016-08-04_12.12.26.png
          254 kB

          Issue Links

            Activity

              People

              • Assignee:
                dinnerbone [Mojang] Nathan Adams
                Reporter:
                NoUser No User
              • Votes:
                4 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  CHK: