Prevent registering null tiers (#9895)

Makes it easier to identify broken mods, as it moves the crash to when the broken mod in question registers the tier, rather than when any mod tries getting the tier.
This commit is contained in:
oldkingOK authored and GitHub committed 2024-04-15 14:49:03 +01:00
1 parent a6adc58655
commit e094eee54d
1 file changed
+2
@@ -64,6 +64,8 @@ public class TierSortingRegistry {
* @param before List of tiers to place this tier before (the tiers in the list will be considered better tiers)
*/
public static synchronized Tier registerTier(Tier tier, ResourceLocation name, List<Object> after, List<Object> before) {
if (tier == null)
throw new NullPointerException("Registering a new Tier requires a nonnull tier! ResourceLocation name: " + name);
if (tiers.containsKey(name))
throw new IllegalStateException("Duplicate tier name " + name);