Enhanced Chunk Logger to dump out stack trace data via config option.

This commit is contained in:
AlgorithmX2
2014-08-22 19:23:48 -05:00
parent 47eb2c36f3
commit 75bfcd9018
2 changed files with 24 additions and 1 deletions
+21
View File
@@ -5,7 +5,9 @@ import net.minecraft.server.MinecraftServer;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.ChunkEvent;
import appeng.core.AEConfig;
import appeng.core.AELog;
import appeng.core.features.AEFeature;
import appeng.server.ISubCommand;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
@@ -20,6 +22,24 @@ public class ChunkLogger implements ISubCommand
if ( !load.world.isRemote )
{
AELog.info( "Chunk Loaded: " + load.getChunk().xPosition + ", " + load.getChunk().zPosition );
displayStack();
}
}
private void displayStack()
{
if ( AEConfig.instance.isFeatureEnabled( AEFeature.ChunkLoggerTrace ) )
{
boolean output = false;
for (StackTraceElement e : Thread.currentThread().getStackTrace())
{
if ( output )
AELog.info( " " + e.getClassName() + "." + e.getMethodName() + " (" + e.getLineNumber() + ")" );
else
{
output = e.getClassName().contains( "EventBus" ) && e.getMethodName().contains( "post" );
}
}
}
}
@@ -29,6 +49,7 @@ public class ChunkLogger implements ISubCommand
if ( !unload.world.isRemote )
{
AELog.info( "Chunk Unloaded: " + unload.getChunk().xPosition + ", " + unload.getChunk().zPosition );
displayStack();
}
}