Skip to content

Commit e0f8086

Browse files
authored
Ore Vein Layer Error Checking (#4152)
1 parent 3e9ef50 commit e0f8086

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/main/java/com/gregtechceu/gtceu/api/data/worldgen/GTLayerPattern.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,21 @@ public static class Layer {
9999
public final int weight;
100100

101101
public Layer(List<Either<List<TargetBlockState>, Material>> targets, int minSize, int maxSize, int weight) {
102+
if (minSize > maxSize) {
103+
StringBuilder materialList = new StringBuilder().append(" with materials: ");
104+
for (var target : targets) {
105+
if (target.right().isPresent()) {
106+
materialList.append(target.right().get().getName()).append(",");
107+
}
108+
}
109+
if (!materialList.isEmpty()) {
110+
materialList.deleteCharAt(materialList.length() - 1);
111+
}
112+
113+
throw new IllegalArgumentException(
114+
"Layer must have minSize (%s) be lower than maxSize (%s)%s".formatted(minSize, maxSize,
115+
materialList.toString()));
116+
}
102117
this.targets = targets;
103118
this.minSize = minSize;
104119
this.maxSize = maxSize;

0 commit comments

Comments
 (0)