Teleported entities refer to old chunk
Relates to:
It seems like when an entity gets teleported it still refers to the chunk it was before. (This fixes itself when the chunk it referred to gets unloaded or when you reopen the world).
How to reproduce:
- Go away from the spawn chunks
- Use this command /summon ArmorStand ~ ~ ~ {CustomName:playerChunk}
- Teleport the ArmorStand in an unloaded chunk, for example: /tp @e[type=ArmorStand,name=playerChunk] ~3000 ~ ~
- Wait some time and use /say @e[type=ArmorStand,name=playerChunk] It should say the name of the ArmorStand
- Try to execute on the entity
It will fails which means the chunk is not loaded, however commands still find the entity which means it is still loaded
Checking if the entity is in a different chunk after the teleportation, removing it from the old chunk and adding it to the new chunk seems to work.
Linked Issues
Created Issue:
Teleported entities refer to old chunk
Relates to:
It seems like when an entity gets teleported it still refers to the chunk it was before. (This fixes itself when the chunk it referred to gets unloaded or when you reopen the world).
How to reproduce:
- Go away from the spawn chunks
- Use this command /summon ArmorStand ~ ~ ~ {CustomName:playerChunk}
- Teleport the ArmorStand in an unloaded chunk, for example: /tp @e[type=ArmorStand] ~3000 ~ ~
- Wait some times and use /say @e[type=ArmorStand] It should say the name of the ArmorStand
- Use this command /execute @e[type=ArmorStand,name=playerChunk] ~ ~ ~ /summon ArmorStand {CustomName:unloadedChunk}
- Use /say @e[type=ArmorStand] then wait some time and use it again. The first time it should say the names of both ArmorStands, the second time it only says the name of "playerChunk"
- When you now move away causing the chunk you started to get unloaded, you shouldn't see the name of "playerChunk" anymore when using /say @e[type=ArmorStand]
Relates to:
It seems like when an entity gets teleported it still refers to the chunk it was before. (This fixes itself when the chunk it referred to gets unloaded or when you reopen the world).
How to reproduce:
- Go away from the spawn chunks
- Use this command /summon ArmorStand ~ ~ ~ {CustomName:playerChunk}
- Teleport the ArmorStand in an unloaded chunk, for example: /tp @e[type=ArmorStand] ~3000 ~ ~
- Wait some times and use /say @e[type=ArmorStand] It should say the name of the ArmorStand
- Use this command /execute @e[type=ArmorStand,name=playerChunk] ~ ~ ~ /summon ArmorStand {CustomName:unloadedChunk}
- Use /say @e[type=ArmorStand] then wait some time and use it again. The first time it should say the names of both ArmorStands, the second time it only says the name of "playerChunk"
- When you now move away causing the chunk you started to get unloaded, you shouldn't see the name of "playerChunk" anymore when using /say @e[type=ArmorStand]
Relates to:
It seems like when an entity gets teleported it still refers to the chunk it was before. (This fixes itself when the chunk it referred to gets unloaded or when you reopen the world).
How to reproduce:
- Go away from the spawn chunks
- Use this command /summon ArmorStand ~ ~ ~ {CustomName:playerChunk}
- Teleport the ArmorStand in an unloaded chunk, for example: /tp @e[type=ArmorStand] ~3000 ~ ~
- Wait some times and use /say @e[type=ArmorStand] It should say the name of the ArmorStand
- Use this command to load the chunk /execute @e[type=ArmorStand,name=playerChunk] ~ ~ ~ /spreadplayers ~ ~ 0 1 false @e[type=ArmorStand,c=1]
- Use this command /execute @e[type=ArmorStand,name=playerChunk] ~ ~ ~ /summon ArmorStand {CustomName:unloadedChunk}
- Use /say @e[type=ArmorStand] then wait some time and use it again. The first time it should say the names of both ArmorStands, the second time it only says the name of "playerChunk"
- When you now move away causing the chunk you started to get unloaded, you shouldn't see the name of "playerChunk" anymore when using /say @e[type=ArmorStand]
relates to
Relates to:
It seems like when an entity gets teleported it still refers to the chunk it was before. (This fixes itself when the chunk it referred to gets unloaded or when you reopen the world).
How to reproduce:
- Go away from the spawn chunks
- Use this command /summon ArmorStand ~ ~ ~ {CustomName:playerChunk}
- Teleport the ArmorStand in an unloaded chunk, for example: /tp @e[type=ArmorStand] ~3000 ~ ~
- Wait some times and use /say @e[type=ArmorStand] It should say the name of the ArmorStand
- Use this command to load the chunk /execute @e[type=ArmorStand,name=playerChunk] ~ ~ ~ /spreadplayers ~ ~ 0 1 false @e[type=ArmorStand,c=1]
- Use this command /execute @e[type=ArmorStand,name=playerChunk] ~ ~ ~ /summon ArmorStand {CustomName:unloadedChunk}
- Use /say @e[type=ArmorStand] then wait some time and use it again. The first time it should say the names of both ArmorStands, the second time it only says the name of "playerChunk"
- When you now move away causing the chunk you started in to get unloaded, you shouldn't see the name of "playerChunk" anymore when using /say @e[type=ArmorStand]
Relates to:
It seems like when an entity gets teleported it still refers to the chunk it was before. (This fixes itself when the chunk it referred to gets unloaded or when you reopen the world).
How to reproduce:
- Go away from the spawn chunks
- Use this command /summon ArmorStand ~ ~ ~ {CustomName:playerChunk}
- Teleport the ArmorStand in an unloaded chunk, for example: /tp @e[type=ArmorStand,name=playerChunk] ~3000 ~ ~
- Wait some times and use /say @e[type=ArmorStand,name=playerChunk] It should say the name of the ArmorStand
- Use this command to load the chunk /execute @e[type=ArmorStand,name=playerChunk] ~ ~ ~ /spreadplayers ~ ~ 0 1 false @e[type=ArmorStand,c=1]
- Use this command /execute @e[type=ArmorStand,name=playerChunk] ~ ~ ~ /summon ArmorStand {CustomName:unloadedChunk}
- Use /say @e[type=ArmorStand] then wait some time and use it again. The first time it should say the names of both ArmorStands, the second time it only says the name of "playerChunk"
- When you now move away causing the chunk you started in to get unloaded, you shouldn't see the name of "playerChunk" anymore when using /say @e[type=ArmorStand]
Relates to:
It seems like when an entity gets teleported it still refers to the chunk it was before. (This fixes itself when the chunk it referred to gets unloaded or when you reopen the world).
How to reproduce:
- Go away from the spawn chunks
- Use this command /summon ArmorStand ~ ~ ~ {CustomName:playerChunk}
- Teleport the ArmorStand in an unloaded chunk, for example: /tp @e[type=ArmorStand,name=playerChunk] ~3000 ~ ~
- Wait some time
sand use /say @e[type=ArmorStand,name=playerChunk] It should say the name of the ArmorStand- Use this command to load the chunk /execute @e[type=ArmorStand,name=playerChunk] ~ ~ ~ /spreadplayers ~ ~ 0 1 false @e[type=ArmorStand,c=1]
- Use this command /execute @e[type=ArmorStand,name=playerChunk] ~ ~ ~ /summon ArmorStand {CustomName:unloadedChunk}
- Use /say @e[type=ArmorStand] then wait some time and use it again. The first time it should say the names of both ArmorStands, the second time it only says the name of "playerChunk"
- When you now move away causing the chunk you started in to get unloaded, you shouldn't see the name of "playerChunk" anymore when using /say @e[type=ArmorStand]
Relates to:
It seems like when an entity gets teleported it still refers to the chunk it was before. (This fixes itself when the chunk it referred to gets unloaded or when you reopen the world).
How to reproduce:
- Go away from the spawn chunks
- Use this command /summon ArmorStand ~ ~ ~ {CustomName:playerChunk}
- Teleport the ArmorStand in an unloaded chunk, for example: /tp @e[type=ArmorStand,name=playerChunk] ~3000 ~ ~
- Wait some time and use /say @e[type=ArmorStand,name=playerChunk] It should say the name of the ArmorStand
- Use this command to load the chunk /execute @e[type=ArmorStand,name=playerChunk] ~ ~ ~ /spreadplayers ~ ~ 0 1 false @e[type=ArmorStand,c=1]
- Use this command /execute @e[type=ArmorStand,name=playerChunk] ~ ~ ~ /summon ArmorStand {CustomName:unloadedChunk}
- Use /say @e[type=ArmorStand] then wait some time and use it again. The first time it should say the names of both ArmorStands, the second time it only says the name of "playerChunk"
- When you now move away causing the chunk you started in to get unloaded, you shouldn't see the name of "playerChunk" anymore when using /say @e[type=ArmorStand]
Checking if the entity is in a different chunk after the teleportation, removing it from the old chunk and adding it to the new chunk seems to work.
Relates to:
It seems like when an entity gets teleported it still refers to the chunk it was before. (This fixes itself when the chunk it referred to gets unloaded or when you reopen the world).
How to reproduce:
- Go away from the spawn chunks
- Use this command /summon ArmorStand ~ ~ ~ {CustomName:playerChunk}
- Teleport the ArmorStand in an unloaded chunk, for example: /tp @e[type=ArmorStand,name=playerChunk] ~3000 ~ ~
- Wait some time and use /say @e[type=ArmorStand,name=playerChunk] It should say the name of the ArmorStand
- Use this command to load the chunk /execute @e[type=ArmorStand,name=playerChunk] ~ ~ ~ /spreadplayers ~ ~ 0 1 false @e[type=ArmorStand,c=1]
- Use this command /execute @e[type=ArmorStand,name=playerChunk] ~ ~ ~ /summon ArmorStand {CustomName:unloadedChunk}
- Use /say @e[type=ArmorStand] then wait some time and use it again. The first time it should say the names of both ArmorStands, the second time it only says the name of "playerChunk"
- When you now move away causing the chunk you started in to get unloaded, you shouldn't see the name of "playerChunk" anymore when using /say @e[type=ArmorStand]
Checking if the entity is in a different chunk after the teleportation, removing it from the old chunk and adding it to the new chunk seems to work.
Relates to:
It seems like when an entity gets teleported it still refers to the chunk it was before. (This fixes itself when the chunk it referred to gets unloaded or when you reopen the world).
How to reproduce:
- Go away from the spawn chunks
- Use this command /summon ArmorStand ~ ~ ~ {CustomName:playerChunk}
- Teleport the ArmorStand in an unloaded chunk, for example: /tp @e[type=ArmorStand,name=playerChunk] ~3000 ~ ~
- Wait some time and use /say @e[type=ArmorStand,name=playerChunk] It should say the name of the ArmorStand
- Try to execute on the entity
It will fails which means the chunk is not loaded, however commands still find the entity which means it is still loadedChecking if the entity is in a different chunk after the teleportation, removing it from the old chunk and adding it to the new chunk seems to work.
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 ofMC-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 Spake Miner
How to reproduce
The main steps are always
- Use setup steps provided for the specific reproduction case
- Teleport away from any chunks which remain loaded after you teleport, example: spawn chunks, chunks with other player, chunks with hoppers...
/tp ~ ~ ~100000
- Teleport away from these chunks making sure they get unloaded once you teleported
/tp ~ ~ ~100000
- Use reproduction steps provided for the specific reproduction case
Potion effects modifiers are not updated for client
Reproduction steps
- Give yourself speed or slowness which both modify the movement speed
/effect @p speed 10000 10 true - Walk around
→ You will notice that you walk with normal movement speed
Potion effect particles are not updated
Setup steps
- Give yourself for example night vision
/effect @p night_vision 1000 1
Reproduction steps
- 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.
Is this still an issue in the most recent versions (currently that is 1.10.2, or 16w42a) of Minecraft? If so, please update the affected versions and help us keeping this ticket updated from time to time.