Split logic of crash enhancement

This commit is contained in:
thatsIch
2015-03-26 12:23:55 +01:00
parent 0519f60cb0
commit dfa595ad2a
4 changed files with 42 additions and 34 deletions
@@ -21,52 +21,27 @@ package appeng.core.crash;
import cpw.mods.fml.common.ICrashCallable;
import appeng.core.AEConfig;
import appeng.integration.IntegrationRegistry;
public class CrashEnhancement implements ICrashCallable
abstract class BaseCrashEnhancement implements ICrashCallable
{
private final String name;
private final String value;
private final String ModVersion = 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 CrashEnhancement( CrashInfo Output )
public BaseCrashEnhancement( String name, String value )
{
if ( Output == CrashInfo.MOD_VERSION )
{
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";
}
this.name = name;
this.value = value;
}
@Override
public String call() throws Exception
public final String call() throws Exception
{
return this.value;
}
@Override
public String getLabel()
public final String getLabel()
{
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 );
}
}