From e094eee54db2acefe6a211981cf96ca6d0dab526 Mon Sep 17 00:00:00 2001 From: oldkingOK <30453803+oldkingOK@users.noreply.github.com> Date: Mon, 15 Apr 2024 21:49:03 +0800 Subject: [PATCH] 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. --- .../java/net/minecraftforge/common/TierSortingRegistry.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/net/minecraftforge/common/TierSortingRegistry.java b/src/main/java/net/minecraftforge/common/TierSortingRegistry.java index 28b679189b..89356bc894 100644 --- a/src/main/java/net/minecraftforge/common/TierSortingRegistry.java +++ b/src/main/java/net/minecraftforge/common/TierSortingRegistry.java @@ -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 after, List 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);