From 3101006e5867b4b1d4dfebd69ffad0023e1fc2be Mon Sep 17 00:00:00 2001 From: Christian Date: Thu, 31 Jan 2013 13:39:53 -0500 Subject: [PATCH] IMC tweaks: runtimeMessages now work (thanks for all that testing for this much requested feature!) and IMCEvent will no longer remove messages if no one gets them, so you can do just manual runtime polling, if you wish. --- .../cpw/mods/fml/common/event/FMLInterModComms.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/fml/common/cpw/mods/fml/common/event/FMLInterModComms.java b/fml/common/cpw/mods/fml/common/event/FMLInterModComms.java index a2d7e02f96..31f9f1131c 100644 --- a/fml/common/cpw/mods/fml/common/event/FMLInterModComms.java +++ b/fml/common/cpw/mods/fml/common/event/FMLInterModComms.java @@ -44,17 +44,23 @@ public class FMLInterModComms { * */ public static class IMCEvent extends FMLEvent { + private ModContainer activeContainer; + @Override public void applyModContainer(ModContainer activeContainer) { - currentList = ImmutableList.copyOf(modMessages.removeAll(activeContainer.getModId())); - FMLLog.finest("Attempting to deliver %d IMC messages to mod %s", currentList.size(), activeContainer.getModId()); + this.activeContainer = activeContainer; + FMLLog.finest("Attempting to deliver %d IMC messages to mod %s", modMessages.get(activeContainer.getModId()).size(), activeContainer.getModId()); } private ImmutableList currentList; public ImmutableList getMessages() { + if (currentList == null) + { + currentList = ImmutableList.copyOf(modMessages.removeAll(activeContainer.getModId())); + } return currentList; } } @@ -202,7 +208,7 @@ public class FMLInterModComms { ModContainer mc = FMLCommonHandler.instance().findContainerFor(forMod); if (mc != null) { - return ImmutableList.copyOf(modMessages.removeAll(mc)); + return ImmutableList.copyOf(modMessages.removeAll(mc.getModId())); } else {