Search in sources :

Example 1 with ClientboundBossEventPacket

use of net.minecraft.network.protocol.game.ClientboundBossEventPacket in project SpongeCommon by SpongePowered.

the class ServerPlayerMixin method bridge$setLanguage.

@Override
public void bridge$setLanguage(final Locale language) {
    // Update locale on Channel, used for sending localized messages
    if (this.connection != null) {
        final Channel channel = ((ConnectionAccessor) this.connection.connection).accessor$channel();
        channel.attr(SpongeAdventure.CHANNEL_LOCALE).set(language);
        SpongeAdventure.forEachBossBar(bar -> {
            if (bar.getPlayers().contains(this)) {
                this.connection.send(new ClientboundBossEventPacket(ClientboundBossEventPacket.Operation.UPDATE_NAME, bar));
            }
        });
    }
    this.impl$language = language;
}
Also used : Channel(io.netty.channel.Channel) ClientboundBossEventPacket(net.minecraft.network.protocol.game.ClientboundBossEventPacket) ConnectionAccessor(org.spongepowered.common.accessor.network.ConnectionAccessor)

Aggregations

Channel (io.netty.channel.Channel)1 ClientboundBossEventPacket (net.minecraft.network.protocol.game.ClientboundBossEventPacket)1 ConnectionAccessor (org.spongepowered.common.accessor.network.ConnectionAccessor)1