blob: 7640d3cd3b1c963d6eb066e370a9cf6ba55b5f11 (
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
32
33
34
35
|
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(Class<? extends CITCondition> siblingType, 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()));
}
protected int parseInteger(PropertyValue value, PropertyGroup properties) throws CITParsingException {
try {
return Integer.parseInt(value.value());
} catch (NumberFormatException e) {
throw new CITParsingException("\"" + value.value() + "\" is not a valid integer", properties, value.position());
}
}
}
|