aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/shcm/shsupercm/fabric/citresewn/cit/CITCondition.java
blob: b5c1996c82aa7a921b4fed26df960c3a3417241b (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
package shcm.shsupercm.fabric.citresewn.cit;

import shcm.shsupercm.fabric.citresewn.CITResewn;
import shcm.shsupercm.fabric.citresewn.ex.CITParsingException;
import shcm.shsupercm.fabric.citresewn.pack.format.PropertyGroup;
import shcm.shsupercm.fabric.citresewn.pack.format.PropertyValue;

import java.util.Collections;
import java.util.Set;

public abstract class CITCondition {
    public abstract void load(PropertyValue value, PropertyGroup properties) throws CITParsingException;

    public Set<Class<? extends CITCondition>> siblingConditions() {
        return Collections.emptySet();
    }

    public <T extends CITCondition> T modifySibling(T sibling) {
        return sibling;
    }

    public abstract boolean test(CITContext context);

    protected void warn(String message, PropertyValue value, PropertyGroup properties) {
        CITResewn.logWarnLoading("Warning: " + CITParsingException.descriptionOf(message, properties, value.position()));
    }
}