Search in sources :

Example 1 with IMixinBanner

use of org.spongepowered.common.interfaces.block.tile.IMixinBanner in project SpongeCommon by SpongePowered.

the class TileEntityBannerDataProcessor method set.

@SuppressWarnings("unchecked")
@Override
protected boolean set(TileEntityBanner entity, Map<Key<?>, Object> keyValues) {
    if (!entity.getWorld().isRemote) {
        List<PatternLayer> layers = (List<PatternLayer>) keyValues.get(Keys.BANNER_PATTERNS);
        DyeColor baseColor = (DyeColor) keyValues.get(Keys.BANNER_BASE_COLOR);
        ((IMixinBanner) entity).setLayers(layers);
        ((IMixinBanner) entity).setBaseColor(baseColor);
        return true;
    }
    return false;
}
Also used : PatternLayer(org.spongepowered.api.data.meta.PatternLayer) List(java.util.List) DyeColor(org.spongepowered.api.data.type.DyeColor) IMixinBanner(org.spongepowered.common.interfaces.block.tile.IMixinBanner)

Example 2 with IMixinBanner

use of org.spongepowered.common.interfaces.block.tile.IMixinBanner in project SpongeCommon by SpongePowered.

the class TileEntityBannerDataProcessor method getValues.

@Override
protected Map<Key<?>, ?> getValues(TileEntityBanner entity) {
    List<PatternLayer> layers = ((IMixinBanner) entity).getLayers();
    DyeColor color = ((IMixinBanner) entity).getBaseColor();
    return ImmutableMap.of(Keys.BANNER_BASE_COLOR, color, Keys.BANNER_PATTERNS, layers);
}
Also used : PatternLayer(org.spongepowered.api.data.meta.PatternLayer) IMixinBanner(org.spongepowered.common.interfaces.block.tile.IMixinBanner) DyeColor(org.spongepowered.api.data.type.DyeColor)

Aggregations

PatternLayer (org.spongepowered.api.data.meta.PatternLayer)2 DyeColor (org.spongepowered.api.data.type.DyeColor)2 IMixinBanner (org.spongepowered.common.interfaces.block.tile.IMixinBanner)2 List (java.util.List)1