Fix up derpy file name handling: closes #127

Fix up duping childmods: closes #126
FMLPreinitializationEvent now offers a getLogger() that'll return your mod a personalized logger instance
This commit is contained in:
Christian 2012-11-12 17:50:44 -05:00
parent 5355348181
commit 8a40e72f90
3 changed files with 19 additions and 7 deletions

View file

@ -57,7 +57,7 @@ public class GuiModList extends GuiScreen
if (mod.getMetadata()!=null && !Strings.isNullOrEmpty(mod.getMetadata().parent)) {
String parentMod = mod.getMetadata().parent;
ModContainer parentContainer = Loader.instance().getIndexedModList().get(parentMod);
if (parentContainer != null)
if (parentContainer != null && mod.getMetadata().parentMod==null)
{
mod.getMetadata().parentMod = parentContainer;
parentContainer.getMetadata().childMods.add(mod);

View file

@ -2,7 +2,9 @@ package cpw.mods.fml.common.event;
import java.io.File;
import java.util.Properties;
import java.util.logging.Logger;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.LoaderState.ModState;
import cpw.mods.fml.common.FMLModContainer;
import cpw.mods.fml.common.ModContainer;
@ -74,4 +76,16 @@ public class FMLPreInitializationEvent extends FMLStateEvent
return null;
}
/**
* Get a logger instance configured to write to the FML Log as a parent, identified by modid. Handy for mod logging!
*
* @return A logger
*/
public Logger getModLog()
{
Logger log = Logger.getLogger(modContainer.getModId());
log.setParent(FMLLog.getLogger());
return log;
}
}

View file

@ -170,11 +170,11 @@ public class RelaunchLibraryManager
if (!download)
{
downloadMonitor.updateProgressString("Found library file %s present and correct in lib dir\n", libName);
downloadMonitor.updateProgressString("Found library file %s present and correct in lib dir", libName);
}
else
{
downloadMonitor.updateProgressString("Library file %s was downloaded and verified successfully\n", libName);
downloadMonitor.updateProgressString("Library file %s was downloaded and verified successfully", libName);
}
try
@ -455,11 +455,9 @@ public class RelaunchLibraryManager
{
try
{
//rootUrl.replace("%s", libFile.getPath())
URL libDownload = new URL(String.format(rootUrl,realFilePath));
String infoString = String.format("Downloading file %s", libDownload.toString());
downloadMonitor.updateProgressString(infoString);
FMLRelaunchLog.info(infoString);
downloadMonitor.updateProgressString("Downloading file %s", libDownload.toString());
FMLRelaunchLog.info("Downloading file %s", libDownload.toString());
URLConnection connection = libDownload.openConnection();
connection.setConnectTimeout(5000);
connection.setReadTimeout(5000);