Merge branch 'master' into runtimedeobf

This commit is contained in:
Christian 2013-02-16 14:28:29 -05:00
commit 047de02402
21 changed files with 262 additions and 114 deletions

View File

@ -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;

View File

@ -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
@ -316,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);
}
}
}
}
}
}

View File

@ -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<Class<? extends Entity>, 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<Class<? extends Entity>, Render> difference = Maps.difference(RenderManager.field_78727_a.field_78729_o, renderers, Equivalences.identity());
for ( Entry<Class<? extends Entity>, 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<Class<? extends Entity>, 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<Class<? extends Entity>, ValueDifference<Render>> 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());
}
}

View File

@ -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)

View File

@ -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)

View File

@ -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);

View File

@ -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());
}
}
}

View File

@ -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);
}
}

View File

@ -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
{

View File

@ -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.", 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);
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);
}
@ -95,19 +98,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<String, Throwable> 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<String, Throwable> 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 +149,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)
{

View File

@ -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<String> 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<String, ArtifactVersion> 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<ModContainer> 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<ModContainer> 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,11 +492,15 @@ 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()));
}
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);
@ -489,22 +509,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<String, String> 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<String, String> 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)
{

View File

@ -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);
}
}

View File

@ -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
{

View File

@ -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<IMCMessage> currentList;
public ImmutableList<IMCMessage> 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
{

View File

@ -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 <code>config/logging.properties</code> file, specifying logging levels
* for your ModID. Use this!
*
* @return A logger
*/

View File

@ -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.<String, String>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<Integer,ItemData> 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();

View File

@ -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
}
}
}

View File

@ -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);
}
}

View File

@ -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)

View File

@ -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)
enable_server=options.enable_server, disable_client=options.no_client,
disable_rename=options.no_rename)

View File

@ -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;
}