From 56f31def7ba09e8d2df0047111ab1c85ecbd441b Mon Sep 17 00:00:00 2001 From: Player Date: Mon, 31 Mar 2014 04:09:59 +0200 Subject: [PATCH] Registry: allow handling missing blocks/items regardless of the mod id --- .../common/event/FMLMissingMappingsEvent.java | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/fml/src/main/java/cpw/mods/fml/common/event/FMLMissingMappingsEvent.java b/fml/src/main/java/cpw/mods/fml/common/event/FMLMissingMappingsEvent.java index b99edd0cc9..fdaac1d9be 100644 --- a/fml/src/main/java/cpw/mods/fml/common/event/FMLMissingMappingsEvent.java +++ b/fml/src/main/java/cpw/mods/fml/common/event/FMLMissingMappingsEvent.java @@ -16,8 +16,9 @@ import cpw.mods.fml.common.registry.GameRegistry; * This event is fired if a world is loaded that has block and item mappings referring the mod that are not * in existence. * These can be remapped to other existing objects, or simply discarded. + * Use get() and getAll() to process this event. * - * @author cpw + * @author cpw, Player * */ public class FMLMissingMappingsEvent extends FMLEvent { @@ -135,6 +136,7 @@ public class FMLMissingMappingsEvent extends FMLEvent { { this.missing = missingMappings; } + @Override public void applyModContainer(ModContainer activeContainer) { @@ -144,10 +146,29 @@ public class FMLMissingMappingsEvent extends FMLEvent { /** * Get the list of missing mappings for the active mod. - * @return + * + * Process the list entries by calling ignore(), warn(), fail() or remap() on each entry. + * + * @return list of missing mappings */ public List get() { return ImmutableList.copyOf(missing.get(activeContainer.getModId())); } + + /** + * Get the list of missing mappings for all mods. + * + * Only use this if you need to handle mod id changes, e.g. if you renamed your mod or + * split/merge into/from multiple mods. + * + * Process the list entries by calling ignore(), warn(), fail() or remap() on each entry you + * want to handle. + * + * @return list of missing mappings + */ + public List getAll() + { + return ImmutableList.copyOf(missing.values()); + } }