Search in sources :

Example 1 with OrTraitCondition

use of net.silentchaos512.gear.gear.trait.condition.OrTraitCondition in project Silent-Gear by SilentChaos512.

the class TraitBuilder method withGearTypeCondition.

public TraitBuilder withGearTypeCondition(GearType first, GearType... rest) {
    if (rest.length > 0) {
        Collection<GearType> types = new ArrayList<>(rest.length + 1);
        types.add(first);
        Collections.addAll(types, rest);
        GearTypeTraitCondition[] values = types.stream().map(GearTypeTraitCondition::new).toArray(GearTypeTraitCondition[]::new);
        return withConditions(new OrTraitCondition(values));
    }
    return withConditions(new GearTypeTraitCondition(first));
}
Also used : GearType(net.silentchaos512.gear.api.item.GearType) OrTraitCondition(net.silentchaos512.gear.gear.trait.condition.OrTraitCondition) ArrayList(java.util.ArrayList) GearTypeTraitCondition(net.silentchaos512.gear.gear.trait.condition.GearTypeTraitCondition)

Aggregations

ArrayList (java.util.ArrayList)1 GearType (net.silentchaos512.gear.api.item.GearType)1 GearTypeTraitCondition (net.silentchaos512.gear.gear.trait.condition.GearTypeTraitCondition)1 OrTraitCondition (net.silentchaos512.gear.gear.trait.condition.OrTraitCondition)1