[MC-6431] Status effects are lost when returning to the overworld from the exit end portal Created: 06/Jan/13  Updated: 16/May/24  Resolved: 14/May/24

Status: Resolved
Project: Minecraft: Java Edition
Component/s: None
Affects Version/s: Snapshot 13w01b, Minecraft 1.5, Snapshot 13w11a, Minecraft 1.5.1, Minecraft 1.7.4, Minecraft 14w07a, Minecraft 14w34b, Minecraft 1.8-pre2, Minecraft 1.8.7, Minecraft 15w45a, Minecraft 15w47b, Minecraft 15w51b, Minecraft 1.9, Minecraft 1.10.2, Minecraft 16w32a, Minecraft 16w32b, Minecraft 16w33a, Minecraft 16w35a, Minecraft 16w40a, Minecraft 16w41a, Minecraft 16w42a, Minecraft 16w44a, Minecraft 1.11 Pre-Release 1, Minecraft 1.11, Minecraft 1.12.1, Minecraft 1.12.2, Minecraft 18w05a, Minecraft 1.13-pre1, Minecraft 1.13-pre6, Minecraft 1.13.1, Minecraft 1.13.2, Minecraft 18w50a, Minecraft 19w09a, Minecraft 1.14.2, Minecraft 1.14.3, 1.14.4, 19w34a, 19w36a, 19w39a, 19w40a, 1.15.1, 1.15.2, 20w18a, 1.16 Pre-release 2, 1.16 Pre-release 4, 1.16 Pre-release 5, 1.16 Pre-release 6, 1.16 Release Candidate 1, 1.16, 1.16.1, 20w29a, 20w30a, 1.16.2 Pre-release 1, 1.16.2 Pre-release 2, 1.16.2 Pre-release 3, 1.16.2 Release Candidate 1, 1.16.2 Release Candidate 2, 1.16.2, 1.16.3 Release Candidate 1, 1.16.3, 1.16.4 Pre-release 1, 1.16.4 Pre-release 2, 1.16.4 Release Candidate 1, 1.16.4, 20w45a, 20w46a, 20w48a, 20w49a, 20w51a, 21w03a, 1.16.5, 21w05b, 21w06a, 21w07a, 21w08b, 21w10a, 21w11a, 21w13a, 21w14a, 21w15a, 21w17a, 21w18a, 21w19a, 21w20a, 1.17 Release Candidate 2, 1.17, 1.17.1, 21w39a, 1.18 Pre-release 5, 1.18.1, 22w06a, 1.18.2, 22w13a, 22w14a, 22w18a, 1.19 Pre-release 1, 1.19 Pre-release 3, 1.19 Pre-release 4, 1.19 Pre-release 5, 1.19 Release Candidate 1, 1.19 Release Candidate 2, 1.19, 22w24a, 1.19.1 Pre-release 5, 1.19.1, 1.19.2, 22w42a, 1.19.3, 23w03a, 23w05a, 23w06a, 23w07a, 1.19.4 Pre-release 1, 1.19.4 Pre-release 2, 1.19.4 Pre-release 3, 1.19.4 Pre-release 4, 1.19.4 Release Candidate 2, 1.19.4 Release Candidate 3, 1.19.4, 23w12a, 23w13a, 23w14a, 23w16a, 23w17a, 23w18a, 1.20 Pre-release 1, 1.20 Pre-release 2, 1.20 Pre-release 4, 1.20 Pre-release 5, 1.20 Pre-release 6, 1.20 Pre-release 7, 1.20 Release Candidate 1, 1.20, 1.20.1 Release Candidate 1, 1.20.1, 23w31a, 23w32a, 23w33a, 23w35a, 1.20.2 Pre-release 2, 1.20.2 Pre-Release 3, 1.20.2 Pre-Release 4, 1.20.2 Release Candidate 1, 1.20.2, 1.20.3, 1.20.4 Release Candidate 1, 1.20.4, 23w51b, 24w04a, 24w06a, 1.20.5 Release Candidate 2, 24w19b
Fix Version/s: 24w20a

Type: Bug
Reporter: [Mod] markderickson Assignee: [Mojang] TommyWallberg
Resolution: Fixed Votes: 133
Labels: effect, end_portal, overworld, potion-effect

