From f169f7c92f479a0a8241aabbd26373cf4c1f4c2d Mon Sep 17 00:00:00 2001 From: Christian Date: Wed, 30 Jan 2013 18:57:21 -0500 Subject: [PATCH 1/6] A log of logging cleanup. FML will now read logging.properties to configure logging channels a couple of times during startup. You should be able to filter a lot of messages based on things like modid and certain FML related features that can be noisy like item tracking. Should close #175 --- client/cpw/mods/fml/client/SpriteHelper.java | 6 +- .../cpw/mods/fml/client/TextureFXManager.java | 13 ++-- .../modloader/ModLoaderClientHelper.java | 16 ++--- .../minecraft/src/FMLRenderAccessLibrary.java | 6 +- commands.patch | 33 ++++++--- .../cpw/mods/fml/common/FMLCommonHandler.java | 7 +- .../mods/fml/common/FMLDummyContainer.java | 5 +- common/cpw/mods/fml/common/FMLLog.java | 15 ++++ .../cpw/mods/fml/common/FMLModContainer.java | 26 +++---- .../cpw/mods/fml/common/LoadController.java | 32 ++++++--- common/cpw/mods/fml/common/Loader.java | 40 +++++++---- .../cpw/mods/fml/common/ModClassLoader.java | 2 +- .../fml/common/discovery/ModDiscoverer.java | 2 +- .../event/FMLPreInitializationEvent.java | 2 + .../mods/fml/common/registry/GameData.java | 18 ++--- .../fml/common/registry/LanguageRegistry.java | 6 +- .../mods/fml/relauncher/FMLRelaunchLog.java | 72 +++++++++++++++---- 17 files changed, 203 insertions(+), 98 deletions(-) diff --git a/client/cpw/mods/fml/client/SpriteHelper.java b/client/cpw/mods/fml/client/SpriteHelper.java index e65439e6a4..0c2a6133f2 100644 --- a/client/cpw/mods/fml/client/SpriteHelper.java +++ b/client/cpw/mods/fml/client/SpriteHelper.java @@ -80,7 +80,7 @@ public class SpriteHelper initMCSpriteMaps(); } if (spriteInfo.containsKey(file)) { - FMLCommonHandler.instance().getFMLLogger().finer(String.format("Duplicate attempt to register a sprite file %s for overriding -- ignoring",file)); + FMLLog.log("fml.TextureManager", Level.FINE, "Duplicate attempt to register a sprite file %s for overriding -- ignoring",file); return; } spriteInfo.put(file, toBitSet(spriteMap)); @@ -98,7 +98,7 @@ public class SpriteHelper if (slots == null) { Exception ex = new Exception(String.format("Invalid getUniqueSpriteIndex call for texture: %s", path)); - FMLLog.log(Level.SEVERE, ex, "A critical error has been detected with sprite overrides"); + FMLLog.log("fml.TextureManager", Level.SEVERE, ex, "A critical error has been detected with sprite overrides"); FMLCommonHandler.instance().raiseException(ex,"Invalid request to getUniqueSpriteIndex",true); } @@ -107,7 +107,7 @@ public class SpriteHelper if (ret == -1) { Exception ex = new Exception(String.format("No more sprite indicies left for: %s", path)); - FMLLog.log(Level.SEVERE, ex, "There are no sprite indicies left for %s", path); + FMLLog.log("fml.TextureManager", Level.SEVERE, ex, "There are no sprite indicies left for %s", path); FMLCommonHandler.instance().raiseException(ex,"No more sprite indicies left", true); } return ret; diff --git a/client/cpw/mods/fml/client/TextureFXManager.java b/client/cpw/mods/fml/client/TextureFXManager.java index d041348aee..fe1fe5575f 100644 --- a/client/cpw/mods/fml/client/TextureFXManager.java +++ b/client/cpw/mods/fml/client/TextureFXManager.java @@ -15,6 +15,7 @@ import java.util.IdentityHashMap; import java.util.List; import java.util.ListIterator; import java.util.Map; +import java.util.logging.Level; import javax.imageio.ImageIO; @@ -77,7 +78,7 @@ public class TextureFXManager } catch (Exception e) { - FMLLog.warning("Texture FX %s has failed to animate. Likely caused by a texture pack change that they did not respond correctly to", name); + FMLLog.log("fml.TextureManager", Level.WARNING, "Texture FX %s has failed to animate. Likely caused by a texture pack change that they did not respond correctly to", name); if (ifx != null) { ifx.setErrored(true); @@ -93,7 +94,7 @@ public class TextureFXManager int target = ((dim.width >> 4) * (dim.height >> 4)) << 2; if (effect.field_76852_a.length != target) { - FMLLog.warning("Detected a texture FX sizing discrepancy in %s (%d, %d)", name, effect.field_76852_a.length, target); + FMLLog.log("fml.TextureManager", Level.WARNING, "Detected a texture FX sizing discrepancy in %s (%d, %d)", name, effect.field_76852_a.length, target); ifx.setErrored(true); return false; } @@ -232,7 +233,7 @@ public class TextureFXManager for (OverrideInfo animationOverride : animationSet) { renderer.func_78355_a(animationOverride.textureFX); addedTextureFX.add(animationOverride.textureFX); - FMLCommonHandler.instance().getFMLLogger().finer(String.format("Registered texture override %d (%d) on %s (%d)", animationOverride.index, animationOverride.textureFX.field_76850_b, animationOverride.textureFX.getClass().getSimpleName(), animationOverride.textureFX.field_76847_f)); + FMLLog.log("fml.TextureManager", Level.FINE, "Registered texture override %d (%d) on %s (%d)", animationOverride.index, animationOverride.textureFX.field_76850_b, animationOverride.textureFX.getClass().getSimpleName(), animationOverride.textureFX.field_76847_f); } for (String fileToOverride : overrideInfo.keySet()) { @@ -243,11 +244,11 @@ public class TextureFXManager ModTextureStatic mts=new ModTextureStatic(override.index, 1, override.texture, image); renderer.func_78355_a(mts); addedTextureFX.add(mts); - FMLCommonHandler.instance().getFMLLogger().finer(String.format("Registered texture override %d (%d) on %s (%d)", override.index, mts.field_76850_b, override.texture, mts.field_76847_f)); + FMLLog.log("fml.TextureManager", Level.FINE, "Registered texture override %d (%d) on %s (%d)", override.index, mts.field_76850_b, override.texture, mts.field_76847_f); } catch (IOException e) { - FMLCommonHandler.instance().getFMLLogger().throwing("FMLClientHandler", "registerTextureOverrides", e); + FMLLog.log("fml.TextureManager", Level.WARNING, e, "Exception occurred registering texture override for %s", fileToOverride); } } } @@ -294,7 +295,7 @@ public class TextureFXManager info.override = overridingTexturePath; info.texture = textureToOverride; overrideInfo.put(textureToOverride, info); - FMLLog.fine("Overriding %s @ %d with %s. %d slots remaining",textureToOverride, location, overridingTexturePath, SpriteHelper.freeSlotCount(textureToOverride)); + FMLLog.log("fml.TextureManager", Level.FINE, "Overriding %s @ %d with %s. %d slots remaining",textureToOverride, location, overridingTexturePath, SpriteHelper.freeSlotCount(textureToOverride)); } public BufferedImage loadImageFromTexturePack(RenderEngine renderEngine, String path) throws IOException diff --git a/client/cpw/mods/fml/client/modloader/ModLoaderClientHelper.java b/client/cpw/mods/fml/client/modloader/ModLoaderClientHelper.java index 6312484b72..4d3016653c 100644 --- a/client/cpw/mods/fml/client/modloader/ModLoaderClientHelper.java +++ b/client/cpw/mods/fml/client/modloader/ModLoaderClientHelper.java @@ -57,38 +57,38 @@ public class ModLoaderClientHelper implements IModLoaderSidedHelper public static void handleFinishLoadingFor(ModLoaderModContainer mc, Minecraft game) { - FMLLog.finer("Handling post startup activities for ModLoader mod %s", mc.getModId()); + FMLLog.log(mc.getModId(), Level.FINE, "Handling post startup activities for ModLoader mod %s", mc.getModId()); BaseMod mod = (BaseMod) mc.getMod(); Map, Render> renderers = Maps.newHashMap(RenderManager.field_78727_a.field_78729_o); try { - FMLLog.finest("Requesting renderers from basemod %s", mc.getModId()); + FMLLog.log(mc.getModId(), Level.FINEST, "Requesting renderers from basemod %s", mc.getModId()); mod.addRenderer(renderers); - FMLLog.finest("Received %d renderers from basemod %s", renderers.size(), mc.getModId()); + FMLLog.log(mc.getModId(), Level.FINEST, "Received %d renderers from basemod %s", renderers.size(), mc.getModId()); } catch (Exception e) { - FMLLog.log(Level.SEVERE, e, "A severe problem was detected with the mod %s during the addRenderer call. Continuing, but expect odd results", mc.getModId()); + FMLLog.log(mc.getModId(), Level.SEVERE, e, "A severe problem was detected with the mod %s during the addRenderer call. Continuing, but expect odd results", mc.getModId()); } MapDifference, Render> difference = Maps.difference(RenderManager.field_78727_a.field_78729_o, renderers, Equivalences.identity()); for ( Entry, Render> e : difference.entriesOnlyOnLeft().entrySet()) { - FMLLog.warning("The mod %s attempted to remove an entity renderer %s from the entity map. This will be ignored.", mc.getModId(), e.getKey().getName()); + FMLLog.log(mc.getModId(), Level.WARNING, "The mod %s attempted to remove an entity renderer %s from the entity map. This will be ignored.", mc.getModId(), e.getKey().getName()); } for (Entry, Render> e : difference.entriesOnlyOnRight().entrySet()) { - FMLLog.finest("Registering ModLoader entity renderer %s as instance of %s", e.getKey().getName(), e.getValue().getClass().getName()); + FMLLog.log(mc.getModId(), Level.FINEST, "Registering ModLoader entity renderer %s as instance of %s", e.getKey().getName(), e.getValue().getClass().getName()); RenderingRegistry.registerEntityRenderingHandler(e.getKey(), e.getValue()); } for (Entry, ValueDifference> e : difference.entriesDiffering().entrySet()) { - FMLLog.finest("Registering ModLoader entity rendering override for %s as instance of %s", e.getKey().getName(), e.getValue().rightValue().getClass().getName()); + FMLLog.log(mc.getModId(), Level.FINEST, "Registering ModLoader entity rendering override for %s as instance of %s", e.getKey().getName(), e.getValue().rightValue().getClass().getName()); RenderingRegistry.registerEntityRenderingHandler(e.getKey(), e.getValue().rightValue()); } @@ -98,7 +98,7 @@ public class ModLoaderClientHelper implements IModLoaderSidedHelper } catch (Exception e) { - FMLLog.log(Level.SEVERE, e, "A severe problem was detected with the mod %s during the registerAnimation call. Continuing, but expect odd results", mc.getModId()); + FMLLog.log(mc.getModId(), Level.SEVERE, e, "A severe problem was detected with the mod %s during the registerAnimation call. Continuing, but expect odd results", mc.getModId()); } } diff --git a/client/net/minecraft/src/FMLRenderAccessLibrary.java b/client/net/minecraft/src/FMLRenderAccessLibrary.java index 2032e8aed3..18d7159678 100644 --- a/client/net/minecraft/src/FMLRenderAccessLibrary.java +++ b/client/net/minecraft/src/FMLRenderAccessLibrary.java @@ -41,12 +41,14 @@ public class FMLRenderAccessLibrary { public static Logger getLogger() { - return FMLLog.getLogger(); + Logger l = Logger.getLogger("FMLRenderAccessLibrary"); + l.setParent(FMLLog.getLogger()); + return l; } public static void log(Level level, String message) { - FMLLog.log(level, message); + FMLLog.log("FMLRenderAccessLibrary", level, message); } public static void log(Level level, String message, Throwable throwable) diff --git a/commands.patch b/commands.patch index 2e3750e843..a833794700 100644 --- a/commands.patch +++ b/commands.patch @@ -18,7 +18,18 @@ if not os.path.exists(os.path.join(binlk[side], os.path.normpath(testlk[side] + '.class'))): return False return True -@@ -1062,7 +1066,7 @@ +@@ -1029,6 +1033,10 @@ + pathsrclk = {CLIENT: self.srcclient, SERVER: self.srcserver} + pathlog = {CLIENT: self.clientrecomplog, SERVER: self.serverrecomplog} + ++ if side == SERVER: #Disable server because FML recombines it into client ++ self.logger.info('Server side recompiling skipped, this is normal') ++ return ++ + if not os.path.exists(pathbinlk[side]): + os.makedirs(pathbinlk[side]) + +@@ -1062,7 +1070,7 @@ raise def startserver(self): @@ -27,7 +38,7 @@ classpath = [os.path.join('..', p) for p in classpath] classpath = os.pathsep.join(classpath) os.chdir(self.dirjars) -@@ -1070,7 +1074,7 @@ +@@ -1070,7 +1078,7 @@ self.runmc(forkcmd) def startclient(self): @@ -36,7 +47,7 @@ classpath = [os.path.join('..', p) for p in classpath] classpath = os.pathsep.join(classpath) natives = os.path.join('..', self.dirnatives) -@@ -1197,20 +1201,20 @@ +@@ -1197,20 +1205,20 @@ with open(self.csvmethods, 'rb') as fh: methodsreader = csv.DictReader(fh) for row in methodsreader: @@ -60,7 +71,7 @@ names['params'][row['param']] = row['name'] regexps = { -@@ -1344,13 +1348,13 @@ +@@ -1344,13 +1352,13 @@ methods = {} for row in methodsreader: #HINT: Only include methods that have a non-empty description @@ -76,7 +87,7 @@ fields[row['searge']] = row['desc'].replace('*/', '* /') regexps = { -@@ -1427,7 +1431,7 @@ +@@ -1427,7 +1435,7 @@ self.runcmd(forkcmd) return True @@ -85,7 +96,7 @@ if not reobf: md5lk = {CLIENT: self.md5client, SERVER: self.md5server} else: -@@ -1442,6 +1446,9 @@ +@@ -1442,6 +1450,9 @@ class_path = '' else: class_path += '/' @@ -95,7 +106,7 @@ for class_file in fnmatch.filter(filelist, '*.class'): class_name = class_path + os.path.splitext(class_file)[0] bin_file = os.path.normpath(os.path.join(path, class_file)) -@@ -1535,6 +1542,8 @@ +@@ -1535,6 +1546,8 @@ if not os.path.exists(outpathlk[side]): os.makedirs(outpathlk[side]) @@ -104,7 +115,7 @@ # HINT: We extract the modified class files with closing(zipfile.ZipFile(jarlk[side])) as zipjar: for in_class in trgclasses: -@@ -1548,6 +1557,23 @@ +@@ -1548,6 +1561,23 @@ out_class = out_class.replace(self.nullpkg, '') if out_class[0] == '/': out_class = out_class[1:] @@ -128,7 +139,7 @@ try: zipjar.extract(out_class, outpathlk[side]) self.logger.info('> Outputted %s to %s as %s', in_class.ljust(35), outpathlk[side], out_class) -@@ -1594,6 +1620,9 @@ +@@ -1594,6 +1624,9 @@ sys.exit(1) for entry in newfiles: @@ -138,7 +149,7 @@ if entry[3] == 'U': self.logger.info('Retrieving file from server : %s', entry[0]) cur_file = os.path.normpath(entry[0]) -@@ -1614,6 +1643,9 @@ +@@ -1614,6 +1647,9 @@ md5reoblk = {CLIENT: self.md5reobfclient, SERVER: self.md5reobfserver} outpathlk = {CLIENT: self.srcmodclient, SERVER: self.srcmodserver} src = {CLIENT: self.srcclient, SERVER: self.srcserver} @@ -148,7 +159,7 @@ # HINT: We need a table for the old md5 and the new ones md5table = {} -@@ -1656,3 +1688,6 @@ +@@ -1656,3 +1692,6 @@ except IOError: self.logger.error('* File %s copy failed', in_class) diff --git a/common/cpw/mods/fml/common/FMLCommonHandler.java b/common/cpw/mods/fml/common/FMLCommonHandler.java index eb13499af8..43e6715c7e 100644 --- a/common/cpw/mods/fml/common/FMLCommonHandler.java +++ b/common/cpw/mods/fml/common/FMLCommonHandler.java @@ -18,6 +18,7 @@ import java.util.List; import java.util.Map; import java.util.Properties; import java.util.Set; +import java.util.logging.Level; import java.util.logging.Logger; import net.minecraft.crash.CrashReport; @@ -92,10 +93,10 @@ public class FMLCommonHandler public void beginLoading(IFMLSidedHandler handler) { sidedDelegate = handler; - FMLLog.info("Attempting early MinecraftForge initialization"); + FMLLog.log("MinecraftForge", Level.INFO, "Attempting early MinecraftForge initialization"); callForgeMethod("initialize"); callForgeMethod("registerCrashCallable"); - FMLLog.info("Completed early MinecraftForge initialization"); + FMLLog.log("MinecraftForge", Level.INFO, "Completed early MinecraftForge initialization"); } public void rescheduleTicks(Side side) @@ -189,7 +190,7 @@ public class FMLCommonHandler */ public void raiseException(Throwable exception, String message, boolean stopGame) { - FMLCommonHandler.instance().getFMLLogger().throwing("FMLHandler", "raiseException", exception); + FMLLog.log(Level.SEVERE, exception, "Something raised an exception. The message was '%s'. 'stopGame' is %b", message, stopGame); if (stopGame) { getSidedDelegate().haltGame(message,exception); diff --git a/common/cpw/mods/fml/common/FMLDummyContainer.java b/common/cpw/mods/fml/common/FMLDummyContainer.java index 37edd2ce69..d9048d1e65 100644 --- a/common/cpw/mods/fml/common/FMLDummyContainer.java +++ b/common/cpw/mods/fml/common/FMLDummyContainer.java @@ -18,6 +18,7 @@ import java.security.cert.Certificate; import java.util.Arrays; import java.util.Map; import java.util.Set; +import java.util.logging.Level; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; @@ -96,12 +97,12 @@ public class FMLDummyContainer extends DummyModContainer implements WorldAccessC ModContainer container = Loader.instance().getIndexedModList().get(modId); if (container == null) { - FMLLog.severe("This world was saved with mod %s which appears to be missing, things may not work well", modId); + FMLLog.log("fml.ModTracker", Level.SEVERE, "This world was saved with mod %s which appears to be missing, things may not work well", modId); continue; } if (!modVersion.equals(container.getVersion())) { - FMLLog.info("This world was saved with mod %s version %s and it is now at version %s, things may not work well", modId, modVersion, container.getVersion()); + FMLLog.log("fml.ModTracker", Level.INFO, "This world was saved with mod %s version %s and it is now at version %s, things may not work well", modId, modVersion, container.getVersion()); } } } diff --git a/common/cpw/mods/fml/common/FMLLog.java b/common/cpw/mods/fml/common/FMLLog.java index f9e6d676df..cf8dba8c58 100644 --- a/common/cpw/mods/fml/common/FMLLog.java +++ b/common/cpw/mods/fml/common/FMLLog.java @@ -7,11 +7,21 @@ public class FMLLog { private static cpw.mods.fml.relauncher.FMLRelaunchLog coreLog = cpw.mods.fml.relauncher.FMLRelaunchLog.log; + public static void log(String logChannel, Level level, String format, Object... data) + { + coreLog.log(logChannel, level, format, data); + } + public static void log(Level level, String format, Object... data) { coreLog.log(level, format, data); } + public static void log(String logChannel, Level level, Throwable ex, String format, Object... data) + { + coreLog.log(logChannel, level, ex, format, data); + } + public static void log(Level level, Throwable ex, String format, Object... data) { coreLog.log(level, ex, format, data); @@ -50,4 +60,9 @@ public class FMLLog { return coreLog.getLogger(); } + + public static void makeLog(String logChannel) + { + coreLog.makeLog(logChannel); + } } diff --git a/common/cpw/mods/fml/common/FMLModContainer.java b/common/cpw/mods/fml/common/FMLModContainer.java index 252aea20c5..7fe9565c4d 100644 --- a/common/cpw/mods/fml/common/FMLModContainer.java +++ b/common/cpw/mods/fml/common/FMLModContainer.java @@ -164,15 +164,15 @@ public class FMLModContainer implements ModContainer modMetadata.requiredMods = requirements; modMetadata.dependencies = dependencies; modMetadata.dependants = dependants; - FMLLog.finest("Parsed dependency info : %s %s %s", requirements, dependencies, dependants); + FMLLog.log(getModId(), Level.FINEST, "Parsed dependency info : %s %s %s", requirements, dependencies, dependants); } else { - FMLLog.finest("Using mcmod dependency info : %s %s %s", modMetadata.requiredMods, modMetadata.dependencies, modMetadata.dependants); + FMLLog.log(getModId(), Level.FINEST, "Using mcmod dependency info : %s %s %s", modMetadata.requiredMods, modMetadata.dependencies, modMetadata.dependants); } if (Strings.isNullOrEmpty(modMetadata.name)) { - FMLLog.info("Mod %s is missing the required element 'name'. Substituting %s", getModId(), getModId()); + FMLLog.log(getModId(), Level.INFO,"Mod %s is missing the required element 'name'. Substituting %s", getModId(), getModId()); modMetadata.name = getModId(); } internalVersion = (String) descriptor.get("version"); @@ -182,18 +182,18 @@ public class FMLModContainer implements ModContainer if (versionProps != null) { internalVersion = versionProps.getProperty(getModId()+".version"); - FMLLog.fine("Found version %s for mod %s in version.properties, using", internalVersion, getModId()); + FMLLog.log(getModId(), Level.FINE, "Found version %s for mod %s in version.properties, using", internalVersion, getModId()); } } if (Strings.isNullOrEmpty(internalVersion) && !Strings.isNullOrEmpty(modMetadata.version)) { - FMLLog.warning("Mod %s is missing the required element 'version' and a version.properties file could not be found. Falling back to metadata version %s", getModId(), modMetadata.version); + FMLLog.log(getModId(), Level.WARNING, "Mod %s is missing the required element 'version' and a version.properties file could not be found. Falling back to metadata version %s", getModId(), modMetadata.version); internalVersion = modMetadata.version; } if (Strings.isNullOrEmpty(internalVersion)) { - FMLLog.warning("Mod %s is missing the required element 'version' and no fallback can be found. Substituting '1.0'.", getModId()); + FMLLog.log(getModId(), Level.WARNING, "Mod %s is missing the required element 'version' and no fallback can be found. Substituting '1.0'.", getModId()); modMetadata.version = internalVersion = "1.0"; } @@ -212,7 +212,7 @@ public class FMLModContainer implements ModContainer { try { - FMLLog.fine("Attempting to load the file version.properties from %s to locate a version number for %s", getSource().getName(), getModId()); + FMLLog.log(getModId(), Level.FINE,"Attempting to load the file version.properties from %s to locate a version number for %s", getSource().getName(), getModId()); Properties version = null; if (getSource().isFile()) { @@ -241,7 +241,7 @@ public class FMLModContainer implements ModContainer catch (Exception e) { Throwables.propagateIfPossible(e); - FMLLog.fine("Failed to find a usable version.properties file"); + FMLLog.log(getModId(), Level.FINEST, "Failed to find a usable version.properties file"); return null; } } @@ -293,7 +293,7 @@ public class FMLModContainer implements ModContainer { if (this.enabled) { - FMLLog.fine("Enabling mod %s", getModId()); + FMLLog.log(getModId(), Level.FINE, "Enabling mod %s", getModId()); this.eventBus = bus; this.controller = controller; eventBus.register(this); @@ -324,7 +324,7 @@ public class FMLModContainer implements ModContainer } else { - FMLLog.severe("The mod %s appears to have an invalid method annotation %s. This annotation can only apply to methods with argument types %s -it will not be called", getModId(), a.annotationType().getSimpleName(), Arrays.toString(paramTypes)); + FMLLog.log(getModId(), Level.SEVERE,"The mod %s appears to have an invalid method annotation %s. This annotation can only apply to methods with argument types %s -it will not be called", getModId(), a.annotationType().getSimpleName(), Arrays.toString(paramTypes)); } } } @@ -388,7 +388,7 @@ public class FMLModContainer implements ModContainer catch (Exception e) { Throwables.propagateIfPossible(e); - FMLLog.log(Level.WARNING, e, "Attempting to load @%s in class %s for %s and failing", annotationName, targets.getClassName(), mc.getModId()); + FMLLog.log(getModId(), Level.WARNING, e, "Attempting to load @%s in class %s for %s and failing", annotationName, targets.getClassName(), mc.getModId()); } } if (f != null) @@ -399,7 +399,7 @@ public class FMLModContainer implements ModContainer target = modInstance; if (!modInstance.getClass().equals(clz)) { - FMLLog.warning("Unable to inject @%s in non-static field %s.%s for %s as it is NOT the primary mod instance", annotationName, targets.getClassName(), targets.getObjectName(), mc.getModId()); + FMLLog.log(getModId(), Level.WARNING, "Unable to inject @%s in non-static field %s.%s for %s as it is NOT the primary mod instance", annotationName, targets.getClassName(), targets.getObjectName(), mc.getModId()); continue; } } @@ -445,7 +445,7 @@ public class FMLModContainer implements ModContainer { warnLevel = Level.FINER; } - FMLLog.log(warnLevel, "The mod %s is expecting signature %s for source %s, however there is no signature matching that description", getModId(), expectedFingerprint, source.getName()); + FMLLog.log(getModId(), warnLevel, "The mod %s is expecting signature %s for source %s, however there is no signature matching that description", getModId(), expectedFingerprint, source.getName()); } else { diff --git a/common/cpw/mods/fml/common/LoadController.java b/common/cpw/mods/fml/common/LoadController.java index 123e9962ac..191346caf4 100644 --- a/common/cpw/mods/fml/common/LoadController.java +++ b/common/cpw/mods/fml/common/LoadController.java @@ -95,19 +95,29 @@ public class LoadController StringBuilder sb = new StringBuilder(); printModStates(sb); FMLLog.getLogger().severe(sb.toString()); - FMLLog.severe("The following problems were captured during this phase"); - for (Entry error : errors.entries()) + if (errors.size()>0) { - FMLLog.log(Level.SEVERE, error.getValue(), "Caught exception from %s", error.getKey()); - if (error.getValue() instanceof IFMLHandledException) + FMLLog.severe("The following problems were captured during this phase"); + for (Entry error : errors.entries()) { - toThrow = error.getValue(); - } - else if (toThrow == null) - { - toThrow = error.getValue(); + FMLLog.log(Level.SEVERE, error.getValue(), "Caught exception from %s", error.getKey()); + if (error.getValue() instanceof IFMLHandledException) + { + toThrow = error.getValue(); + } + else if (toThrow == null) + { + toThrow = error.getValue(); + } } } + else + { + FMLLog.severe("The ForgeModLoader state engine has become corrupted. Probably, a state was missed by and invalid modification to a base class" + + "ForgeModLoader depends on. This is a critical error and not recoverable. Investigate any modifications to base classes outside of" + + "ForgeModLoader, especially Optifine, to see if there are fixes available."); + throw new RuntimeException("The ForgeModLoader state engine is invalid"); + } if (toThrow != null && toThrow instanceof RuntimeException) { throw (RuntimeException)toThrow; @@ -136,9 +146,9 @@ public class LoadController activeContainer = mc; String modId = mc.getModId(); stateEvent.applyModContainer(activeContainer()); - FMLLog.finer("Sending event %s to mod %s", stateEvent.getEventType(), modId); + FMLLog.log(modId, Level.FINEST, "Sending event %s to mod %s", stateEvent.getEventType(), modId); eventChannels.get(modId).post(stateEvent); - FMLLog.finer("Sent event %s to mod %s", stateEvent.getEventType(), modId); + FMLLog.log(modId, Level.FINEST, "Sent event %s to mod %s", stateEvent.getEventType(), modId); activeContainer = null; if (stateEvent instanceof FMLStateEvent) { diff --git a/common/cpw/mods/fml/common/Loader.java b/common/cpw/mods/fml/common/Loader.java index ba00126ee1..04f4e0d831 100644 --- a/common/cpw/mods/fml/common/Loader.java +++ b/common/cpw/mods/fml/common/Loader.java @@ -61,6 +61,7 @@ import cpw.mods.fml.common.toposort.ModSortingException; import cpw.mods.fml.common.toposort.TopologicalSort; import cpw.mods.fml.common.versioning.ArtifactVersion; import cpw.mods.fml.common.versioning.VersionParser; +import cpw.mods.fml.relauncher.FMLRelaunchLog; /** * The loader class performs the actual loading of the mod code from disk. @@ -142,6 +143,7 @@ public class Loader private static File minecraftDir; private static List injectedContainers; + private File loggingProperties; public static Loader instance() { @@ -186,7 +188,7 @@ public class Loader */ private void sortModList() { - FMLLog.fine("Verifying mod requirements are satisfied"); + FMLLog.finer("Verifying mod requirements are satisfied"); try { BiMap modVersions = HashBiMap.create(); @@ -238,13 +240,13 @@ public class Loader } } - FMLLog.fine("All mod requirements are satisfied"); + FMLLog.finer("All mod requirements are satisfied"); ModSorter sorter = new ModSorter(getActiveModList(), namedMods); try { - FMLLog.fine("Sorting mods into an ordered list"); + FMLLog.finer("Sorting mods into an ordered list"); List sortedMods = sorter.sort(); // Reset active list to the sorted list modController.getActiveModList().clear(); @@ -253,7 +255,7 @@ public class Loader mods.removeAll(sortedMods); sortedMods.addAll(mods); mods = sortedMods; - FMLLog.fine("Mod sorting completed successfully"); + FMLLog.finer("Mod sorting completed successfully"); } catch (ModSortingException sortException) { @@ -266,17 +268,19 @@ public class Loader } finally { - FMLLog.fine("Mod sorting data:"); + FMLLog.fine("Mod sorting data"); + int unprintedMods = mods.size(); for (ModContainer mod : getActiveModList()) { if (!mod.isImmutable()) { FMLLog.fine("\t%s(%s:%s): %s (%s)", mod.getModId(), mod.getName(), mod.getVersion(), mod.getSource().getName(), mod.getSortingRules()); + unprintedMods--; } } - if (mods.size()==0) + if (unprintedMods == mods.size()) { - FMLLog.fine("No mods found to sort"); + FMLLog.fine("No user mods found to sort"); } } @@ -335,6 +339,10 @@ public class Loader identifyDuplicates(mods); namedMods = Maps.uniqueIndex(mods, new ModIdFunction()); FMLLog.info("Forge Mod Loader has identified %d mod%s to load", mods.size(), mods.size() != 1 ? "s" : ""); + for (String modId: namedMods.keySet()) + { + FMLLog.makeLog(modId); + } return discoverer; } @@ -435,6 +443,11 @@ public class Loader FMLLog.severe("Attempting to load configuration from %s, which is not a directory", canonicalConfigPath); throw new LoaderException(); } + + loggingProperties = new File(canonicalConfigDir, "logging.properties"); + FMLLog.info("Reading custom logging properties from %s", loggingProperties.getPath()); + FMLRelaunchLog.loadLogConfiguration(loggingProperties); + FMLLog.log(Level.OFF,"Logging level for ForgeModLoader logging is set to %s", FMLRelaunchLog.log.getLogger().getLevel()); } public List getModList() @@ -456,6 +469,9 @@ public class Loader modController.transition(LoaderState.LOADING); ModDiscoverer disc = identifyMods(); disableRequestedMods(); + FMLLog.fine("Reloading logging properties from %s", loggingProperties.getPath()); + FMLRelaunchLog.loadLogConfiguration(loggingProperties); + FMLLog.fine("Reloaded logging properties"); modController.distributeStateMessage(FMLLoadEvent.class); sortModList(); mods = ImmutableList.copyOf(mods); @@ -476,7 +492,7 @@ public class Loader } modController.transition(LoaderState.CONSTRUCTING); modController.distributeStateMessage(LoaderState.CONSTRUCTING, modClassLoader, disc.getASMTable()); - FMLLog.fine("Mod signature data:"); + FMLLog.fine("Mod signature data"); for (ModContainer mod : getActiveModList()) { FMLLog.fine("\t%s(%s:%s): %s (%s)", mod.getModId(), mod.getName(), mod.getVersion(), mod.getSource().getName(), CertificateHelper.getFingerprint(mod.getSigningCertificate())); @@ -489,22 +505,22 @@ public class Loader private void disableRequestedMods() { String forcedModList = System.getProperty("fml.modStates", ""); - FMLLog.fine("Received a system property request \'%s\'",forcedModList); + FMLLog.finer("Received a system property request \'%s\'",forcedModList); Map sysPropertyStateList = Splitter.on(CharMatcher.anyOf(";:")) .omitEmptyStrings().trimResults().withKeyValueSeparator("=") .split(forcedModList); - FMLLog.fine("System property request managing the state of %d mods", sysPropertyStateList.size()); + FMLLog.finer("System property request managing the state of %d mods", sysPropertyStateList.size()); Map modStates = Maps.newHashMap(); File forcedModFile = new File(canonicalConfigDir, "fmlModState.properties"); Properties forcedModListProperties = new Properties(); if (forcedModFile.exists() && forcedModFile.isFile()) { - FMLLog.fine("Found a mod state file %s", forcedModFile.getName()); + FMLLog.finer("Found a mod state file %s", forcedModFile.getName()); try { forcedModListProperties.load(new FileReader(forcedModFile)); - FMLLog.fine("Loaded states for %d mods from file", forcedModListProperties.size()); + FMLLog.finer("Loaded states for %d mods from file", forcedModListProperties.size()); } catch (Exception e) { diff --git a/common/cpw/mods/fml/common/ModClassLoader.java b/common/cpw/mods/fml/common/ModClassLoader.java index b5d8bf4ceb..2b69592ebd 100644 --- a/common/cpw/mods/fml/common/ModClassLoader.java +++ b/common/cpw/mods/fml/common/ModClassLoader.java @@ -70,7 +70,7 @@ public class ModClassLoader extends URLClassLoader } catch (URISyntaxException e) { - FMLLog.log(Level.SEVERE, "Unable to process our input to locate the minecraft code", e); + FMLLog.log(Level.SEVERE, e, "Unable to process our input to locate the minecraft code"); throw new LoaderException(e); } } diff --git a/common/cpw/mods/fml/common/discovery/ModDiscoverer.java b/common/cpw/mods/fml/common/discovery/ModDiscoverer.java index 411eb8a9a9..991d48e5f2 100644 --- a/common/cpw/mods/fml/common/discovery/ModDiscoverer.java +++ b/common/cpw/mods/fml/common/discovery/ModDiscoverer.java @@ -44,7 +44,7 @@ public class ModDiscoverer { if (knownLibraries.contains(minecraftSources[i].getName())) { - FMLLog.fine("Skipping known library file %s", minecraftSources[i].getAbsolutePath()); + FMLLog.finer("Skipping known library file %s", minecraftSources[i].getAbsolutePath()); } else { diff --git a/common/cpw/mods/fml/common/event/FMLPreInitializationEvent.java b/common/cpw/mods/fml/common/event/FMLPreInitializationEvent.java index 4bd09b866c..a0dbfab3ca 100644 --- a/common/cpw/mods/fml/common/event/FMLPreInitializationEvent.java +++ b/common/cpw/mods/fml/common/event/FMLPreInitializationEvent.java @@ -81,6 +81,8 @@ public class FMLPreInitializationEvent extends FMLStateEvent /** * Get a logger instance configured to write to the FML Log as a parent, identified by modid. Handy for mod logging! + * Configurations can be applied through the config/logging.properties file, specifying logging levels + * for your ModID. Use this! * * @return A logger */ diff --git a/common/cpw/mods/fml/common/registry/GameData.java b/common/cpw/mods/fml/common/registry/GameData.java index 3929d37874..5514765225 100644 --- a/common/cpw/mods/fml/common/registry/GameData.java +++ b/common/cpw/mods/fml/common/registry/GameData.java @@ -50,13 +50,13 @@ public class GameData { ignoredMods = Maps.fromProperties(p); if (ignoredMods.size()>0) { - FMLLog.warning("Using non-empty ignored mods configuration file %s", ignoredMods.keySet()); + FMLLog.log("fml.ItemTracker", Level.WARNING, "Using non-empty ignored mods configuration file %s", ignoredMods.keySet()); } } catch (Exception e) { Throwables.propagateIfPossible(e); - FMLLog.log(Level.SEVERE, e, "Failed to read ignored ID checker mods properties file"); + FMLLog.log("fml.ItemTracker", Level.SEVERE, e, "Failed to read ignored ID checker mods properties file"); ignoredMods = ImmutableMap.of(); } } @@ -84,12 +84,12 @@ public class GameData { if (idMap.containsKey(item.field_77779_bT)) { ItemData id = idMap.get(item.field_77779_bT); - FMLLog.info("[ItemTracker] The mod %s is overwriting existing item at %d (%s from %s) with %s", mc.getModId(), id.getItemId(), id.getItemType(), id.getModId(), itemType); + FMLLog.log("fml.ItemTracker", Level.INFO, "The mod %s is overwriting existing item at %d (%s from %s) with %s", mc.getModId(), id.getItemId(), id.getItemType(), id.getModId(), itemType); } idMap.put(item.field_77779_bT, itemData); if (!"Minecraft".equals(mc.getModId())) { - FMLLog.fine("[ItemTracker] Adding item %s(%d) owned by %s", item.getClass().getName(), item.field_77779_bT, mc.getModId()); + FMLLog.log("fml.ItemTracker",Level.FINE, "Adding item %s(%d) owned by %s", item.getClass().getName(), item.field_77779_bT, mc.getModId()); } } @@ -119,12 +119,12 @@ public class GameData { Map worldMap = Maps.uniqueIndex(worldSaveItems,idMapFunction); difference = Maps.difference(worldMap, idMap); - FMLLog.fine("The difference set is %s", difference); + FMLLog.log("fml.ItemTracker", Level.FINE, "The difference set is %s", difference); if (!difference.entriesDiffering().isEmpty() || !difference.entriesOnlyOnLeft().isEmpty()) { - FMLLog.severe("FML has detected item discrepancies"); - FMLLog.severe("Missing items : %s", difference.entriesOnlyOnLeft()); - FMLLog.severe("Mismatched items : %s", difference.entriesDiffering()); + FMLLog.log("fml.ItemTracker", Level.SEVERE, "FML has detected item discrepancies"); + FMLLog.log("fml.ItemTracker", Level.SEVERE, "Missing items : %s", difference.entriesOnlyOnLeft()); + FMLLog.log("fml.ItemTracker", Level.SEVERE, "Mismatched items : %s", difference.entriesDiffering()); boolean foundNonIgnored = false; for (ItemData diff : difference.entriesOnlyOnLeft().values()) { @@ -142,7 +142,7 @@ public class GameData { } if (!foundNonIgnored) { - FMLLog.severe("FML is ignoring these ID discrepancies because of configuration. YOUR GAME WILL NOW PROBABLY CRASH. HOPEFULLY YOU WON'T HAVE CORRUPTED YOUR WORLD. BLAME %s", ignoredMods.keySet()); + FMLLog.log("fml.ItemTracker", Level.SEVERE, "FML is ignoring these ID discrepancies because of configuration. YOUR GAME WILL NOW PROBABLY CRASH. HOPEFULLY YOU WON'T HAVE CORRUPTED YOUR WORLD. BLAME %s", ignoredMods.keySet()); } isSaveValid = !foundNonIgnored; serverValidationLatch.countDown(); diff --git a/common/cpw/mods/fml/common/registry/LanguageRegistry.java b/common/cpw/mods/fml/common/registry/LanguageRegistry.java index ba1270e50b..1de27d199f 100644 --- a/common/cpw/mods/fml/common/registry/LanguageRegistry.java +++ b/common/cpw/mods/fml/common/registry/LanguageRegistry.java @@ -7,6 +7,7 @@ import java.net.URL; import java.util.HashMap; import java.util.Map; import java.util.Properties; +import java.util.logging.Level; import com.google.common.base.Charsets; @@ -142,8 +143,7 @@ public class LanguageRegistry addStringLocalization(langPack, lang); } catch (IOException e) { - FMLLog.getLogger().severe("Unable to load localization from file: " + localizationFile); - e.printStackTrace(); + FMLLog.log(Level.SEVERE, e, "Unable to load localization from file %s", localizationFile); } finally { try { @@ -152,7 +152,7 @@ public class LanguageRegistry } } catch (IOException ex) { - ex.printStackTrace(); + // HUSH } } } diff --git a/common/cpw/mods/fml/relauncher/FMLRelaunchLog.java b/common/cpw/mods/fml/relauncher/FMLRelaunchLog.java index 17529820fc..88d85830cf 100644 --- a/common/cpw/mods/fml/relauncher/FMLRelaunchLog.java +++ b/common/cpw/mods/fml/relauncher/FMLRelaunchLog.java @@ -2,6 +2,8 @@ package cpw.mods.fml.relauncher; import java.io.ByteArrayOutputStream; import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.io.IOException; import java.io.PrintStream; import java.util.concurrent.Executors; @@ -112,7 +114,7 @@ public class FMLRelaunchLog } /** * Our special logger for logging issues to. We copy various assets from the - * Minecraft logger to acheive a similar appearance. + * Minecraft logger to achieve a similar appearance. */ public static FMLRelaunchLog log = new FMLRelaunchLog(); @@ -124,6 +126,10 @@ public class FMLRelaunchLog private static PrintStream errCache; private Logger myLog; + private static FileHandler fileHandler; + + private static FMLLogFormatter formatter; + private FMLRelaunchLog() { } @@ -142,37 +148,66 @@ public class FMLRelaunchLog stdOut.setParent(log.myLog); Logger stdErr = Logger.getLogger("STDERR"); stdErr.setParent(log.myLog); - FMLLogFormatter formatter = new FMLLogFormatter(); - - // Console handler captures the normal stderr before it gets replaced + log.myLog.setLevel(Level.ALL); log.myLog.setUseParentHandlers(false); - log.myLog.addHandler(new ConsoleLogWrapper()); consoleLogThread = new Thread(new ConsoleLogThread()); consoleLogThread.start(); - ConsoleLogThread.wrappedHandler.setLevel(Level.parse(System.getProperty("fml.log.level","INFO"))); - ConsoleLogThread.wrappedHandler.setFormatter(formatter); - log.myLog.setLevel(Level.ALL); + formatter = new FMLLogFormatter(); try { File logPath = new File(minecraftHome, FMLRelauncher.logFileNamePattern); - FileHandler fileHandler = new FileHandler(logPath.getPath(), 0, 3); - fileHandler.setFormatter(formatter); - fileHandler.setLevel(Level.ALL); - log.myLog.addHandler(fileHandler); + fileHandler = new FileHandler(logPath.getPath(), 0, 3) + { + public synchronized void close() throws SecurityException { + // We don't want this handler to reset + } + }; } catch (Exception e) { } + resetLoggingHandlers(); + // Set system out to a log stream errCache = System.err; System.setOut(new PrintStream(new LoggingOutStream(stdOut), true)); System.setErr(new PrintStream(new LoggingOutStream(stdErr), true)); - // Reset global logging to shut up other logging sources (thanks guava!) configured = true; } + private static void resetLoggingHandlers() + { + ConsoleLogThread.wrappedHandler.setLevel(Level.parse(System.getProperty("fml.log.level","INFO"))); + // Console handler captures the normal stderr before it gets replaced + log.myLog.addHandler(new ConsoleLogWrapper()); + ConsoleLogThread.wrappedHandler.setFormatter(formatter); + fileHandler.setLevel(Level.ALL); + fileHandler.setFormatter(formatter); + log.myLog.addHandler(fileHandler); + } + + public static void loadLogConfiguration(File logConfigFile) + { + if (logConfigFile!=null && logConfigFile.exists() && logConfigFile.canRead()) + { + try + { + LogManager.getLogManager().readConfiguration(new FileInputStream(logConfigFile)); + resetLoggingHandlers(); + } + catch (Exception e) + { + log(Level.SEVERE, e, "Error reading logging configuration file %s", logConfigFile.getName()); + } + } + } + public static void log(String logChannel, Level level, String format, Object... data) + { + makeLog(logChannel); + Logger.getLogger(logChannel).log(level, String.format(format, data)); + } public static void log(Level level, String format, Object... data) { @@ -183,6 +218,12 @@ public class FMLRelaunchLog log.myLog.log(level, String.format(format, data)); } + public static void log(String logChannel, Level level, Throwable ex, String format, Object... data) + { + makeLog(logChannel); + Logger.getLogger(logChannel).log(level, String.format(format, data), ex); + } + public static void log(Level level, Throwable ex, String format, Object... data) { if (!configured) @@ -225,4 +266,9 @@ public class FMLRelaunchLog { return myLog; } + public static void makeLog(String logChannel) + { + Logger l = Logger.getLogger(logChannel); + l.setParent(log.myLog); + } } From 9fafdc1695b8ca93c5b24a35ee535a5f76014703 Mon Sep 17 00:00:00 2001 From: Christian Date: Wed, 30 Jan 2013 20:55:12 -0500 Subject: [PATCH 2/6] More logging tweaks. You can probably configure individual mod log files if you wish now --- common/cpw/mods/fml/common/LoadController.java | 7 +++++-- common/cpw/mods/fml/common/Loader.java | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/common/cpw/mods/fml/common/LoadController.java b/common/cpw/mods/fml/common/LoadController.java index 191346caf4..c9f1cb9ce5 100644 --- a/common/cpw/mods/fml/common/LoadController.java +++ b/common/cpw/mods/fml/common/LoadController.java @@ -5,6 +5,7 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.logging.Level; +import java.util.logging.Logger; import com.google.common.base.Joiner; import com.google.common.collect.ArrayListMultimap; @@ -60,14 +61,16 @@ public class LoadController boolean isActive = mod.registerBus(bus, this); if (isActive) { - FMLLog.fine("Activating mod %s", mod.getModId()); + Level level = Logger.getLogger(mod.getModId()).getLevel(); + FMLLog.log(mod.getModId(), Level.FINE, "Mod Logging channel %s configured at %s level.", level == null ? "default" : level); + FMLLog.log(mod.getModId(), Level.INFO, "Activating mod %s", mod.getModId()); activeModList.add(mod); modStates.put(mod.getModId(), ModState.UNLOADED); eventBus.put(mod.getModId(), bus); } else { - FMLLog.warning("Mod %s has been disabled through configuration", mod.getModId()); + FMLLog.log(mod.getModId(), Level.WARNING, "Mod %s has been disabled through configuration", mod.getModId()); modStates.put(mod.getModId(), ModState.UNLOADED); modStates.put(mod.getModId(), ModState.DISABLED); } diff --git a/common/cpw/mods/fml/common/Loader.java b/common/cpw/mods/fml/common/Loader.java index 04f4e0d831..a48a775443 100644 --- a/common/cpw/mods/fml/common/Loader.java +++ b/common/cpw/mods/fml/common/Loader.java @@ -497,6 +497,10 @@ public class Loader { FMLLog.fine("\t%s(%s:%s): %s (%s)", mod.getModId(), mod.getName(), mod.getVersion(), mod.getSource().getName(), CertificateHelper.getFingerprint(mod.getSigningCertificate())); } + if (getActiveModList().isEmpty()) + { + FMLLog.fine("No user mod signature data found"); + } modController.transition(LoaderState.PREINITIALIZATION); modController.distributeStateMessage(LoaderState.PREINITIALIZATION, disc.getASMTable(), canonicalConfigDir); modController.transition(LoaderState.INITIALIZATION); From 549b6fd535de9390f964d12fcdf58ddcbf406be7 Mon Sep 17 00:00:00 2001 From: Christian Date: Thu, 31 Jan 2013 13:39:53 -0500 Subject: [PATCH 3/6] 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/common/cpw/mods/fml/common/event/FMLInterModComms.java b/common/cpw/mods/fml/common/event/FMLInterModComms.java index a2d7e02f96..31f9f1131c 100644 --- a/common/cpw/mods/fml/common/event/FMLInterModComms.java +++ b/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 { From 22dbe411d9178de73c3fe56a597cf6a78e6daffd Mon Sep 17 00:00:00 2001 From: Christian Date: Mon, 4 Feb 2013 10:58:48 -0500 Subject: [PATCH 4/6] Fix up mistake that broke all modloading. Nice. --- common/cpw/mods/fml/common/LoadController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/cpw/mods/fml/common/LoadController.java b/common/cpw/mods/fml/common/LoadController.java index c9f1cb9ce5..6a8d5bab51 100644 --- a/common/cpw/mods/fml/common/LoadController.java +++ b/common/cpw/mods/fml/common/LoadController.java @@ -62,7 +62,7 @@ public class LoadController if (isActive) { Level level = Logger.getLogger(mod.getModId()).getLevel(); - FMLLog.log(mod.getModId(), Level.FINE, "Mod Logging channel %s configured at %s level.", level == null ? "default" : level); + FMLLog.log(mod.getModId(), Level.FINE, "Mod Logging channel %s configured at %s level.", mod.getModId(), level == null ? "default" : level); FMLLog.log(mod.getModId(), Level.INFO, "Activating mod %s", mod.getModId()); activeModList.add(mod); modStates.put(mod.getModId(), ModState.UNLOADED); From cd96718339e2c6e494600828c0c2938b1cc1df64 Mon Sep 17 00:00:00 2001 From: Christian Date: Wed, 6 Feb 2013 01:25:46 -0500 Subject: [PATCH 5/6] Fix HD mob skins, FINALLY!!! Stupid eyes are stupid. --- .../cpw/mods/fml/client/TextureFXManager.java | 15 +++++++++++++ .../client/renderer/RenderEngine.java.patch | 21 ++++++++++++++----- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/client/cpw/mods/fml/client/TextureFXManager.java b/client/cpw/mods/fml/client/TextureFXManager.java index fe1fe5575f..aee69376d1 100644 --- a/client/cpw/mods/fml/client/TextureFXManager.java +++ b/client/cpw/mods/fml/client/TextureFXManager.java @@ -317,4 +317,19 @@ public class TextureFXManager return INSTANCE; } + public void fixTransparency(BufferedImage loadedImage, String textureName) + { + if (textureName.matches("^/mob/.*_eyes.*.png$")) + { + for (int x = 0; x < loadedImage.getWidth(); x++) { + for (int y = 0; y < loadedImage.getHeight(); y++) { + int argb = loadedImage.getRGB(x, y); + if ((argb & 0xff000000) == 0 && argb != 0) { + loadedImage.setRGB(x, y, 0); + } + } + } + } + } + } diff --git a/patches/minecraft/net/minecraft/client/renderer/RenderEngine.java.patch b/patches/minecraft/net/minecraft/client/renderer/RenderEngine.java.patch index 47203a4115..569f9c8fd0 100644 --- a/patches/minecraft/net/minecraft/client/renderer/RenderEngine.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/RenderEngine.java.patch @@ -43,7 +43,18 @@ var6.printStackTrace(); int[] var5 = this.func_78348_b(this.field_78364_l); this.field_78359_d.put(p_78346_1_, var5); -@@ -250,6 +259,7 @@ +@@ -181,7 +190,9 @@ + } + else + { +- this.func_78351_a(this.func_78345_a(var7), var3); ++ BufferedImage loadedImage = this.func_78345_a(var7); ++ TextureFXManager.instance().fixTransparency(loadedImage, p_78341_1_); ++ this.func_78351_a(loadedImage, var3); + } + } + +@@ -250,6 +261,7 @@ int var3 = p_78351_1_.getWidth(); int var4 = p_78351_1_.getHeight(); @@ -51,7 +62,7 @@ int[] var5 = new int[var3 * var4]; byte[] var6 = new byte[var3 * var4 * 4]; p_78351_1_.getRGB(0, 0, var3, var4, var5, 0, var3); -@@ -410,6 +420,7 @@ +@@ -410,6 +422,7 @@ public void func_78355_a(TextureFX p_78355_1_) { @@ -59,7 +70,7 @@ this.field_78367_h.add(p_78355_1_); p_78355_1_.func_76846_a(); } -@@ -422,28 +433,44 @@ +@@ -422,28 +435,44 @@ { TextureFX var3 = (TextureFX)this.field_78367_h.get(var2); var3.field_76851_c = this.field_78365_j.field_74337_g; @@ -113,7 +124,7 @@ } } -@@ -509,8 +536,9 @@ +@@ -509,8 +538,9 @@ this.field_78361_b = false; this.field_78363_a = false; } @@ -125,7 +136,7 @@ var7.printStackTrace(); } } -@@ -546,8 +574,9 @@ +@@ -546,8 +576,9 @@ this.field_78361_b = false; this.field_78363_a = false; } From 1c3dc132cbd1dc445f058e37dac7c31150ce6fb3 Mon Sep 17 00:00:00 2001 From: LexManos Date: Fri, 8 Feb 2013 14:50:17 -0800 Subject: [PATCH 6/6] Option to disable renaming for srgnames. --- install/fml.py | 7 ++++--- install/install.py | 9 ++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/install/fml.py b/install/fml.py index 419beea7ea..a75d2ca5a1 100644 --- a/install/fml.py +++ b/install/fml.py @@ -429,15 +429,16 @@ def apply_fml_patches(fml_dir, mcp_dir, src_dir, copy_files=True): if os.path.isdir(os.path.join(src_dir, 'minecraft', 'argo')): shutil.rmtree(os.path.join(src_dir, 'minecraft', 'argo')) -def finish_setup_fml(fml_dir, mcp_dir, enable_server=False, disable_client=False): +def finish_setup_fml(fml_dir, mcp_dir, enable_server=False, disable_client=False, disable_rename=False): sys.path.append(mcp_dir) from runtime.updatenames import updatenames from runtime.updatemd5 import updatemd5 from runtime.updatemcp import updatemcp os.chdir(mcp_dir) - updatenames(None, True, not disable_client, enable_server) - reset_logger() + if not disable_rename: + updatenames(None, True, not disable_client, enable_server) + reset_logger() updatemd5(None, True, not disable_client, enable_server) reset_logger() os.chdir(fml_dir) diff --git a/install/install.py b/install/install.py index 97dec17703..6de130e0e1 100644 --- a/install/install.py +++ b/install/install.py @@ -3,7 +3,8 @@ from optparse import OptionParser from fml import setup_fml, finish_setup_fml, apply_fml_patches, setup_mcp -def fml_main(fml_dir, mcp_dir, dont_gen_conf=True, disable_patches=False, disable_at=False, disable_merge=False, enable_server=False, disable_client=False): +def fml_main(fml_dir, mcp_dir, dont_gen_conf=True, disable_patches=False, disable_at=False, disable_merge=False, enable_server=False, disable_client=False, + disable_rename=False): print '================ Forge ModLoader Setup Start ===================' setup_mcp(fml_dir, mcp_dir, dont_gen_conf) setup_fml(fml_dir, mcp_dir, disable_at=disable_at, disable_merge=disable_merge, enable_server=enable_server, disable_client=disable_client) @@ -11,7 +12,7 @@ def fml_main(fml_dir, mcp_dir, dont_gen_conf=True, disable_patches=False, disabl print 'Patching disabled' else: apply_fml_patches(fml_dir, mcp_dir, os.path.join(mcp_dir, 'src')) - finish_setup_fml(fml_dir, mcp_dir, enable_server=enable_server, disable_client=disable_client) + finish_setup_fml(fml_dir, mcp_dir, enable_server=enable_server, disable_client=disable_client, disable_rename=disable_rename) print '================ Forge ModLoader Setup End ===================' if __name__ == '__main__': @@ -22,6 +23,7 @@ if __name__ == '__main__': parser.add_option('-s', '--server', action="store_true", dest='enable_server', help='Enable decompilation of server', default=False) parser.add_option('-c', '--no-client', action="store_true", dest='no_client', help='Disable decompilation of server', default=False) parser.add_option('-e', '--no-merge', action="store_true", dest='no_merge', help='Disable merging server code into client', default=False) + parser.add_option('-n', '--no-rename', action="store_true", dest='no_rename', help='Disable running updatenames', default=False) options, _ = parser.parse_args() fml_dir = os.path.dirname(os.path.abspath(__file__)) @@ -40,4 +42,5 @@ if __name__ == '__main__': fml_main(fml_dir, mcp_dir, disable_patches=options.no_patch, disable_at=options.no_access, disable_merge=options.no_merge, - enable_server=options.enable_server, disable_client=options.no_client) \ No newline at end of file + enable_server=options.enable_server, disable_client=options.no_client, + disable_rename=options.no_rename) \ No newline at end of file