mojira.dev
MC-29424

Players appear offset for other clients after going through nether portals

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

Linked issues

Attachments

Comments 7

MC-12608 and MC-17345 resolved as duplicate of this ticket.

This also occurs when players enter the End, although in this case they are always offset by one meter on the y coördinate: they appear to be floating one block above their actual position.

To correct Fenhl, this does not happen always. I would assume that a player's delay to the server has a role in whether he will get offset or not.

@Tilman Berres the thread creator panda explained it in his video:
the offset has nothing to do with the player's delay
it is caused by the different coordinatesystems
the coordinates of the nether portal are multiplied by 8, you get spawned in the world at this coordinates and then the server sets you into the portal, which can be offset by -8 to +8 in x and z and any value in y
you get spawned first and then the offset happens so that you land in the portal you have to be spawned in
but all other players' clients that are around just get to know that where you spawned without any further notification afterwards about an offset that gets applied

if the portal was created in the nether instead of the overworld then there can only be an offset in the y coordinate, if there are blocks in the way at the specific y coordinate, so it is more likely that there is no offset
but most of the time there is one...

this fix cares about the offset before the player is spawned -> fixed really easy

I was explicitly referring to fenhl's comment about the end portal position offset which happens occasionally.

I am completely aware of why the nether portal offset exists. after all it was me who figured that out by spectating what happens 😉

>>> Affects versions 13w41a/b !

Panda4994

Nathan Adams

Confirmed

invisible, nether_portal, offset, player, position

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

Minecraft 13w43a

Retrieved