Attachments: PNG File 2013-03-12_21.12.00.png     PNG File 2013-03-12_21.12.07.png     PNG File 2013-03-12_21.12.17.png     PNG File 2013-03-20_18.23.51.png     PNG File 2013-03-20_18.24.03.png     PNG File 2013-03-27_13.55.18.png     PNG File 2013-03-27_13.55.23.png     PNG File 2013-03-27_13.55.35.png     PNG File 2013-03-27_13.55.44.png     PNG File 2023-02-04_16.19.52.png     File MC-6431.mp4    
Issue Links:
Duplicate
is duplicated by MC-11628 Potion effects are gone after enterin... Resolved
is duplicated by MC-48699 Effects are gone after pelepoting fro... Resolved
is duplicated by MC-78722 Potion Effects Disappearing Resolved
is duplicated by MC-85917 After leaving The End the potion effe... Resolved
is duplicated by MC-93030 Potion effects removed for no reason ... Resolved
is duplicated by MC-103241 The effect disappears. Resolved
is duplicated by MC-108788 removeing potion effects Resolved
is duplicated by MC-109000 lost effects when left end Resolved
is duplicated by MC-120114 Going through the return portal remov... Resolved
is duplicated by MC-130916 all status effects get cleared off wh... Resolved
is duplicated by MC-147568 Potion effects gets removed after lea... Resolved
is duplicated by MC-148945 Potion effects are lost when exiting ... Resolved
is duplicated by MC-154578 "Hero of the Village" effect (and any... Resolved
is duplicated by MC-156156 Regeneration and resistance stop work... Resolved
is duplicated by MC-156340 Potion effects instantly get disabled... Resolved
is duplicated by MC-162493 When you cross an end portal you lose... Resolved
is duplicated by MC-164592 Potion effects are removed when enter... Resolved
is duplicated by MC-166186 effects disappear after going through... Resolved
is duplicated by MC-174053 When I went ender, my effects dissapp... Resolved
is duplicated by MC-181632 portion effect disappearing Resolved
is duplicated by MC-183730 All effects disappear when you jump i... Resolved
is duplicated by MC-187767 The wither affect dissipars when goin... Resolved
is duplicated by MC-188134 All the effects disappear when player... Resolved
is duplicated by MC-188971 You lose your effects while going thr... Resolved
is duplicated by MC-190034 i lose effects when i go though the p... Resolved
is duplicated by MC-195424 DISREGARD RE-POST MISSED OC Potion Ef... Resolved
is duplicated by MC-199791 potion effects removed when going thr... Resolved
is duplicated by MC-205573 Player effects disappear after exitin... Resolved
is duplicated by MC-211956 When having Bad Omen effect and going... Resolved
is duplicated by MC-214845 Potion effects clear when leaving the... Resolved
is duplicated by MC-220494 Potion effects clear when entering en... Resolved
is duplicated by MC-223986 After you enter the exit portal all y... Resolved
is duplicated by MC-224604 Player loses status effects upon leav... Resolved
is duplicated by MC-225530 After exiting end with effect on you,... Resolved
is duplicated by MC-231050 When you give yourself health boost u... Resolved
is duplicated by MC-232959 Going though the end portal from the ... Resolved
is duplicated by MC-235108 Effects disappear when leave the end Resolved
is duplicated by MC-238190 Exit portal removes all stat effects Resolved
is duplicated by MC-253326 Player and mobs lost effects when the... Resolved
is duplicated by MC-256992 Leaving End clears status effects Resolved
is duplicated by MC-263492 Health bar cannot reset when entering... Resolved
is duplicated by MC-267206 Current Status Effects are cleared wh... Resolved
Relates
relates to MC-12062 Hotbar selection resets to the far le... Open
relates to MC-253476 Item cooldowns visually reset when ch... Open
relates to MC-88179 Armor bar disappears after changing d... Resolved
relates to MC-108821 All effects disappear when using a to... Resolved
relates to MC-252239 Sculk Shrieker count resets when ente... Resolved
relates to MC-3668 When going through nether portals wit... Resolved
relates to MC-124177 Teleporting to another dimension lose... Resolved
relates to MC-181604 Exiting the end portal resets player ... Resolved
relates to MC-196428 The nausea effect resets its distorti... Resolved
CHK:
Confirmation Status: Confirmed
Category:
Player
Mojang Priority: Important
Area: Platform

 Description   

The bug

After killing the dragon and exiting the end portal, all status effects are removed.

How to reproduce

  1. Drink a potion/eat a golden apple
  2. Enter the end
  3. Kill the dragon
  4. Make sure you have time remaining on the effects
  5. Enter the exit portal and skip the credits
    "wake up" and all of the effects will be gone

Analysis

Code analysis by pr0cess can be found in this comment.



 Comments   
Comment by Jean Dubois [ 11/May/24 ]

Can confirm in 24w19b

Comment by Bluebird [ 22/Apr/24 ]

Affects 1.20.5 Release Candidate 2

Comment by Jean Dubois [ 07/Apr/24 ]

Can confirm in 24w14a

Comment by CaptainFlame54 [ 14/Feb/24 ]

Can confirm in 24w06a

Comment by NULLYUKI [ 09/Dec/23 ]

Can confirm in 1.20.4

Comment by Kiz [ 29/May/23 ]

Affects 1.20 Pre-release 7.

Comment by Kiz [ 25/May/23 ]

Affects 1.20 Pre-release 6.

Comment by Kiz [ 23/May/23 ]

Affects 1.20 Pre-release 5.

Comment by Kiz [ 19/May/23 ]

Affects 1.20 Pre-release 4.

Comment by Kiz [ 16/May/23 ]

Affects 1.20 Pre-release 2.

Comment by Kiz [ 10/May/23 ]

Affects 1.20 Pre-release 1.

Comment by Kiz [ 03/May/23 ]

Affects 23w18a.

Comment by Kiz [ 27/Apr/23 ]

Affects 23w17a.

Comment by Kiz [ 20/Apr/23 ]

Affects 23w16a.

Comment by Kiz [ 05/Apr/23 ]

Affects 23w14a.

Comment by Kiz [ 29/Mar/23 ]

Affects 23w13a.

Comment by Kiz [ 22/Mar/23 ]

Affects 23w12a.

Comment by Kiz [ 13/Mar/23 ]

Affects 1.19.4 Release Candidate 3.

Comment by Kiz [ 12/Mar/23 ]

Affects 1.19.4 Release Candidate 2.

Comment by Kiz [ 10/Mar/23 ]

Affects 1.19.4 Release Candidate 1.

Comment by Kiz [ 08/Mar/23 ]

Affects 1.19.4 Pre-release 4.

Comment by Kiz [ 01/Mar/23 ]

Affects 1.19.4 Pre-release 3.

Comment by Kiz [ 22/Feb/23 ]

Affects 1.19.4 Pre-release 1.

Comment by Kiz [ 15/Feb/23 ]

Affects 23w07a.

Comment by Kiz [ 08/Feb/23 ]

Affects 23w06a.

Comment by Ray [ 04/Feb/23 ]

It seems to only affect players not mobs with effects.

Comment by Kiz [ 04/Feb/23 ]

Affects 23w05a.

Comment by [Mod] Avoma [ 07/Aug/22 ]

Can confirm in 1.19.2.

Comment by Jean Dubois [ 17/Jul/22 ]

Can someone check if this bug affects 1.19.1 pre releases ?

Comment by Toast_Cubed [ 21/Jun/22 ]

Present in 1.19 full release.

Comment by [Mod] EVGENSYPERPRO [ 19/Jun/22 ]

relates to MC-175210 and MCCE-1990

Comment by MacchuPicchu [ 03/Jun/22 ]

Present in 1.19-rc2.

Comment by MacchuPicchu [ 02/Jun/22 ]

Present in 1.19-rc1.

Comment by MacchuPicchu [ 01/Jun/22 ]

Present in 1.19-pre5.

Comment by MacchuPicchu [ 30/May/22 ]

Present in 1.19-pre4.

Comment by Shourin [ 26/May/22 ]

affects 1.19 pre 3

Comment by [Helper] clam lol [ 05/May/22 ]

Affects 22w18a.

Comment by [Helper] clam lol [ 03/Apr/22 ]

Affects 22w13a.

Comment by [Mod] Avoma [ 02/Mar/22 ]

Can confirm in 1.18.2.

Comment by theGlotzerify [ 11/Feb/22 ]

can confirm in 1.18.1

Comment by FX - PR0CESS [ 30/Sep/21 ]

Can confirm in 21w39a

Time for a code analysis. I made a working fix for the bug using this analysis, so I can say 100% that this is the issue. Fix

All Code Analysis is done in 1.17.1 using Mojang Mappings

Explanation of the problem:
When the player travels from the end to the overworld, it does not use the normal teleportation code or dimension change code. The reason for this is because the player might be watching the credits, so instead the player is removed from all worlds and awaits for the client to send a packet saying it's done to the server. It does this whether you are seeing the credits or not.
The issue is with the code that does this:
net/minecraft/server/level/ServerPlayer.java - restoreFrom(ServerPlayer, boolean)

public void restoreFrom(ServerPlayer oldPlayer, boolean alive) {
        ...
        if (alive) {
            this.getInventory().replaceWith(oldPlayer.getInventory());
            this.setHealth(oldPlayer.getHealth());
            this.foodData = oldPlayer.foodData;
            this.experienceLevel = oldPlayer.experienceLevel;
            this.totalExperience = oldPlayer.totalExperience;
            this.experienceProgress = oldPlayer.experienceProgress;
            this.setScore(oldPlayer.getScore());
            this.portalEntrancePos = oldPlayer.portalEntrancePos;
        } else if (this.level.getGameRules().getBoolean(RULE_KEEPINVENTORY) || oldPlayer.isSpectator()) {
            this.getInventory().replaceWith(oldPlayer.getInventory());
            this.experienceLevel = oldPlayer.experienceLevel;
            this.totalExperience = oldPlayer.totalExperience;
            this.experienceProgress = oldPlayer.experienceProgress;
            this.setScore(oldPlayer.getScore());
        }
        ...
    }

When you respawn using the end portal, it uses this function. Nothing else in the game uses restoreFrom(player,true) where alive is set to true. So I am sure that everything that happens here, only happens for the end portal.
As you can see, everything inside of  if (alive) is what gets transferred from the old player instance in the end to the new player instance in the overworld. Although player status is kept in the variable: activeEffects which it inherits from LivingEntity.java
So the fix is simply to add:

this.activeEffects.putAll(oldPlayer.activeEffects);

After: this.portalEntrancePos = oldPlayer.portalEntrancePos;

Although that's not all, after doing my testing there was another issue that happened. The effects do not instantly appear once you travel through, it takes a while. This is because like most other data, you need to tell the client about these changes. Here's where you can do that:

net/minecraft/server/players/PlayerList.javarespawn(ServerPlayer, boolean)

public ServerPlayer respawn(ServerPlayer oldPlayer, boolean ) {
        ...
        ServerPlayer newPlayer = new ServerPlayer(this.server, newLevel, oldPlayer.getGameProfile());
        ...
        newPlayer.restoreFrom(oldPlayer, alive); //This is where the other function is called from
        ...
        LevelData levelData = lvt9.level.getLevelData();
        newPlayer.connection.send(new ClientboundRespawnPacket(...));
        newPlayer.connection.teleport(...);
        newPlayer.connection.send(new ClientboundSetDefaultSpawnPositionPacket(...));
        newPlayer.connection.send(new ClientboundChangeDifficultyPacket(...));
        newPlayer.connection.send(new ClientboundSetExperiencePacket(...));
        ...
        return newPlayer;
    }

What you can notice from this code is that there are multiple newPlayer.connection.send() happening here to update the client's information, what we need to do is add another one for the status effects.

Unfortunately, the status effects packet has not been modified in a long time and still only transfers one status effect at a time, unlike many of the newly upgraded packets which send all their info at once. So we need to send a packet for each effect until that is changed.
Here is how you would do this, you would simply add:

// player = newPlayer
player.activeEffects.forEach((_,eff) -> {
    player.connection.send(new ClientboundUpdateMobEffectPacket(player.getId(), eff));
});

 Right after the last connection.send, which in this case is: newPlayer.connection.send(new ClientboundSetExperiencePacket(...));
That's it, now the effects are correctly transferred to the player when going from the overworld to the end & the client is updated so that they have the effects right before loading!

 

Comment by [Mod] Avoma [ 21/Jul/21 ]

Asher_Y, just to inform you, the 1.18 experimental snapshots are not supported on the bug tracker and this cannot be added as an affected version.

Comment by Asher [ 21/Jul/21 ]

Can confirm in 1.18 experimental snapshot 2

Comment by [Mod] Avoma [ 18/Jul/21 ]

Can confirm in 1.17.1.

Comment by Ray [ 07/Jun/21 ]

in 1.17 rc1

Comment by Brevort [ 06/May/21 ]

Can confirm in 21w18a.

Further, testing discovered MC-225055.

Comment by [Mod] Avoma [ 30/Apr/21 ]

Can confirm in 21w17a.

Comment by [Mod] Avoma [ 19/Apr/21 ]

Can confirm in 21w15a.

Comment by [Mod] Avoma [ 18/Feb/21 ]

Can confirm in 21w07a.

Comment by [Mod] Avoma [ 04/Feb/21 ]

Can confirm in 21w05b.

Comment by Composters [ 20/Jan/21 ]

confirmed 21w03a

Comment by [Mod] Avoma [ 25/Nov/20 ]

Can confirm 20w48a.

Comment by Mantegaloka [ 08/Sep/20 ]

Confirmed for 1.16.3-rc1

Comment by Leo Xiang [ 27/Aug/20 ]

Confirmed for 1.16.2

Comment by bugsbugsbugs [ 22/Jun/20 ]

Confirmed for 1.16-rc1

Comment by Bogdan Fediushin [ 13/Jun/20 ]

Confirmed for 1.16 Pre-release 5

Comment by DatSansyBoi [ 11/Jun/20 ]

Confirmed for 1.16 Pre-release 4

Comment by Jake Spencer [ 29/Jan/20 ]

Occurs in 1.15, 1.15.1, 1.15.2 also

Comment by KamiADN [ 10/Aug/19 ]

Confirmed for 1.14.4

Comment by Yanis [ 05/Mar/19 ]

Confirmed for 19w09a

Comment by Kraif [ 30/Aug/18 ]

Confirmed for 1.13.1.

Comment by user-a4a49 (Inactive) [ 05/Jul/18 ]

Affects 1.13-pre6!

Comment by ilmango [ 11/Dec/16 ]

confirmed for 1.11

Comment by TheGamingCat [ 24/Oct/16 ]

confirmed for 16w42a

Comment by TheGamingCat [ 17/Oct/16 ]

confirmed for singleplayer

Comment by Ashley5478 [ 06/Mar/16 ]

Confirmed for 1.9 Full realese

Comment by Marcono1234 [ 07/Jan/16 ]

Confirmed for

  • 15w51b

The reason for this is that the player respawns when he leaves the end through the portal. Therefor a new player instance is created and most data is copied, however for example active potion effects are not.

Comment by Marcono1234 [ 05/Nov/15 ]

Confirmed for

  • 15w45a
Comment by [Mod] Sonicwave [ 27/Aug/14 ]

Confirmed for 1.8-pre2.

Comment by qmagnet [ 19/Aug/14 ]

Confirmed for 14w34b

Comment by 08Juan80 [ 27/Mar/13 ]

It was already reopened by Kumasasa @Tails.

Comment by 08Juan80 [ 27/Mar/13 ]

Added the 3 screenshots from MC-11628 plus 2 extra screenshots.
And this affects to Minecraft 1.5, and Minecraft 1.5.1
Added other 4 screenshots.

Comment by Kumasasa [ 27/Mar/13 ]

Reopened, since not a duplicate of (but related to) MC-3668

Comment by 08Juan80 [ 27/Mar/13 ]

If a mod can reopen this issue if I'm right with my comment above...

Comment by 08Juan80 [ 27/Mar/13 ]

I think this is not a duplicate of MC-3668, it mentions the effects are lost when entering through the portal spawned when killing the ender dragon at the end, the one I mentioned in the comments there, and Kumasasa told me it was another issue, that MC-3668 mentions about the effect animations. If I'm right, my issue (MC-11628) is a duplicate of this one, not of MC-3668.

Comment by Joseph Sirna` [ 06/Jan/13 ]

I lost the indication of the effects and the effects themselves, I wasn't
moving nearly as fast.
Sounds like a duplicate of the bug mentioned by [OCD] Xavier Brown.

I'll look more closely for similar bugs next time.

Joseph Sirna

On Sun, Jan 6, 2013 at 12:04 PM, [Mod] Kumasasa (JIRA) <

Comment by Kumasasa [ 06/Jan/13 ]

did you lose the effects or only the indication of the effects, see MC-3668 ?

Generated at Sun Jan 12 12:11:10 UTC 2025 using Jira 9.12.2#9120002-sha1:301bf498dd45d800842af0b84230f1bb58606c13.