mojira.dev
MC-92916

Player is removed from the EntityTracker when teleporting to unloaded chunks or changing dimensions, resulting in client side desync

The bug

Players are removed from the list of loaded entities and the EntityTracker stops tracking them when they teleport out of non-spawn chunks which are not loaded afterwards anymore into currently unloaded chunks. This causes all kind of desynchronizations for the client and results in the @e selector not finding the player anymore (@a, @r and @p still do).

Desynchronization examples

  • For any level of speed/slowness, it doesn't increase/decrease your walking speed, nor FOV and if you had speed or slowness before the glitch happens the speed/slowness will also stay after you clear it. (It won't show any particles or a tab in the GUI saying that you have the effect but your FOV is still increased/decreased and you still walk faster/slower)

  • Invisibility doesn't work.

  • Switching to spectator mode makes your head completely nontransparent (MC-93377) and when switching from spectator to another makes you invisible. (MC-92324)

  • You don't take knockback from any damage. (MC-98210)

  • You can't hear any damage sounds.

  • Elytras won't work (MC-89994) which might be the cause of MC-90035.

  • Targeting with @e and @r[type=player] becomes unreliable. (MC-100369)

  • If you have some armor equipped, then teleport, changing the armor values (changing, adding, removing) makes your armor points stay the same.

  • Players will be invisible. (MC-91236)

  • Potion effects are displayed incorrectly, went through a teleporter after getting absorption, and even after the absorption wore off minutes later, the particle effects from it were there.

  • Health is displayed incorrectly, health-boost/absorption before teleporting, and extra hearts did not show after teleporting.

  • Attack Indicator displays wrong animation (MC-97169)

  • Main hand is always your right hand (MC-142135)

  • Killing an entity with a bow and arrow will not count as the player's kill

  • Player becomes stuck in bed

List by @unknown

How to reproduce

The main steps are always

  1. Use setup steps provided for the specific reproduction case

  2. Teleport away from any chunks which remain loaded after you teleport, example: spawn chunks, chunks with other player, chunks with hoppers...

    /tp ~ ~ ~100000
  3. Teleport away from these chunks making sure they get unloaded once you teleported

    /tp ~ ~ ~100000
  4. Use reproduction steps provided for the specific reproduction case

Potion effects modifiers are not updated for client

Reproduction steps
  1. Give yourself speed or slowness which both modify the movement speed

    /effect @p speed 10000 10 true
  2. Walk around
    → You will notice that you walk with normal movement speed

Potion effect particles are not updated

Setup steps
  1. Give yourself for example night vision

    /effect @p night_vision 1000 1
Reproduction steps
  1. Clear the potion effects

    /effect @p clear

    → You will notice that the particles remain

Actions modifying flags value

The FLAGS data parameter stores the state for some entity states:

  • burning

  • sneaking

  • sprinting

  • invisible

  • glowing

  • elytra flying

Data parameters are managed by the EntityTracker and therefor the player will not receive the change. The highlighted states cause client side problems. "Invisible" includes switching from Spectator mode to Creative mode.

Setup steps

Switch to Spectator mode or give yourself the invisibility effect

/gamemode spectator
Reproduction steps
  • Switch back to a different game mode

  • Stand in fire

  • Use the glowing effect

    /effect @p glowing 1000 1 true
  • Use the invisibility effect

    /effect @p invisibility 1000 1 true
  • Try using the elytra

Entity selector not finding player anymore

Reproduction steps

Use the following command

/say @e

Code analysis

Based on 1.11.2 decompiled using MCP 9.35 rc1

The problem is that the method net.minecraft.world.World.updateEntityWithOptionalForce(Entity, boolean) only updates the chunk an entity is in if the area around the entity is loaded, which causes other bugs like MC-81536 and might not be a good design as seen in MC-108469.
When the server then receives a CPacketPlayer packet before the area around the player is loaded correcting the chunk the player is in, the chunks were the player was before are unloaded. This makes the server then later remove the player from the list of loaded entities (Side note: but not loaded players) and causes the EntityTracker to stop tracking the player which means no data parameter changes are send to the player anymore.

Removing the condition for the area to be loaded could nearly completely solve this problem. It would however not solve the problem where entities teleported in unloaded chunks get lost.

The reason why it only "nearly completely" solves this is because it might still be possible that this happens when the CPacketPlayer packet is received and processed before the player is updated, which might be possible because packets are processed before players are updated.

Related issues

