From f8be86a50e038b0c02378a10ce14e3630f0a1947 Mon Sep 17 00:00:00 2001 From: Alex <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Fri, 7 Apr 2023 01:21:33 +0200 Subject: [PATCH] Properly resync player on Player#setPlayerProfile (#9080) Currently breaking are potion effects and the XP bar, both are now being resent to make the client know about them again. --- patches/server/Player.setPlayerProfile-API.patch | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/patches/server/Player.setPlayerProfile-API.patch b/patches/server/Player.setPlayerProfile-API.patch index b99f6cde4d..ec7a640551 100644 --- a/patches/server/Player.setPlayerProfile-API.patch +++ b/patches/server/Player.setPlayerProfile-API.patch @@ -166,6 +166,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + connection.internalTeleport(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch(), java.util.Collections.emptySet()); + net.minecraft.server.MinecraftServer.getServer().getPlayerList().sendAllPlayerInfo(handle); + ++ // Resend their XP and effects because the respawn packet resets it ++ connection.send(new net.minecraft.network.protocol.game.ClientboundSetExperiencePacket(handle.experienceProgress, handle.totalExperience, handle.experienceLevel)); ++ for (net.minecraft.world.effect.MobEffectInstance mobEffect : handle.getActiveEffects()) { ++ connection.send(new net.minecraft.network.protocol.game.ClientboundUpdateMobEffectPacket(handle.getId(), mobEffect)); ++ } ++ + if (this.isOp()) { + this.setOp(false); + this.setOp(true);