forked from Mithion/ArsMagica2
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Safety checks for MC version (forces 1.10.2), build_bumber++
- Loading branch information
1 parent
442ce17
commit 1fcee6c
Showing
3 changed files
with
73 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<String, Object> 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<String, Object> 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; | ||
} | ||
|
||
} |