From f4532410ec1dbf43ce15dfa78d07e5f7be408b08 Mon Sep 17 00:00:00 2001 From: Christian Date: Wed, 6 Nov 2013 16:18:41 -0500 Subject: [PATCH] Change a couple of warnings, as a prelude to 1.7- preinit is now required for all GameRegistry activity, and every item and block REQUIRES registration. --- common/cpw/mods/fml/common/Loader.java | 1 + .../mods/fml/common/registry/GameData.java | 25 +++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/common/cpw/mods/fml/common/Loader.java b/common/cpw/mods/fml/common/Loader.java index 55d1b86a77..2f52b54929 100644 --- a/common/cpw/mods/fml/common/Loader.java +++ b/common/cpw/mods/fml/common/Loader.java @@ -521,6 +521,7 @@ public class Loader modController.transition(LoaderState.PREINITIALIZATION, false); modController.distributeStateMessage(LoaderState.PREINITIALIZATION, disc.getASMTable(), canonicalConfigDir); modController.transition(LoaderState.INITIALIZATION, false); + GameData.validateRegistry(); } private void disableRequestedMods() diff --git a/common/cpw/mods/fml/common/registry/GameData.java b/common/cpw/mods/fml/common/registry/GameData.java index 2e452b00d1..fd2b966d5c 100644 --- a/common/cpw/mods/fml/common/registry/GameData.java +++ b/common/cpw/mods/fml/common/registry/GameData.java @@ -64,6 +64,7 @@ public class GameData { private static ImmutableTable modObjectTable; private static Table customItemStacks = HashBasedTable.create(); private static Map ignoredMods; + private static boolean validated; private static boolean isModIgnoredForIdValidation(String modId) { @@ -103,9 +104,9 @@ public class GameData { if (mc == null) { mc = Loader.instance().getMinecraftModContainer(); - if (Loader.instance().hasReachedState(LoaderState.AVAILABLE)) + if (Loader.instance().hasReachedState(LoaderState.INITIALIZATION) || validated) { - FMLLog.severe("It appears something has tried to allocate an Item outside of the initialization phase of Minecraft, this could be very bad for your network connectivity."); + FMLLog.severe("It appears something has tried to allocate an Item or Block outside of the preinitialization phase for mods. This will NOT work in 1.7 and beyond!"); } } String itemType = item.getClass().getName(); @@ -387,4 +388,24 @@ public class GameData { return new UniqueIdentifier(itemData.getModId(), itemData.getItemType()); } + + public static void validateRegistry() + { + for (int i = 0; i < Item.field_77698_e.length; i++) + { + if (Item.field_77698_e[i] != null) + { + ItemData itemData = idMap.get(i); + if (itemData == null) + { + FMLLog.severe("Found completely unknown item of class %s with ID %d, this will NOT work for a 1.7 upgrade", Item.field_77698_e[i].getClass().getName(), i); + } + else if (!itemData.isOveridden() && !"Minecraft".equals(itemData.getModId())) + { + FMLLog.severe("Found anonymous item of class %s with ID %d owned by mod %s, this item will NOT survive a 1.7 upgrade!", Item.field_77698_e[i].getClass().getName(), i, itemData.getModId()); + } + } + } + validated = true; + } }