Search in sources :

Example 1 with MessagePlayInClientSettings

use of org.lanternpowered.server.network.vanilla.message.type.play.MessagePlayInClientSettings in project LanternServer by LanternPowered.

the class CodecPlayInClientSettings method decode.

@Override
public MessagePlayInClientSettings decode(CodecContext context, ByteBuffer buf) throws CodecException {
    final Locale locale = LocaleCache.get(buf.readLimitedString(16));
    final int viewDistance = buf.readByte();
    final ChatVisibility visibility = ChatVisibilityRegistryModule.get().getByInternalId(buf.readByte()).get();
    final boolean enableColors = buf.readBoolean();
    final int skinPartsBitPattern = buf.readByte() & 0xff;
    final HandPreference dominantHand = buf.readVarInt() == 1 ? HandPreferences.RIGHT : HandPreferences.LEFT;
    return new MessagePlayInClientSettings(locale, viewDistance, visibility, dominantHand, enableColors, skinPartsBitPattern);
}
Also used : Locale(java.util.Locale) ChatVisibility(org.spongepowered.api.text.chat.ChatVisibility) HandPreference(org.spongepowered.api.data.type.HandPreference) MessagePlayInClientSettings(org.lanternpowered.server.network.vanilla.message.type.play.MessagePlayInClientSettings)

Aggregations

Locale (java.util.Locale)1 MessagePlayInClientSettings (org.lanternpowered.server.network.vanilla.message.type.play.MessagePlayInClientSettings)1 HandPreference (org.spongepowered.api.data.type.HandPreference)1 ChatVisibility (org.spongepowered.api.text.chat.ChatVisibility)1