Prevent loading if ttCore is detected

This commit is contained in:
tterrag1098 committed 2015-06-24 03:05:36 -04:00
1 parent 8bce03348c
commit d538b5530a
2 files changed
+27 -2

No files matched your search

+22 -1
View File
@@ -4,6 +4,8 @@ import java.io.File;
import java.util.List;
import lombok.SneakyThrows;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiErrorScreen;
import net.minecraft.command.CommandHandler;
import net.minecraft.server.MinecraftServer;
import net.minecraftforge.client.ClientCommandHandler;
@@ -29,6 +31,8 @@ import com.enderio.core.common.util.PermanentCache;
import com.enderio.core.common.util.TextureErrorRemover;
import com.google.common.collect.Lists;
import cpw.mods.fml.client.CustomModLoadingErrorDisplayException;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
@@ -39,7 +43,7 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
@Mod(modid = EnderCore.MODID, name = EnderCore.NAME, version = EnderCore.VERSION, guiFactory = "com.enderio.core.common.config.BaseConfigFactory")
@Mod(modid = EnderCore.MODID, name = EnderCore.NAME, version = EnderCore.VERSION, dependencies = "after:ttCore", guiFactory = "com.enderio.core.common.config.BaseConfigFactory")
public class EnderCore implements IEnderMod {
public static final String MODID = "endercore";
@@ -58,9 +62,26 @@ public class EnderCore implements IEnderMod {
public List<IConfigHandler> configs = Lists.newArrayList();
@SuppressWarnings("serial")
@EventHandler
@SneakyThrows
public void preInit(FMLPreInitializationEvent event) {
if (Loader.isModLoaded("ttCore")) {
throw new CustomModLoadingErrorDisplayException() {
@Override
public void initGui(GuiErrorScreen errorScreen, FontRenderer fontRenderer) {
}
@Override
public void drawScreen(GuiErrorScreen errorScreen, FontRenderer fontRenderer, int mouseRelX, int mouseRelY, float tickTime) {
errorScreen.drawCenteredString(fontRenderer, lang.localize("error.ttcore.1"), errorScreen.width / 2, errorScreen.height / 2 - 20, 0xFFFFFF);
errorScreen.drawCenteredString(fontRenderer, lang.localize("error.ttcore.2"), errorScreen.width / 2, errorScreen.height / 2 - 10, 0xFFFFFF);
errorScreen.drawCenteredString(fontRenderer, lang.localize("error.ttcore.3"), errorScreen.width / 2, errorScreen.height / 2, 0xFFFFFF);
}
};
}
if (event.getSide().isClient()) {
TextureErrorRemover.beginIntercepting();
}