MC-90133 gliders freeze MC-10676 Sleeping in bed won't let you leave bed or reset time (or leave "leave bed" screen) [SMP] MC-23628 Cant get out of bed MC-35080 Cannot leave the bed! MC-40898 Unable to leave my bed. MC-89994 Elytra stops working when teleported into unloaded chunks MC-90820 Elytra stop working after TP MC-91065 Speed effect don't work MC-91236 Player invisible on servers MC-91799 When joining a server there is a chance to become invisible MC-92216 Leaving bed doesn't work sometimes MC-93377 sometimes the head of a spectator looks solid MC-93578 Elytra not working after death/teleport... MC-95476 Teleporting players to unloaded chunks makes that player invisble MC-96358 Elytra not working MC-97148 When You Teleport To Some Coordinates Elytra Is Not Working Anymore. MC-97169 Attack Indicator displays wrong animation after going through End Gateway MC-97170 Player damage sound effect does not play after going through End Gateway MC-97287 Elytra does not work MC-97596 Speed effect and Slowness effect don't work in any ways. MC-97824 Help with elytra MC-98147 Bug with rideable entities. MC-98210 Knockback invulnerability - take no knockback until you die or reload the world MC-98864 "Gamemode limbo" MC-99004 Elytra not working in end city MC-99134 Elytra MC-99374 Elytra doesnt work MC-99491 [DUPLICATE] Leaving bed doesn't work sometimes MC-99499 Can't get out of bed? MC-99856 Bed Bug in 1.9 MC-99894 Stuck in bed while sleeping MC-100085 Can't Leave bed MC-100272 Stuck in bed, alone, forever, SAD MC-100369 @e and 'type=Player' causes players to unload + odd behaviour. MC-100490 Can't leave bed after using it MC-100501 Player No longer selected with @e after teleports MC-100563 elytra not working MC-100576 Speed Effect MC-100737 Elytra Teleport Bug MC-100912 On a LAN world, after the players teleport, they become invisible to each other. MC-101052 Stayed invisible when switching from sp to c MC-101158 giveing players slowness with effect command now working when TPing players into unloaded chuncks MC-101366 Elytra MC-101494 Slowness effect does not work MC-102228 Can't leave bed. MC-102339 Beds don´t work correctly MC-102776 elytra problem + teleportation MC-102975 Spectator mode does not work correctly in the Nether, Blaze attacks MC-103299 Chat opens when using bed, can't exit MC-103301 Elytra can not be usd after teleporting no matter how you try to fix it. MC-103650 When Using /spreadplayers Sometimes Players Are Invisible MC-104816 Exiting Gamemode 3 Visual Error MC-106361 When sleeping it is supposed to turn it to day and place you off the bed, but it has not been getting me out of the bed MC-106588 Can't get out of bed. MC-106610 Sleeping in a bed close to the nether portal in overworld and in a tower. MC-107521 Stuck in a bed when I sleep MC-107936 No damage sound while falling to the void in the end MC-108072 No damage sound while falling to the void in the END ISLANDS MC-108444 When a player teleports, it becomes invisible MC-109600 Can't leave bed with 16w44a MC-110164 Cannot leave bed MC-110323 teleport invisable MC-110569 Elytra not working after teleporting with command MC-111006 Elytra not working! MC-111007 Unable to leave bed after command block teleport on vanilla multiplayer server MC-111641 Can't fly in the end MC-111709 Elytra Bug in 1.11.2 MC-112449 Invisible player, invisible mobs, etc. MC-115109 potion still applied after effect duration in creative MC-115383 Can't get out of my bed in new snapshot (17w13b) MC-116399 Beds STILL BLOODY BROKEN MC-116496 @e doesn't find player after teleporting MC-117151 @e does not select players after teleporting MC-117405 Speed/Slowness potions have no effect after teleporting through End Gateway MC-118842 Server bug when player uses end gateway in the end dimension MC-118943 Armor/Elytra sometimes does not register after going through a portal MC-119070 Flying through end portal with elytra causes glitchy behavior MC-119566 Elytra & End Gateway MC-128167 Sometimes after turning off spectacor mode I got invisibility for 3 - 5 seconds. MC-131284 Stuck in Bed MC-131999 Stuck at Leave Bed MC-132971 You can't wake up after sleeping MC-133411 I can not get out of bed! MC-133826 tp to bed player gets stuck MC-134082 Stuck in bed MC-134091 Elytra didn't deploy & armor bar disappeared MC-134397 returning from the End glitch MC-134584 Getting tp'ed back in time MC-134751 Very serious error after leaving the END, kill my world MC-135203 Forever nothing usable after respawn MC-135366 when you fall out of the world in the end where the end cities are in creative mode it kills you but there are no death sounds MC-135571 Traveling from the end makes it impossible to interact with blocks or items MC-135586 Falling into the void in the end world made me respawn in over world broken. Could not change game mode or open chest… MC-135618 Bug After Exit Portal - Can't Interact With World MC-136033 Lever cannot be turned on or off inside the end after leaving the end MC-138924 Stuck in Bed MC-140386 Can't get out of bed MC-140805 I can not leave the bed. MC-140941 Bed Bug MC-140979 Softlock while sleeping in a bed MC-141106 Going completely invisible when re-enter a loaded chunk from an unloaded chunk. MC-141120 Can not press "Leave bed" MC-141359 18w50a Bed Bug MC-141477 Stuck In a bed after sleeping and died on a relm MC-141873 Twitchy sleeping MC-142294 Stuck in bed MC-142740 Still Experiencing Stuck In Bed Issue MC-142755 Sleeping results in forever loading with 'leave bed' button MC-142786 Elytra not worning in nether - 19w03c MC-142836 in the nether, player shot arrows do not count as player kills MC-142837 I'm stuck in my bed in 19w03c... MC-142863 Zombie Pigman not get agro when shot by bow MC-142878 Elytra does not work in the nether MC-142892 Can't get up in bed while chat is open. MC-143080 desync again. can't leave bed at morning MC-143084 Elytra won't deploy after exiting Nether MC-143098 Fire damage not making sound MC-143107 Elytras aren't working anymore. MC-143108 Elytras not activating at all MC-143111 Magma Block does not have a hurt sound MC-143114 Blazes don't drop blaze rods MC-143196 a sound that is not hurt when being hit by a zombie pig MC-143230 Stuck In Bed Sleeping After Nether Trips MC-143281 Issue with getting in bed in a singleplayer world MC-143315 Being on fire; No fire shown on HUD and without sound. MC-143500 Can't get out of bed MC-143548 i can not leave bed MC-143554 Zombie Pigmen are not Hostile Towards Bow and Crossbow Attacks MC-143634 No damage to the sound when hurting through sweet berries MC-143645 When you get up it will stuck in the sleeping interface. MC-143646 Speed effect not working :( MC-143781 Cannot open elytra while falling MC-143798 Screen stays grey when in bed Snapshot 19w06a MC-143887 Unable to leave bed after daytime comes MC-143907 Unable to get out of bed at random MC-143911 Bed Bug MC-143956 Golden apple golden hearts missing up MC-144014 Elytra STILL NOT FIXED MC-144185 Elytra not opening until I land MC-144196 Stuck at "leave bed" after going to bed MC-144258 Creatures killed with bows have no experience. MC-144280 Bed Bug MC-144324 Health boost potion/command in overworld going into nether creates dead glitch MC-144394 Can't get up when falling asleep with a villager looking at you MC-144549 When sleeping, bed glitches and can't do anything 19w07a MC-145015 Sleep bug MC-145225 Elytra fails after going through an end gateway

