Search in sources :

Example 1 with WolfAccessor

use of org.spongepowered.common.accessor.world.entity.animal.WolfAccessor in project SpongeCommon by SpongePowered.

the class WolfData method register.

// @formatter:off
public static void register(final DataProviderRegistrator registrator) {
    registrator.asMutable(Wolf.class).create(Keys.DYE_COLOR).get(h -> (DyeColor) (Object) h.getCollarColor()).set((h, v) -> h.setCollarColor((net.minecraft.world.item.DyeColor) (Object) v)).create(Keys.IS_BEGGING_FOR_FOOD).get(Wolf::isInterested).set(Wolf::setIsInterested).create(Keys.IS_WET).get(h -> ((WolfAccessor) h).accessor$isWet() || ((WolfAccessor) h).accessor$isShaking()).set((h, v) -> {
        final WolfAccessor accessor = (WolfAccessor) h;
        accessor.accessor$isWet(v);
        accessor.accessor$isShaking(v);
        accessor.accessor$shakeAnim(0f);
        accessor.accessor$shakeAnimO(0f);
    });
}
Also used : WolfAccessor(org.spongepowered.common.accessor.world.entity.animal.WolfAccessor) Wolf(net.minecraft.world.entity.animal.Wolf) Keys(org.spongepowered.api.data.Keys) DyeColor(org.spongepowered.api.data.type.DyeColor) DataProviderRegistrator(org.spongepowered.common.data.provider.DataProviderRegistrator) WolfAccessor(org.spongepowered.common.accessor.world.entity.animal.WolfAccessor) Wolf(net.minecraft.world.entity.animal.Wolf) DyeColor(org.spongepowered.api.data.type.DyeColor)

Aggregations

Wolf (net.minecraft.world.entity.animal.Wolf)1 Keys (org.spongepowered.api.data.Keys)1 DyeColor (org.spongepowered.api.data.type.DyeColor)1 WolfAccessor (org.spongepowered.common.accessor.world.entity.animal.WolfAccessor)1 DataProviderRegistrator (org.spongepowered.common.data.provider.DataProviderRegistrator)1