Added Core Mod Error.

This commit is contained in:
AlgorithmX2 2014-08-02 23:34:49 -05:00
parent a936bb7404
commit 06856eb957
2 changed files with 70 additions and 1 deletions

View file

@ -22,11 +22,13 @@ import appeng.integration.IntegrationType;
import appeng.server.AECommand; import appeng.server.AECommand;
import appeng.services.Profiler; import appeng.services.Profiler;
import appeng.services.VersionChecker; import appeng.services.VersionChecker;
import appeng.transformer.MissingCoreMod;
import appeng.util.Platform; import appeng.util.Platform;
import com.google.common.base.Stopwatch; import com.google.common.base.Stopwatch;
import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLInitializationEvent;
@ -64,7 +66,8 @@ public class AppEng
// "after:gregtech_addon;after:Mekanism;after:IC2;after:ThermalExpansion;after:BuildCraft|Core;" + // "after:gregtech_addon;after:Mekanism;after:IC2;after:ThermalExpansion;after:BuildCraft|Core;" +
// depend on version of forge used for build. // depend on version of forge used for build.
"required-after:appliedenergistics2-core;" + "required-after:Forge@[" // require forge. // "required-after:appliedenergistics2-core;" +
"required-after:Forge@[" // require forge.
+ net.minecraftforge.common.ForgeVersion.majorVersion + "." // majorVersion + net.minecraftforge.common.ForgeVersion.majorVersion + "." // majorVersion
+ net.minecraftforge.common.ForgeVersion.minorVersion + "." // minorVersion + net.minecraftforge.common.ForgeVersion.minorVersion + "." // minorVersion
+ net.minecraftforge.common.ForgeVersion.revisionVersion + "." // revisionVersion + net.minecraftforge.common.ForgeVersion.revisionVersion + "." // revisionVersion
@ -106,6 +109,9 @@ public class AppEng
@EventHandler @EventHandler
void PreInit(FMLPreInitializationEvent event) void PreInit(FMLPreInitializationEvent event)
{ {
if ( !Loader.isModLoaded( "after:appliedenergistics2-core" ) )
throw new MissingCoreMod();
Stopwatch star = Stopwatch.createStarted(); Stopwatch star = Stopwatch.createStarted();
configPath = event.getModConfigurationDirectory().getPath() + File.separator + "AppliedEnergistics2" + File.separator; configPath = event.getModConfigurationDirectory().getPath() + File.separator + "AppliedEnergistics2" + File.separator;

View file

@ -0,0 +1,63 @@
package appeng.transformer;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiErrorScreen;
import cpw.mods.fml.client.CustomModLoadingErrorDisplayException;
public class MissingCoreMod extends CustomModLoadingErrorDisplayException
{
private static final long serialVersionUID = -966774766922821652L;
private boolean deobf = false;
@Override
public void initGui(GuiErrorScreen errorScreen, FontRenderer fontRenderer)
{
Class clz = errorScreen.getClass();
try
{
clz.getField( "mc" );
deobf = true;
}
catch (Throwable e)
{
}
}
@Override
public void drawScreen(GuiErrorScreen errorScreen, FontRenderer fontRenderer, int mouseRelX, int mouseRelY, float tickTime)
{
int offset = 10;
drawCenteredString( fontRenderer, "Sorry, couldn't load AE2 Properly.", errorScreen.width / 2, offset += 15, 0xffffff );
drawCenteredString( fontRenderer, "Please make sure that AE2 is installed into your mods folder.", errorScreen.width / 2, offset += 15, 0xeeeeee );
offset += 15;
if ( deobf )
{
offset += 15;
drawCenteredString( fontRenderer, "In a developer environment add the following too your args,", errorScreen.width / 2, offset += 15, 0xffffff );
drawCenteredString( fontRenderer, "-Dfml.coreMods.load=appeng.transformer.AppEngCore", errorScreen.width / 2, offset += 15, 0xeeeeee );
}
else
{
drawCenteredString( fontRenderer, "You're launcher may refer to this by diffrent names,", errorScreen.width / 2, offset += 15, 0xffffff );
offset += 5;
drawCenteredString( fontRenderer, "MultiMC calls this tab \"Loader Mods\"", errorScreen.width / 2, offset += 15, 0xeeeeee );
drawCenteredString( fontRenderer, "Magic Launcher calls this tab \"External Mods\"", errorScreen.width / 2, offset += 15, 0xeeeeee );
drawCenteredString( fontRenderer, "Most other launchers refer to this tab as just \"Mods\"", errorScreen.width / 2, offset += 15, 0xeeeeee );
offset += 15;
drawCenteredString( fontRenderer, "Also make sure that the AE2 file is a .jar, and not a .zip", errorScreen.width / 2, offset += 15, 0xffffff );
}
}
public void drawCenteredString(FontRenderer fontRenderer, String string, int x, int y, int colour)
{
fontRenderer.drawStringWithShadow( string, x - fontRenderer.getStringWidth( string.replaceAll( "\\P{InBasic_Latin}", "" ) ) / 2, y, colour );
}
}