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

Small accumulating precision errors when repeatedly teleporting using ^ ^ ^ coordinates

XMLWordPrintable

    • Community Consensus
    • Commands

      Using ~ ~ ~ coordinates everything works fine, but if we teleport the entity using ^ ^ ^ coordinates, after a couple of triggers they will get messed up.

      For example, let's summon a cat:
      /summon cat 0 27 0 {NoAI:1b}

      We'll teleport him a few times using ^ ^ ^:
      /execute as @n[type=cat] at @s run tp @s ^ ^ ^0.1

      Let's see what coordinates he's on and see if he's in the wrong position:
      /data get entity @n[type=cat] Pos

      I make a game where the entity moves on 0.1 cell every tick, and in a certain place I need in 25 steps to perform an action, but because of the strange coordinate system on the 25th step it turns out that it is not on the 2.5 coordinate but somewhere 2.49998.....

      I have to force a 26th step, but it will be counted one cell more.

            Unassigned Unassigned
            banjo43 mixquartz
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: