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

Players appear offset for other clients after going through nether portals

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Minecraft 13w43a
    • Minecraft 1.5.2, Minecraft 1.6.1, Minecraft 1.6.2, Minecraft 1.6.4, Minecraft 13w36a, Minecraft 13w36b, Minecraft 13w37a, Minecraft 13w39a, Minecraft 13w39b, Minecraft 13w41b
    • Confirmed

      When you leave or enter the nether in multiplayer you don't appear at the right location for other clients.
      This video shows the bug: http://youtu.be/c1zM8gFB3ro

      Here is why this happens: When a player goes through a portal his x- and z-coordinate get multiplied/divided by 8. Then the entity gets spawned in to other dimension.
      And after that the player gets moved into the portal where he should spawn. But the last repositioning isn't send to the other clients. Therefor they see the player at x*8, y, z*8 or x/8, y, z/8 (depending if the player left or entered the nether).

      To fix this bug we either need to send the absolute coordinates to the other clients after the repositioning or to place the player in the portal before it gets spawned into the world.

      Here is how I programmed the second fix with MCP:
      In ServerConfigurationManager.java I changed line 507 to 510 from

      par4WorldServer.spawnEntityInWorld(par1Entity); //Spawns the entity
      par1Entity.setLocationAndAngles(var5, par1Entity.posY, var7, par1Entity.rotationYaw, par1Entity.rotationPitch); //Sets the position to x*8, y, z*8 or x/8, y, z/8. The values were calculated earlier
      par4WorldServer.updateEntityWithOptionalForce(par1Entity, false);
      par4WorldServer.getDefaultTeleporter().placeInPortal(par1Entity, var11, var13, var15, var17); //Repositions the entity into the portal
      //The comments where added by me

      to

      par1Entity.setLocationAndAngles(var5, par1Entity.posY, var7, par1Entity.rotationYaw, par1Entity.rotationPitch); //Sets the position to x*8, y, z*8 or x/8, y, z/8. The values were calculated earlier
      par4WorldServer.getDefaultTeleporter().placeInPortal(par1Entity, var11, var13, var15, var17); //Repositions the entity into the portal
      par4WorldServer.spawnEntityInWorld(par1Entity); //Spawns the entity
      par4WorldServer.updateEntityWithOptionalForce(par1Entity, false);

      The screenshot is showing a player who came through the portal breaking a block. You can see him in the background due to the offset.

      FOR MODERATORS:
      Since the other two posts on this bug miss out on a lot of important information I decided to repost it. If you mark this bug as duplicate please make sure to make the information visible in the other posts. Thank you!
      This issues was posted two times before:
      https://mojang.atlassian.net/browse/MC-12608
      https://mojang.atlassian.net/browse/MC-17345

            dinnerbone [Mojang] Nathan Adams
            panda4994 [Mojang] Panda
            Votes:
            127 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: