Started by
SparkleArts
on
Topic category: Help with Minecraft modding (Java Edition)
Am I stupid or does this Code doesn't throw an Exception in the Console?
public static SoulType register(String id, String displayName, SoulTypeRarities rarity, double corruption, double strength) throws IllegalArgumentException {
double minCorruption = 0;
double maxCorruption = 2;
double minStrength = 0;
double maxStrength = 5;
if (corruption < minCorruption || corruption > maxCorruption) {
AstralInfusionMod.LOGGER.info("Corruption Exception");
throw new IllegalArgumentException("Corruption must be between " + minCorruption + " and " + maxCorruption + " .");
}
if (strength < minStrength || strength > maxStrength) {
throw new IllegalArgumentException("Strength must be between " + minStrength + " and " + maxStrength + " .");
}
SoulType newType = new SoulType(id, displayName, rarity, corruption, strength);
for (SoulType soulType : SOUL_TYPES) {
if (soulType.getId().equals(id)) {
AstralInfusionMod.LOGGER.info("If Statement passed");
throw new IllegalArgumentException("SoulType with id '" + id + "' already exists.");
}
}
SOUL_TYPES.add(newType);
return newType;
}
Edited by SparkleArts on Mon, 07/15/2024 - 20:40