diff --git a/fml/client/cpw/mods/fml/client/FMLClientHandler.java b/fml/client/cpw/mods/fml/client/FMLClientHandler.java index c42743c90..6337aaa54 100644 --- a/fml/client/cpw/mods/fml/client/FMLClientHandler.java +++ b/fml/client/cpw/mods/fml/client/FMLClientHandler.java @@ -39,6 +39,7 @@ import net.minecraft.crash.CrashReport; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.launchwrapper.Launch; import net.minecraft.network.INetworkManager; import net.minecraft.network.packet.NetHandler; import net.minecraft.network.packet.Packet; @@ -49,6 +50,7 @@ import net.minecraft.world.World; import com.google.common.base.Throwables; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Lists; import com.google.common.collect.MapDifference; import com.google.common.collect.MapDifference.ValueDifference; import com.google.common.collect.Maps; @@ -206,6 +208,22 @@ public class FMLClientHandler implements IFMLSidedHandler haltGame("There was a severe problem during mod loading that has caused the game to fail", le); return; } + + Map> sharedModList = (Map>) Launch.blackboard.get("modList"); + if (sharedModList == null) + { + sharedModList = Maps.newHashMap(); + Launch.blackboard.put("modList", sharedModList); + } + for (ModContainer mc : Loader.instance().getActiveModList()) + { + Map sharedModDescriptor = mc.getSharedModDescriptor(); + if (sharedModDescriptor != null) + { + String sharedModId = "fml:"+mc.getModId(); + sharedModList.put(sharedModId, sharedModDescriptor); + } + } } @Override @@ -249,6 +267,31 @@ public class FMLClientHandler implements IFMLSidedHandler KeyBindingRegistry.instance().uploadKeyBindingsToGame(client.field_71474_y); } + public void extendModList() + { + Map> modList = (Map>) Launch.blackboard.get("modList"); + if (modList != null) + { + for (Entry> modEntry : modList.entrySet()) + { + String sharedModId = modEntry.getKey(); + String system = sharedModId.split(":")[0]; + if ("fml".equals(system)) + { + continue; + } + Map mod = modEntry.getValue(); + String modSystem = mod.get("modsystem"); // the modsystem (FML uses FML or ModLoader) + String modId = mod.get("id"); // unique ID + String modVersion = mod.get("version"); // version + String modName = mod.get("name"); // a human readable name + String modURL = mod.get("url"); // a URL for the mod (can be empty string) + String modAuthors = mod.get("authors"); // a csv of authors (can be empty string) + String modDescription = mod.get("description"); // a (potentially) multiline description (can be empty string) + } + } + + } public void onInitializationComplete() { if (wrongMC != null) diff --git a/fml/common/cpw/mods/fml/common/DummyModContainer.java b/fml/common/cpw/mods/fml/common/DummyModContainer.java index 30790e8da..da39335e8 100644 --- a/fml/common/cpw/mods/fml/common/DummyModContainer.java +++ b/fml/common/cpw/mods/fml/common/DummyModContainer.java @@ -180,4 +180,10 @@ public class DummyModContainer implements ModContainer { return null; } + + @Override + public Map getSharedModDescriptor() + { + return null; + } } diff --git a/fml/common/cpw/mods/fml/common/FMLModContainer.java b/fml/common/cpw/mods/fml/common/FMLModContainer.java index f92ebb7c4..411b4594b 100644 --- a/fml/common/cpw/mods/fml/common/FMLModContainer.java +++ b/fml/common/cpw/mods/fml/common/FMLModContainer.java @@ -43,6 +43,7 @@ import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterators; import com.google.common.collect.ListMultimap; import com.google.common.collect.Lists; +import com.google.common.collect.Maps; import com.google.common.collect.Multimap; import com.google.common.collect.SetMultimap; import com.google.common.collect.Sets; @@ -613,4 +614,17 @@ public class FMLModContainer implements ModContainer return null; } } + @Override + public Map getSharedModDescriptor() + { + Map descriptor = Maps.newHashMap(); + descriptor.put("modsystem", "FML"); + descriptor.put("id", getModId()); + descriptor.put("version",getDisplayVersion()); + descriptor.put("name", getName()); + descriptor.put("url", modMetadata.url); + descriptor.put("authors", modMetadata.getAuthorList()); + descriptor.put("description", modMetadata.description); + return descriptor; + } } diff --git a/fml/common/cpw/mods/fml/common/InjectedModContainer.java b/fml/common/cpw/mods/fml/common/InjectedModContainer.java index 0d92367ef..88a61a96b 100644 --- a/fml/common/cpw/mods/fml/common/InjectedModContainer.java +++ b/fml/common/cpw/mods/fml/common/InjectedModContainer.java @@ -167,4 +167,10 @@ public class InjectedModContainer implements ModContainer { return wrappedContainer.getCustomResourcePackClass(); } + + @Override + public Map getSharedModDescriptor() + { + return wrappedContainer.getSharedModDescriptor(); + } } diff --git a/fml/common/cpw/mods/fml/common/ModContainer.java b/fml/common/cpw/mods/fml/common/ModContainer.java index 5d81d1f61..eaeb9c583 100644 --- a/fml/common/cpw/mods/fml/common/ModContainer.java +++ b/fml/common/cpw/mods/fml/common/ModContainer.java @@ -138,4 +138,6 @@ public interface ModContainer Map getCustomModProperties(); public Class getCustomResourcePackClass(); + + Map getSharedModDescriptor(); } diff --git a/fml/common/cpw/mods/fml/common/ModMetadata.java b/fml/common/cpw/mods/fml/common/ModMetadata.java index b2fc7a646..ecff0813f 100644 --- a/fml/common/cpw/mods/fml/common/ModMetadata.java +++ b/fml/common/cpw/mods/fml/common/ModMetadata.java @@ -5,7 +5,7 @@ * are made available under the terms of the GNU Lesser Public License v2.1 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - * + * * Contributors: * cpw - implementation */ @@ -68,7 +68,7 @@ public class ModMetadata public String modId; public String name; - public String description; + public String description = ""; public String url = ""; public String updateUrl = ""; diff --git a/fml/common/cpw/mods/fml/common/modloader/ModLoaderModContainer.java b/fml/common/cpw/mods/fml/common/modloader/ModLoaderModContainer.java index 050c9d16c..8ba43c678 100644 --- a/fml/common/cpw/mods/fml/common/modloader/ModLoaderModContainer.java +++ b/fml/common/cpw/mods/fml/common/modloader/ModLoaderModContainer.java @@ -34,6 +34,7 @@ import com.google.common.base.Strings; import com.google.common.base.Throwables; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; +import com.google.common.collect.Maps; import com.google.common.collect.Sets; import com.google.common.eventbus.EventBus; import com.google.common.eventbus.Subscribe; @@ -627,4 +628,17 @@ public class ModLoaderModContainer implements ModContainer { return null; } + @Override + public Map getSharedModDescriptor() + { + Map descriptor = Maps.newHashMap(); + descriptor.put("modsystem", "ModLoader"); + descriptor.put("id", getModId()); + descriptor.put("version",getDisplayVersion()); + descriptor.put("name", getName()); + descriptor.put("url", metadata.url); + descriptor.put("authors", metadata.getAuthorList()); + descriptor.put("description", metadata.description); + return descriptor; + } }