Attachments

Comments

migrated
[media][media][media][media][media][media][media][media][media][media][media][media][media][media][media][media]
migrated

Works just fine for me. Please attach a crash report, exact steps to reproduce and a video if possible.

migrated

wait, now it does work? weird
I can't see this issue now anymore, and nothing changed in my commands, world, etc

migrated

Not the first time this has been reported. Weird indeed.

migrated

should it be good to note that the first time I did a lot of teleporting to unloaded chunks?
I tried that again, had no effect the second try after it worked already

migrated

I have just ran into the same bug. I'm attaching a crash report.

migrated

I had the issue today again, as well, no idea what triggers it tho
Relogging into the world seems to fix the issue

Requesting reopening of the report

migrated

this could actually be a duplicate of MC-89361 since it works fine after relogging, and it has to do with jumping from location 1 to location 2 by the use of portals/commands

migrated

This isn't a duplicate of MC-89361 since this bug relates to status effects while MC-89361 is about commands and selectors. Speaking of which, I have a slightly more detailed description for this bug; This issue happens usually when teleporting with commands from one location to another that have a long distance between each other (Probably related to unloaded chunks), and this not only applies to speed and slowness; Also invisibility doesn't work, in spectator mode your head is seen completely untransparent, you don't take knockback from any damage, you can't hear any damage sounds, and if you had speed or slowness before the glitch happens the speed/slowness will also stay after you clear it (It won't show any particles or a tab in the GUI saying that you have the effect but your FOV is still increased/decreased and you still walk faster/slower), and I believe elytras won't work too which might be the cause of MC-90035. Dying or relogging fixes the issue.
Oh, yes, confirmed for 1.9 😛

migrated

reopened the issue, updated the description and changed report further

migrated

Thanks.

migrated

merged MC-93377, MC-98864 and MC-89994 with this one

migrated

attached files of the merged tickets

migrated

Also I don't want to look like an attention seeker or anything, but can you maybe credit me for the extra information? Because I could have also just created another issue myself and it wouldn't be considered as a duplicate (In a way). Don't have to though.

migrated

Done

migrated

Thanks.

migrated

OK, after changing a few things in my map, I found another issue and I think this is all just related to attributes since the same thing occurs with speed and slowness and they're attributes too; If you are given some armor, then teleport to unloaded chunks, when you remove the armor, your armor points stay the same, and I'm guessing if you upgrade your armor it still won't change.

migrated

@unknown, could you test it this time, I seem to be unable to reproduce in 16w15b, possibly because I set the server's render distance to 15 instead of 7.

Edit: Nvm, related to the server side render distance for me.

migrated

If it's just minigames/map/server, you can load the chunk before teleporting the player by using an end gateway. Dragnoz has a video about this which you can find here: https://www.youtube.com/watch?v=pyqzxn0e9Jw

migrated

Some of the information in this report is falsifiable. I have opened related bug MC-100911 to demonstrate a simple repro where elytra quits working, and the repro conditions are counter to the ones described in the title of this bugs.

migrated

@unknown The pre-chunk-loading suggestion does not necessarily help for a couple reasons. First, in some cases it simply does not get rid of the issue (I tested it with the repro in MC-100911) . Second, in the case of those using an end_gateway for minigames/maps, kind of the whole point of using an end_gateway rather than e.g. a pressure pad on a command block is that it is a simple command-block-free way to allow players to teleport... so needing commands as a workaround kind of defeats the benefit of using that block. This is a broad-scope bug, and I appreciate people offering suggestions that may help in certain situations, but want to be clear that this is not a general workaround.

migrated

I have to agree that it's rather hard to say what chunks are affected (in your case it's spawn chunks) for example the map I use has 2 way teleportation, but only 1 way it works (no spawn chunks on eighter side of the teleportation)

