Split logic of crash enhancement
This commit is contained in:
@@ -37,8 +37,9 @@ import cpw.mods.fml.common.network.NetworkRegistry;
|
|||||||
|
|
||||||
import com.google.common.base.Stopwatch;
|
import com.google.common.base.Stopwatch;
|
||||||
|
|
||||||
import appeng.core.crash.CrashEnhancement;
|
|
||||||
import appeng.core.crash.CrashInfo;
|
import appeng.core.crash.CrashInfo;
|
||||||
|
import appeng.core.crash.IntegrationCrashEnhancement;
|
||||||
|
import appeng.core.crash.ModCrashEnhancement;
|
||||||
import appeng.core.features.AEFeature;
|
import appeng.core.features.AEFeature;
|
||||||
import appeng.core.sync.GuiBridge;
|
import appeng.core.sync.GuiBridge;
|
||||||
import appeng.core.sync.network.NetworkHandler;
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
@@ -79,7 +80,7 @@ public class AppEng
|
|||||||
|
|
||||||
this.imcHandler = new IMCHandler();
|
this.imcHandler = new IMCHandler();
|
||||||
|
|
||||||
FMLCommonHandler.instance().registerCrashCallable( new CrashEnhancement( CrashInfo.MOD_VERSION ) );
|
FMLCommonHandler.instance().registerCrashCallable( new ModCrashEnhancement( CrashInfo.MOD_VERSION ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public final File getConfigDirectory()
|
public final File getConfigDirectory()
|
||||||
@@ -167,7 +168,7 @@ public class AppEng
|
|||||||
|
|
||||||
Registration.INSTANCE.postInit( event );
|
Registration.INSTANCE.postInit( event );
|
||||||
IntegrationRegistry.INSTANCE.postInit();
|
IntegrationRegistry.INSTANCE.postInit();
|
||||||
FMLCommonHandler.instance().registerCrashCallable( new CrashEnhancement( CrashInfo.INTEGRATION ) );
|
FMLCommonHandler.instance().registerCrashCallable( new IntegrationCrashEnhancement() );
|
||||||
|
|
||||||
CommonHelper.proxy.postInit();
|
CommonHelper.proxy.postInit();
|
||||||
AEConfig.instance.save();
|
AEConfig.instance.save();
|
||||||
|
|||||||
+6
-31
@@ -21,52 +21,27 @@ package appeng.core.crash;
|
|||||||
|
|
||||||
import cpw.mods.fml.common.ICrashCallable;
|
import cpw.mods.fml.common.ICrashCallable;
|
||||||
|
|
||||||
import appeng.core.AEConfig;
|
|
||||||
import appeng.integration.IntegrationRegistry;
|
|
||||||
|
|
||||||
|
abstract class BaseCrashEnhancement implements ICrashCallable
|
||||||
public class CrashEnhancement implements ICrashCallable
|
|
||||||
{
|
{
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
private final String value;
|
private final String value;
|
||||||
|
|
||||||
private final String ModVersion = AEConfig.CHANNEL + ' ' + AEConfig.VERSION + " for Forge " + // WHAT?
|
public BaseCrashEnhancement( String name, String value )
|
||||||
net.minecraftforge.common.ForgeVersion.majorVersion + '.' // majorVersion
|
|
||||||
+ net.minecraftforge.common.ForgeVersion.minorVersion + '.' // minorVersion
|
|
||||||
+ net.minecraftforge.common.ForgeVersion.revisionVersion + '.' // revisionVersion
|
|
||||||
+ net.minecraftforge.common.ForgeVersion.buildVersion;
|
|
||||||
|
|
||||||
public CrashEnhancement( CrashInfo Output )
|
|
||||||
{
|
{
|
||||||
|
this.name = name;
|
||||||
if ( Output == CrashInfo.MOD_VERSION )
|
this.value = value;
|
||||||
{
|
|
||||||
this.name = "AE2 Version";
|
|
||||||
this.value = this.ModVersion;
|
|
||||||
}
|
|
||||||
else if ( Output == CrashInfo.INTEGRATION )
|
|
||||||
{
|
|
||||||
this.name = "AE2 Integration";
|
|
||||||
this.value = IntegrationRegistry.INSTANCE.getStatus();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.name = "AE2_UNKNOWN";
|
|
||||||
this.value = "UNKNOWN_VALUE";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String call() throws Exception
|
public final String call() throws Exception
|
||||||
{
|
{
|
||||||
return this.value;
|
return this.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getLabel()
|
public final String getLabel()
|
||||||
{
|
{
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package appeng.core.crash;
|
||||||
|
|
||||||
|
|
||||||
|
import appeng.integration.IntegrationRegistry;
|
||||||
|
|
||||||
|
|
||||||
|
public class IntegrationCrashEnhancement extends BaseCrashEnhancement
|
||||||
|
{
|
||||||
|
public IntegrationCrashEnhancement()
|
||||||
|
{
|
||||||
|
super( "AE2 Integration", IntegrationRegistry.INSTANCE.getStatus() );
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package appeng.core.crash;
|
||||||
|
|
||||||
|
|
||||||
|
import appeng.core.AEConfig;
|
||||||
|
|
||||||
|
|
||||||
|
public class ModCrashEnhancement extends BaseCrashEnhancement
|
||||||
|
{
|
||||||
|
private static final String MOD_VERSION = AEConfig.CHANNEL + ' ' + AEConfig.VERSION + " for Forge " + // WHAT?
|
||||||
|
net.minecraftforge.common.ForgeVersion.majorVersion + '.' // majorVersion
|
||||||
|
+ net.minecraftforge.common.ForgeVersion.minorVersion + '.' // minorVersion
|
||||||
|
+ net.minecraftforge.common.ForgeVersion.revisionVersion + '.' // revisionVersion
|
||||||
|
+ net.minecraftforge.common.ForgeVersion.buildVersion;
|
||||||
|
|
||||||
|
public ModCrashEnhancement( CrashInfo output )
|
||||||
|
{
|
||||||
|
super( "AE2 Version", MOD_VERSION );
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user