Actually fail CI if generation fails (#30)

* Actually fail unit tests if generation fails

* Do not fail fast

* Fix 1.8.9 spam

* Fix 1.8.9 generation

* Fix 1.8.9 generation

* Fix entity generation on 4 versions

* Fix projectile thrown package

* Disable 1.17 recipe generator
This commit is contained in:
Alex
2024-10-27 15:07:25 +01:00
committed by GitHub
parent 91251bcf06
commit b8e0215b2a
12 changed files with 173 additions and 143 deletions
@@ -0,0 +1,21 @@
package dev.u9g.minecraftdatagenerator;
import java.lang.reflect.Field;
public class FieldHelper {
public static Field findStaticFieldWithValue(Class<?> clazz, Object value) {
for (Field field : clazz.getDeclaredFields()) {
try {
field.setAccessible(true);
if (field.get(null).equals(value)) {
return field;
}
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}
throw new IllegalArgumentException("No field with value " + value + " found in " + clazz);
}
}
@@ -22,6 +22,6 @@ public class MinecraftDataGenerator {
} else {
MinecraftDataGenerator.LOGGER.severe("Data generation failed!");
}
Runtime.getRuntime().halt(0);
Runtime.getRuntime().halt(success ? 0 : 1);
}
}