I just chose the words "unloaded chunks" as that was the case in my map, while it's "unremdered chunks" for you.

If you can find a better descriptive title please suggest it.

migrated

I'd like to add that when you are burning, you cannot see the fire. Also, in order to solve this bug, you have to kill youself and respawn.

migrated

Here are more effects of this bug:

Potion effects are displayed incorrectly. I think I ate a golden apple, went through a teleporter, and even after my absorption wore off minutes later, I still had the particle effects from it until I relogged.

Health is displayed incorrectly: I had a health-boost potion, and my extra hearts did not show after teleporting, until I re-logged.

In addition to the knockback, fire, and elytra aspects of the bug (as well as entities like painting and villagers not rendering, which I think is a different bug), I've been bitten by seven different aspect of the 'teleporter' bug in a single 1.9 CTM map!

migrated

Added to the list (but reworded a little).

migrated

Jump Boost doesn't work either. I am creating a map and when the player get teleported to unloaded chunks as soon as they join the game, they get jump boost 255, but it actually doesn't take effect. It shows up in the Inventory screen though. YOu could add this to the list.

migrated

jump boost 255

That's an unsupported amplifier, does it also not work with levels lower then 5?

migrated

I haven't tried. But what's wrong with it. Slowness 99 causes the same problem (Though you keep the effect and you can't move). Jump boost 255 makes it so you don't take fall damage. (I'm sure you know) I am not going to test it with values lower than 5 though...

migrated

That only works because the formula still functions, but mojang won't look into issues with those amplifiers, see MC-10755.

migrated

I might test it for you then, but maybe tomorrow. But wow... this bug really breaks my map. Lots of teleporting to unloaded chunks happens in it.

migrated

Related to MC-90060?

migrated

I don't think it is, that's the client receiving no chunks for a moment and thinking it falls, but get's corrected as soon as the server sends the chunks.
As for this one, it seems like a desync between the client and server, not big, but still a desync that only gets corrected upon relogging/respawning.

migrated

Oh this isn't server-side also? I thought it was, sorry.

migrated

I'm not sure, but this seems like a permanent desync that only get's fixed by relogging, while MC-90060 instantly gets corrected.

I'm not saying they are both client side, because they both are a desync, but they seem unrelated to me.

migrated

OK. But just FYI MC-90060 doesn't get corrected; it actually suffocates you.

marcono1234

Might relate to MC-88179

migrated

May also relate to MC-97170 and MC-97169

migrated

You can't hear any damage sounds.

The first one is already included.

Including the second one, as going trough end gateways is also teleporting.

migrated

This seems to be the endpoint of elytra not deploying so:

Only encountered this issue just now from strolling around a really hilly custom preset world. Even after about 10-20 presses of the spacebar, the elytra would not deploy, only 2-3 times have it deployed mid air after not working the first time. In creative it would be a 50/50 of just falling or going into creative_flying.

Can 'toggle' it fairly consistently between working and not working, by changing render distance between really short and really far. It feels just like how sprint can toggle back and forth randomly on servers with a lot of ping, just that this is on singleplayer.

migrated

Confirmed for 1.10.

marcono1234

@unknown, I think you interchanged the report numbers. "You don't take knockback from any damage." is MC-98210

migrated

Yeah, I did, thanks.

migrated

confirmed for 16w36a

Jbip

Confirmed for 1.11 pre-release 1

wobst.michael

@unknown: it has already been marked as affected for that version

migrated

I think I found what triggered this issue. For me it happened only when I teleport myself between two loadable chunk (other than the spawn).
So you can fix your map by teleporting the player to the spawn, and then to the arena.

onnowhere

Confirmed 1.11.2 and 17w06a

Panossa

Really, REALLY strange and big bug.
On some clients it works. On some it doesn't work.
And sometimes it works normally, sometimes not. But WHEN it's bugged... RIP.
There are theories that it might have something to do with negative and positive coordinates but I don't know if that's right.
Also: teleporting from a previously unloaded chunk to the spawn chunks lets the bug occur, too. (for me, that is)

~Panossa

Jbip

Confirmed for 17w18b. I lost hope.

migrated

Only at the 10th of march the cause became known. Don't lose hope just yet.

migrated

Still in pre5, but WAY less common.

Nathan Adams

With the same reproduction steps? Did this happen to you, or did you see it somewhere else? Did it have the same symptoms? Did it go away after relogging?

migrated

It goes away after dying, not sure about relogging.

migrated

It has the exact same symptoms. It has happened to me on a lan server and it has happened to a friend on a actual dedicated server while I was on. The reproduction steps are the same but it doesn't seem to work most of the time. It doesn't go away after relogging. I have pictures showing it's still not fixed in pre7 if you need them.

marcono1234

@@unknown what exact symptoms are you seeing since this bug caused all kind of unintended behaviors.

migrated

Both invisible and not targetable via @e confirmed in 1.12 now; forgot to test the rest

chokoboy3

Some symptoms I saw when this bug was occuring to me:
AttributeModifiers don't work, the hat part of the skin doesn't show, elytra doesn't work, invisible to other players, and some sounds don't work. It's basically just all the symptoms that were there before.

I really don't know what triggers the bug. I tested with everything I know and didn't get it to work. So far it just seems to come at random when teleporting to unloaded chunks.

Panossa

I thought this one is resolved in 1.12?

migrated

Read the comments

FVbico [Mod] FVbico (Steven Verberne) added a comment - 29/May/17 7:50 AM

Still in pre5, but WAY less common.
Permalink Edit
dinnerbone [Mojang] Dinnerbone (Nathan Adams) added a comment - 29/May/17 11:26 AM

With the same reproduction steps? Did this happen to you, or did you see it somewhere else? Did it have the same symptoms? Did it go away after relogging?
Permalink Edit
AoElite AoElite added a comment - 29/May/17 6:53 PM

It goes away after dying, not sure about relogging.

migrated

I have not been able to reproduce anymore for a couple of months, has anybody been affected recently?

migrated

This issue still exists.

We see it fairly often when a player teleports out of a chunk that gets unloaded, and then tries to sleep. Once the sleep cycle ends, the player is not able to leave their bed and must quit the game to "escape".

I believe that at some time around 1.10, a refactor changed the order of events during the tick. It appears that in earlier versions, entities received an update prior to chunks being unloaded, and now the chunks get unloaded first.

Getting the update caused updateEntityWithOptionalForce to be called, which would see that the entity was not in the chunk indicated by the entities properties. This caused the entity to be removed from the chunk, preventing it from being removed from the EntityTracker later in the tick.

Sometime after 1.7.10 a refactor appears to have inadvertently changed the order of the tick by taking what was a single method and splitting it across several subclasses. With the new order the chunks get unloaded before entities get updated, this denies the entity a chance to remove itself from the unloading chunk.

I have created a Forge mod named BedPatch that patches the Chunk.OnUnload method to look though the chunks entitylists and send a forced update to any EntityPlayers in the chunk via updateEntityWithOptionalForce prior to doing anything else. I also created a Forge PR to do the same.

I do not believe that this has to do with the check to see if the players area is loaded. I believe this is a direct result of the change in event order during the tick.

BedPatch:
https://github.com/Mordenkainen/BedPatch

Forge PR:
https://github.com/MinecraftForge/MinecraftForge/pull/4784

migrated

Have you reproduced in 1.12 or in the snapshots?

migrated

I have reproduced it in 1.10.2, 1.11.2, and 1.12.2. I have not tried to reproduce it in the snapshots yet.

It can easily be recreated by:

  • Teleport a large distance from spawn (I usually do 1000+ blocks)

  • Place a bed

  • Teleport another 1000 blocks away

  • Teleport back to the location the bed was placed.

  • Sleep

When the sleep cycle ends, you will not be able to get out of bed and will have to quit the game.

Running MC through a debugger shows that this is due to the player not being in the EntityTracker.

Further debugging showed that the player was being removed from the EntityTracker when the chunk they left unloaded.

Visual comparison of the tick() methods between 1.7.10 and 1.10.2 revealed the change in event order, which was then verified via debugger.

Finally the code in BedPatch which inserts the "missing" update prior to the chunk unload prevents the issue. Users of BedPatch have also reported that they no longer have instances of not seeing other players after installing it.

As far as all the other issues reported here, I have not tried them to see if the patch resolves them, but I will try to do that tonight.

FaRo1

Seems to be much worse in 18w16a than in 1.12.2. Now I teleport, relog and I'm not even at the target location anymore.

CreeperMagnet_

EDIT: Yes, this affects 1.13-pre6. Confirmed when confirming another bug

tomudding

Still an issue 1.13.1 PRE-1.

migrated

Confirmed for 1.13.1.

tomudding

Can confirm for 1.13.2 PRE-1.

tomudding

Can confirm for 1.13.2 PRE-2.

migrated

Can we get this resolved? It causes some pretty serious issues.

I submitted a fix for Forge and have seen no ill side effects.

At the beginning of Chunk#onChunkUnload (func_76623_d in 1.12.2, around line 187ish) add the following:

java.util.Arrays.stream(field_76645_j).forEach(multimap -> com.google.common.collect.Lists.newArrayList(multimap.func_180215_b(net.minecraft.entity.player.EntityPlayer.class)).forEach(player -> field_76637_e.func_72866_a(player, false))); // FORGE - Fix for MC-92916

This searches the list of entities in the unloading chunk for any players, and forces them to refresh their position. This causes them to be registered with the new chunk and prevents their removal from the EntityTracker.

Seems to solve all these issues.

Can we get this issue closed once and for all?

tomudding

Still an issue in 1.13.2.

tomudding

Can confirm for 18w43a.

Asteraoth

Changed the reporter to @unknown.

Auzathoh

I think I can repro this every time on 19w02a. 

  1. Make a new world, in creative mode with cheats on.

  2. Enter said world.

  3. /tp to somewhere 1500 blocks from spawn (or fly if you want)

  4. put down a bed

  5. summon a cat owned by yourself (this is probably optional, but help illustrate things)

  6. hopefully the cat will sit on the bed... remember where it is anyway

  7. exit and save the game

  8. re-enter

  9. the cat will not be visible, but can be heard

  10. /time set night

  11. sleep in the bed

  12. for me, on two different machines, and four different worlds, I now "drop" out of the bed when night is over, but cannot exit the bed interface

  13. you can /kick yourself to shut down the world

migrated

Happening on my server to me and a friend 😞 neither of us can sleep anymore... is there a work around for it so we can at least sleep?

migrated

Even simpler reproduction steps: put these command in a repeating command block in the spawn chunk, or a ticking function

execute at @a[scores={Offline=1}] at @s run teleport @s ~ ~ ~
scoreboard players set @a[scores={Offline=1}] Offline 0

and create the scoreboard objective scoreboard objectives add Offline minecraft.custom:minecraft.leave_game, now every time you enter the world in any chunk but spawn chunks, you get affected by this bug.

[Mod] Neko

I created a new ticket (MC-142114) to distinguish between teleporting to unloaded chunks and joining the world outside of the spawn chunks. The latter seems to be a new issue in 19w02a that results in the same desync as this ticket.

migrated

Also, as mentioned in https://bugs.mojang.com/browse/MC-142085 if you create new world, craft a bad and try to sleep on it at night - you cannot wake up either.

migrated

Hmmm..... i've been having this stupid bug for a while now too... i think this chunk desync also affects naming and tamed animals. I'm not sure if i should create another thread with this bug as it will be a dupe of this? I think??

Auzathoh

Using a portal to go to the Nether now triggers a desync in 19w03c. Also, going to the End a second time (ie after killing the dragon and leaving) also does it.

These seems similar MC-142114, but that's been closed.

migrated

Auz, just to clairify, this issue is much older than that, and that was a direct duplicate (same issues) but different (much easier) triggering

tomudding

I can no longer directly reproduce this issue as of 19w04a. There are two things that happen when I test this.

(1) MC-138114 and MC-139763. Once inside these "ghost" chunks I can 'reproduce' this issue, but it is for a limited amount of time because in most of the cases it will lead to the same crash as in (2).

(2) The server will just crash whenever I teleport a player to unloaded chunks. The crash report is 

[media]

(~~hug~~).

Single player worlds will crash without a (good) crash report.

FaRo1

Please review your text before sending it (if you're in "Text" mode, you can switch to "Visual" mode), because every edit sends a mail to every watcher. In total, that last comment caused 720 mails to be sent.

Auzathoh

The desync after visiting the nether, or visiting the end for a second time is still there in 19w04a

migrated

Having the stuck in bed problem in 19w04b java single player. Bed is away from other objects. Teleporting away does not leave the bed. current workaround is to leave and reenter the game after every sleep.

migrated

Stuck in bed. 19w06a snapshot

migrated

Elytra wont deploy after changing dimensions. Overworld to Nether, doesnt deploy. Relogged and it worked again. Nether to Overworld, doesn't deploy anymore. Relog. Overworld to End. Doesnt deploy. I had it happen once in 1.13.2 as well but hasn't happened again.

migrated

Confirmed for 19w07a. 

I got the same problem that Colin McGee mentionned with elytras (on server jar version, my friends got the issue too). It seems to occurs each time you're changing dimension.

Auzathoh

Repro steps for 19w07a:

 

  1. start a new world, creative mode

  2. place down a bed

  3. /time set night

  4. sleep in the bed (works)

  5. make a nether portal, and use it

  6. return to the overworld through portal

  7. /time set night

  8. sleep in the bed (works)

  9. move out of the spawn chunks, et /tp 1000 ~60 1000

  10. place down a bed

  11. /time set night

  12. sleep in the bed (works)

  13. make a nether portal, and use it

  14. return to the overworld

  15. /time set night

  16. sleep in the bed (you should now be stuck in the bed interface)

 

tomudding

I cannot reproduce any of the above mentioned issues in 19w09a. Elytra works perfectly fine after switching dimensions, sleeping always works, no matter how far you go around the world.

FaRo1

I just did the exact steps from the second to last comment in 1.13.2 and could sleep. I also changed dimensions in 1.13.2 and elytra worked, same with teleporting far away. So the reproduction steps need to be updated.

Auzathoh

I wonder if MC-144784 being fixed affected this.

TheBoy358

Fixed in 19w09a the player is now rendered in unloaded chunks.

FaRo1

With which steps did you manage to reproduce it in 1.13.2 or 19w07a?

TheBoy358

I have use the steps in the description.

FaRo1

Didn't work for me. 1.13.2, commands:
/effect give @p night_vision 1000 1
/tp ~ ~ ~100000
(wait a while)
/tp ~ ~ ~100000
/effect clear @p
Result: Particles go away, as expected.

tomudding

Cannot reproduce this in 19w11a. If everyone agrees with me I think this should be closed as 'fixed'.

FaRo1

@unknown How did you even reproduce it before?

tomudding

@@unknown To be honest, I cannot remember how I reproduced this in the few snapshots before I reported I could no longer reproduce this. In other words, I have probably reported incorrect behaviour in the client as a reproduction of this bug in the few snapshots leading up to 19w04a. However, I know that I was able to reproduce it the first few times (1.13.2 and < ~18w49, as mentioned by @@unknown with their code snippet) by going to extreme coordinates, but that could take more than 15 minutes to reproduce it in the way I did it (I cannot remember using on the of suggested methods and yes, I should have updated the report with my way of reproducing it, an unfortunate mistake on my end by not doing so).

If you cannot reproduce it in 1.13.2 and I have no way to prove that I was able to do so, maybe a mod can revert/purge every change since then and change the status back to fixed.

For a mod: If it is possible I would like to be disassociated with this bug report because it is causing me too much trouble in maintaining it with the amount of expertise and time that is expected from me.

FaRo1

Which was the last version anyone here could actually reproduce this bug and how? I would like to check if it was really fixed, but I can only do that if I know reproduction steps.

migrated

This bug shows up due to there being an old player entity object added to a chunk list. The chunk list then gets flushed along with all other entity's when the chunk is written to disk. The entity's have there entity trackers removed along with being removed from the world. Given the incorrect player object is part of a chunk that is written to disk the player tracker object gets removed as well.

This bug may show up in other instances but the main one found using nether portals due to accurate reproducibility is nether portals. Using vanilla 1.12.2 following the procedure of going from over world using a nether portal into the nether then back into over world several times and then waiting for the auto-save reproduces this bug accurately.

 

A global fix would be to never remove the player tracker object by removing the player object in chunk lists. This happens in World.updateEntities MCP mappings.

 

for (int l = 0; l < this.unloadedEntityList.size(); ++l)
{
 this.onEntityRemoved(this.unloadedEntityList.get(l));
}

 

This is where the flushing of player objects happens removing the player trackers along with the false player objects.

 

Given this bug was tested on portals the bug can easily be seen in the portal code in PlayerList.transferEntityToWorld MCP mapping names. This method is responsible for removing the player from the old dimension and placing the player in the new dimension in the correct chunk. But player is placed inside a chunk with the method call:

oldWorldIn.updateEntityWithOptionalForce(entityIn, false);

Specifically the lines:

 

if (!entityIn.addedToChunk || entityIn.chunkCoordX != l || entityIn.chunkCoordY != i1 || entityIn.chunkCoordZ != j1)
{
 if (entityIn.addedToChunk && this.isChunkLoaded(entityIn.chunkCoordX, entityIn.chunkCoordZ, true))
 {
 this.getChunkFromChunkCoords(entityIn.chunkCoordX, entityIn.chunkCoordZ).removeEntityAtIndex(entityIn, entityIn.chunkCoordY);
 }

 // Faster entitys can move into unloaded chunks and can get stuck in memory lagging the server. this fixes it CARPET-XCOM
 if (!CarpetSettings.unloadedEntityFix && !entityIn.setPositionNonDirty() && !this.isChunkLoaded(l, j1, true))
 {
 entityIn.addedToChunk = false;
 }
 else
 {
 this.getChunkFromChunkCoords(l, j1).addEntity(entityIn);
 }
}

This method adds the entity into the specific sub chunk list but never removes the player object. Given that the sub chunk has a lingering player object added to its list that then gets flushed along with the chunk being written to disk.

 

MrGrim suggested a clean fix for the specific case of the nether portals. But given there might be other instances of the player writing itself to a chunk and never having it removed then it might be prudent to make a global fix instead of individual fixes in the code.

MrGrims nether portal code fix in PlayerList.transferEntityToWorld:

 

/**
 * Transfers an entity from a world to another world.
 */
public void transferEntityToWorld(Entity entityIn, int lastDimension, WorldServer oldWorldIn, WorldServer toWorldIn)
{
 double d0 = entityIn.posX;
 double d1 = entityIn.posZ;
 double d2 = 8.0D;
 float f = entityIn.rotationYaw;
 oldWorldIn.profiler.startSection("moving");

 if (entityIn.dimension == -1)
 {
 d0 = MathHelper.clamp(d0 / 8.0D, toWorldIn.getWorldBorder().minX() + 16.0D, toWorldIn.getWorldBorder().maxX() - 16.0D);
 d1 = MathHelper.clamp(d1 / 8.0D, toWorldIn.getWorldBorder().minZ() + 16.0D, toWorldIn.getWorldBorder().maxZ() - 16.0D);
 entityIn.setLocationAndAngles(d0, entityIn.posY, d1, entityIn.rotationYaw, entityIn.rotationPitch);

 if (entityIn.isEntityAlive())
 {
 oldWorldIn.updateEntityWithOptionalForce(entityIn, false);
 }
 }
 else if (entityIn.dimension == 0)
 {
 d0 = MathHelper.clamp(d0 * 8.0D, toWorldIn.getWorldBorder().minX() + 16.0D, toWorldIn.getWorldBorder().maxX() - 16.0D);
 d1 = MathHelper.clamp(d1 * 8.0D, toWorldIn.getWorldBorder().minZ() + 16.0D, toWorldIn.getWorldBorder().maxZ() - 16.0D);
 entityIn.setLocationAndAngles(d0, entityIn.posY, d1, entityIn.rotationYaw, entityIn.rotationPitch);

 if (entityIn.isEntityAlive())
 {
 oldWorldIn.updateEntityWithOptionalForce(entityIn, false);
 }
 }
 else
 {
 BlockPos blockpos;

 if (lastDimension == 1)
 {
 blockpos = toWorldIn.getSpawnPoint();
 }
 else
 {
 blockpos = toWorldIn.getSpawnCoordinate();
 }

 d0 = (double)blockpos.getX();
 entityIn.posY = (double)blockpos.getY();
 d1 = (double)blockpos.getZ();
 entityIn.setLocationAndAngles(d0, entityIn.posY, d1, 90.0F, 0.0F);

 if (entityIn.isEntityAlive())
 {
 oldWorldIn.updateEntityWithOptionalForce(entityIn, false);
 }
 }

 // Players needs to be removed from chunk lists when changing dimensions. Fix for MC-92916
 if (CarpetSettings.portalTurningPlayersInvisibleFix && entityIn.addedToChunk && oldWorldIn.isChunkLoaded(entityIn.chunkCoordX, entityIn.chunkCoordZ, true)) {
 if (entityIn.addedToChunk && oldWorldIn.isChunkLoaded(entityIn.chunkCoordX, entityIn.chunkCoordZ, true)) {
 oldWorldIn.getChunkFromChunkCoords(entityIn.chunkCoordX, entityIn.chunkCoordZ).removeEntityAtIndex(entityIn, entityIn.chunkCoordY);
 }
 }
 oldWorldIn.profiler.endSection();

 if (lastDimension != 1)
 {
 oldWorldIn.profiler.startSection("placing");
 d0 = (double)MathHelper.clamp((int)d0, -29999872, 29999872);
 d1 = (double)MathHelper.clamp((int)d1, -29999872, 29999872);

 if (entityIn.isEntityAlive())
 {
 entityIn.setLocationAndAngles(d0, entityIn.posY, d1, entityIn.rotationYaw, entityIn.rotationPitch);
 toWorldIn.getDefaultTeleporter().placeInPortal(entityIn, f);
 toWorldIn.spawnEntity(entityIn);
 toWorldIn.updateEntityWithOptionalForce(entityIn, false);
 }

 oldWorldIn.profiler.endSection();
 }

 entityIn.setWorld(toWorldIn);
}

As seen in the code suggestion above the player is simply removed from the chunk it belongs to in the old world it belonged to before adding it to the new world. Given portals lack this removal the tracker object can then be deleted if the player enters the same dimension before the chunk is written to disk having an old player object in a random chunk list in the same dimension.

FaRo1

@unknown I just placed a repeating command block with say @r[type=player] in 1.12.2 and went through a nether portal about a hundred times. Shouldn't this stop saying my name after a while?

TheBoy358

Hello this issue can be marked as resolved please.

Uriel Salischiker

Please provide reproduction steps for 1.13 or confirm the issue has been fixed

ItsTinay

The player is still invisible for a bit of time after switching the gamemode from spectator (1.16.1)

Arisa Bot

This report is currently missing crucial information. Please take a look at the other comments to find out what we are looking for.
If you added the required information and a moderator sees your comment, they will reopen and update the report. However, if you think your update to this report has been overlooked or you want to make sure that this report is reopened, you can contact the Mojira staff in Discord or Reddit.
-- I am a bot. This action was performed automatically! Please report any issues in Discord or Reddit

marcono1234

@@unknown, please create a new report with exact reproduction steps and if possible a video showing the bug.

still invisible for a bit

Especially the "for a bit" part sounds like it might be a separate (but possibly related) issue.

ItsTinay

@Marcono1234 Sorry, I can't reproduce it at 1.16.2 rc-1. If I will experience this issue again, I will report it.

SPGoding

Doesn't seem like an issue anymore. Resolving as Cannot Reproduce.

migrated

Nathan Adams

Confirmed

(Unassigned)

FOV, GUI, behaviour, chunk, damage, dying, effect, elytra, invisibility, invisible, knockback, particle, relog, slowness, spectator, speed, unexpected, unloaded, unloaded-chunks, walking, walking-speed

Minecraft 15w47a, Minecraft 15w47c, Minecraft 15w49a, Minecraft 1.9, Minecraft 1.9.1 Pre-Release 1, ..., Minecraft 19w03c, Minecraft 19w04b, Minecraft 19w05a, Minecraft 19w06a, Minecraft 19w07a

Minecraft 1.12 Pre-Release 3

Retrieved