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

Network position deltas are processed relative to a wrong point

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 1.21 Pre-Release 1
    • 1.15.2, 20w06a, 20w07a, 20w08a, 20w10a, 20w11a, 20w12a, 20w14a, 20w15a, 20w18a, 20w22a, 1.16 Pre-release 2, 1.16 Pre-release 8, 1.16.1, 20w28a, 1.16.2 Pre-release 1, 1.16.5, 21w16a, 1.17 Pre-release 2, 1.18.1, 22w05a, 22w07a, 1.19, 22w24a
    • Confirmed
    • Networking

      Steps to reproduce

      • Run a minecart in a loop (see the screenshot below)
      • Teleport 100 blocks away and wait a few seconds (/tp ~100 ~ ~)
      • Teleport back (/tp ~-100 ~ ~)

      The minecart appears to be travelling at an offset from the track. It might take a few tries. Make sure the chunks don't unload when you teleport away.

      Code analysis

      When a player starts to see an entity, the server sends the entity's current position to the client. But an entity also has another, internal position used for sending and calculating relative motion updates. This position doesn't get sent to the client with the spawning packets, so every consecutive relative motion packet is incorrectly applied. This continues until the next absolute position sync.

      A proposed fix is to include the internal encoded position (ServerEntity.xp/yp/zp) in entity spawning packets and set it on the client (Entity.xp/yp/zp).

      This only affects entities which are moving when they come into the player's tracking range and have already existed on the server side for some time.

      Also, looking at ServerEntity.sendChanges(), the position is supposed to resync every, what appears to be, 20s (400t) but the timer which tracks that gets incremented only every updateInterval ticks (e.g. arrows get resynced every 400s). I'm not sure if that's intended.

      This bug is related to MC-342, MC-2783 and probably many other similar issues.

      Trivia:
      This is a very old bug. I was able to reproduce it on alpha 1.1.2_01, one of the first multiplayer versions.

            Unassigned Unassigned
            Zonteek Zonteek
            Votes:
            9 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: