Search in sources :

Example 1 with Cycleable

use of org.spongepowered.api.util.Cycleable in project SpongeCommon by SpongePowered.

the class MixinStateImplementation method cycleValue.

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public BlockState cycleValue(Key<? extends BaseValue<? extends Cycleable<?>>> key) {
    if (supports(key)) {
        final Cycleable value = (Cycleable) get((Key) key).get();
        final Cycleable next = value.cycleNext();
        return with((Key<? extends BaseValue<Object>>) (Key<?>) key, next).get();
    }
    throw new IllegalArgumentException("Used an invalid cyclable key! Check with supports in the future!");
}
Also used : BaseValue(org.spongepowered.api.data.value.BaseValue) Cycleable(org.spongepowered.api.util.Cycleable) Key(org.spongepowered.api.data.key.Key)

Aggregations

Key (org.spongepowered.api.data.key.Key)1 BaseValue (org.spongepowered.api.data.value.BaseValue)1 Cycleable (org.spongepowered.api.util.Cycleable)1