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.
This commit is contained in:
Alex 2023-04-07 01:21:33 +02:00
parent cec73ac951
commit f8be86a50e

View file

@ -166,6 +166,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ connection.internalTeleport(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch(), java.util.Collections.emptySet()); + connection.internalTeleport(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch(), java.util.Collections.emptySet());
+ net.minecraft.server.MinecraftServer.getServer().getPlayerList().sendAllPlayerInfo(handle); + 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()) { + if (this.isOp()) {
+ this.setOp(false); + this.setOp(false);
+ this.setOp(true); + this.setOp(true);