Search in sources :

Example 1 with SkinPart

use of org.spongepowered.api.data.type.SkinPart in project LanternServer by LanternPowered.

the class HumanoidEntityProtocol method update.

@Override
protected void update(ParameterList parameterList) {
    super.update(parameterList);
    final HandPreference dominantHand = this.entity.get(Keys.DOMINANT_HAND).orElse(HandPreferences.RIGHT);
    if (dominantHand != this.lastDominantHand) {
        parameterList.add(EntityParameters.Humanoid.MAIN_HAND, (byte) (dominantHand == HandPreferences.RIGHT ? 1 : 0));
        this.lastDominantHand = dominantHand;
    }
    final Set<SkinPart> skinParts = this.entity.get(LanternKeys.DISPLAYED_SKIN_PARTS).orElse(null);
    if (!Objects.equals(this.lastSkinParts, skinParts)) {
        parameterList.add(EntityParameters.Humanoid.SKIN_PARTS, (byte) (skinParts == null ? 0xff : LanternSkinPart.toBitPattern(skinParts)));
        this.lastSkinParts = skinParts;
    }
}
Also used : HandPreference(org.spongepowered.api.data.type.HandPreference) LanternSkinPart(org.lanternpowered.server.data.type.LanternSkinPart) SkinPart(org.spongepowered.api.data.type.SkinPart)

Aggregations

LanternSkinPart (org.lanternpowered.server.data.type.LanternSkinPart)1 HandPreference (org.spongepowered.api.data.type.HandPreference)1 SkinPart (org.spongepowered.api.data.type.SkinPart)1