From 1fcee6c73da72bac49d5e5fd5afaef15d64d1728 Mon Sep 17 00:00:00 2001 From: EdwinMindcraft Date: Tue, 20 Mar 2018 20:56:16 +0100 Subject: [PATCH] Safety checks for MC version (forces 1.10.2), build_bumber++ --- build.properties | 2 +- src/main/java/am2/ArsMagica2.java | 2 +- src/main/java/am2/common/asm/Preloader.java | 141 ++++++++++---------- 3 files changed, 73 insertions(+), 72 deletions(-) diff --git a/build.properties b/build.properties index 7c813a1e9..305a7554d 100644 --- a/build.properties +++ b/build.properties @@ -2,7 +2,7 @@ #Sat Dec 24 21:55:56 PST 2016 mcmapping=snapshot_20161111 version=1.5.0C -build_number=7 +build_number=9 jei_version=3.7.8.+ mcversion=1.10.2 mod_name=ArsMagica2 \ No newline at end of file diff --git a/src/main/java/am2/ArsMagica2.java b/src/main/java/am2/ArsMagica2.java index 63b8fd289..b3fa6953f 100644 --- a/src/main/java/am2/ArsMagica2.java +++ b/src/main/java/am2/ArsMagica2.java @@ -25,7 +25,7 @@ import net.minecraftforge.fml.relauncher.Side; -@Mod(modid=ArsMagica2.MODID, version=ArsMagica2.VERSION, guiFactory=ArsMagica2.GUIFACTORY, canBeDeactivated=false) +@Mod(modid=ArsMagica2.MODID, version=ArsMagica2.VERSION, guiFactory=ArsMagica2.GUIFACTORY, canBeDeactivated=false, acceptedMinecraftVersions = "[1.10.2,1.11)") public class ArsMagica2 { public static final String MODID = "arsmagica2"; diff --git a/src/main/java/am2/common/asm/Preloader.java b/src/main/java/am2/common/asm/Preloader.java index 5a6b78200..7e1dd6005 100644 --- a/src/main/java/am2/common/asm/Preloader.java +++ b/src/main/java/am2/common/asm/Preloader.java @@ -1,70 +1,71 @@ -package am2.common.asm; - -import java.io.File; -import java.util.Map; - -import am2.common.LogHelper; -import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin; -import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin.DependsOn; -import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin.Name; -import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin.SortingIndex; - -@Name("ArsMagica2-Preloader") -@DependsOn("arsmagica2") -@SortingIndex(1001) -public class Preloader implements IFMLLoadingPlugin { - - public static boolean isDevEnvironment; - public static boolean foundThaumcraft; - - @Override - public String[] getASMTransformerClass() { - return new String[] {"am2.common.asm.Transformer"}; - } - - @Override - public String getModContainerClass() { - return null; - } - - @Override - public String getSetupClass() { - return null; - } - - @Override - public void injectData(Map data) { - File loc = (File)data.get("mcLocation"); - - LogHelper.trace("MC located at: " + loc.getAbsolutePath()); - isDevEnvironment = !(Boolean)data.get("runtimeDeobfuscationEnabled"); - - File mcFolder = new File(loc.getAbsolutePath() + File.separatorChar + "mods"); - File[] subfiles = mcFolder.listFiles(); - for (File file : subfiles){ - String name = file.getName(); - if (name != null) { - name = name.toLowerCase(); - if (name.endsWith(".jar") || name.endsWith(".zip")){ - if (name.contains("thaumcraft")){ - LogHelper.info("Core: Located Thaumcraft in " + file.getName()); - foundThaumcraft = true; - } -// else if (name.contains("optifine")){ -// LogHelper.info("Core: Located OptiFine in " + file.getName() + ". We'll to confirm that..."); -// foundOptiFine = true; -// }else if (name.contains("dragonapi")){ -// LogHelper.info("Core: Located DragonAPI in " + file.getName()); -// foundDragonAPI = true; -// } - } - } - } - } - - @Override - public String getAccessTransformerClass() { - return null; - } - -} +package am2.common.asm; + +import am2.common.LogHelper; +import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin; +import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin.DependsOn; +import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin.Name; +import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin.SortingIndex; + +import java.io.File; +import java.util.Map; + +@IFMLLoadingPlugin.Name("ArsMagica2-Preloader") +@IFMLLoadingPlugin.DependsOn("arsmagica2") +@IFMLLoadingPlugin.SortingIndex(1001) +@IFMLLoadingPlugin.MCVersion("1.10.2") +public class Preloader implements IFMLLoadingPlugin { + + public static boolean isDevEnvironment; + public static boolean foundThaumcraft; + + @Override + public String[] getASMTransformerClass() { + return new String[]{"am2.common.asm.Transformer"}; + } + + @Override + public String getModContainerClass() { + return null; + } + + @Override + public String getSetupClass() { + return null; + } + + @Override + public void injectData(Map data) { + File loc = (File) data.get("mcLocation"); + + LogHelper.trace("MC located at: " + loc.getAbsolutePath()); + isDevEnvironment = !(Boolean) data.get("runtimeDeobfuscationEnabled"); + + File mcFolder = new File(loc.getAbsolutePath() + File.separatorChar + "mods"); + File[] subfiles = mcFolder.listFiles(); + for (File file : subfiles) { + String name = file.getName(); + if (name != null) { + name = name.toLowerCase(); + if (name.endsWith(".jar") || name.endsWith(".zip")) { + if (name.contains("thaumcraft")) { + LogHelper.info("Core: Located Thaumcraft in " + file.getName()); + foundThaumcraft = true; + } +// else if (name.contains("optifine")){ +// LogHelper.info("Core: Located OptiFine in " + file.getName() + ". We'll to confirm that..."); +// foundOptiFine = true; +// }else if (name.contains("dragonapi")){ +// LogHelper.info("Core: Located DragonAPI in " + file.getName()); +// foundDragonAPI = true; +// } + } + } + } + } + + @Override + public String getAccessTransformerClass() { + return null; + } + +}