--- a/net/minecraft/network/PacketEncoder.java +++ b/net/minecraft/network/PacketEncoder.java @@ -17,10 +17,12 @@ this.protocolInfo = state; } + static final ThreadLocal ADVENTURE_LOCALE = ThreadLocal.withInitial(() -> null); // Paper - adventure; set player's locale protected void encode(ChannelHandlerContext channelHandlerContext, Packet packet, ByteBuf byteBuf) throws Exception { PacketType> packetType = packet.type(); try { + ADVENTURE_LOCALE.set(channelHandlerContext.channel().attr(io.papermc.paper.adventure.PaperAdventure.LOCALE_ATTRIBUTE).get()); // Paper - adventure; set player's locale this.protocolInfo.codec().encode(byteBuf, packet); int i = byteBuf.readableBytes(); if (LOGGER.isDebugEnabled()) { @@ -31,7 +33,7 @@ JvmProfiler.INSTANCE.onPacketSent(this.protocolInfo.id(), packetType, channelHandlerContext.channel().remoteAddress(), i); } catch (Throwable var9) { - LOGGER.error("Error sending packet {}", packetType, var9); + LOGGER.error("Error sending packet {} (skippable? {})", packetType, packet.isSkippable(), var9); if (packet.isSkippable()) { throw new SkipPacketException(var9); }