Exception doesn't throw in MCreator?

Started by SparkleArts on

Topic category: Help with modding (Java Edition)

Last seen on 19:50, 7. Sep 2024
Joined Feb 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Exception doesn't throw in MCreator?
Mon, 07/15/2024 - 20:40 (edited)

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