aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/shcm/shsupercm/fabric/citresewn/cit/CIT.java
blob: 3bc708f37407a9aa18b59fde62ef929d3293cf94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package shcm.shsupercm.fabric.citresewn.cit;

import net.minecraft.util.Identifier;

public class CIT<T extends CITType> {
    public final Identifier propertiesIdentifier;
    public final String packName;
    public final T type;
    public final CITCondition[] conditions;
    public final int weight;

    public CIT(Identifier propertiesIdentifier, String packName, T type, CITCondition[] conditions, int weight) {
        this.propertiesIdentifier = propertiesIdentifier;
        this.packName = packName;
        this.type = type;
        this.conditions = conditions;
        this.weight = weight;
    }

    public boolean test(CITContext context) {
        try {
            for (CITCondition condition : conditions)
                if (!condition.test(context))
                    return false;

            return true;
        } catch (Exception ignored) {
            return false;
        }
    }
}