diff options
22 files changed, 3641 insertions, 3287 deletions
diff --git a/build.gradle b/build.gradle index 656f439f7a..5073008f95 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1644894948 +//version: 1656760732 /* DO NOT CHANGE THIS FILE! @@ -12,7 +12,12 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar import org.gradle.internal.logging.text.StyledTextOutput.Style import org.gradle.internal.logging.text.StyledTextOutputFactory +import java.nio.file.Files +import java.nio.file.Paths import java.util.concurrent.TimeUnit +import java.util.zip.ZipEntry +import java.util.zip.ZipInputStream +import java.util.zip.ZipOutputStream buildscript { repositories { @@ -44,13 +49,15 @@ plugins { id 'eclipse' id 'scala' id 'maven-publish' - id 'org.jetbrains.kotlin.jvm' version '1.5.30' apply false - id 'org.jetbrains.kotlin.kapt' version '1.5.30' apply false + id 'org.jetbrains.kotlin.jvm' version '1.5.30' apply false + id 'org.jetbrains.kotlin.kapt' version '1.5.30' apply false + id 'com.google.devtools.ksp' version '1.5.30-1.0.0' apply false id 'org.ajoberstar.grgit' version '4.1.1' id 'com.github.johnrengelman.shadow' version '4.0.4' - id 'com.palantir.git-version' version '0.13.0' apply false + id 'com.palantir.git-version' version '0.13.0' apply false id 'de.undercouch.download' version '5.0.1' - id 'com.github.gmazzo.buildconfig' version '3.0.3' apply false + id 'com.github.gmazzo.buildconfig' version '3.0.3' apply false + id "com.diffplug.spotless" version "6.7.2" } if (project.file('.git/HEAD').isFile()) { @@ -77,6 +84,37 @@ idea { } } +// Spotless autoformatter +// See https://github.com/diffplug/spotless/tree/main/plugin-gradle +// Can be locally toggled via spotless:off/spotless:on comments +spotless { + encoding 'UTF-8' + + format 'misc', { + target '.gitignore' + + trimTrailingWhitespace() + indentWithSpaces(4) + endWithNewline() + } + java { + toggleOffOn() + importOrder() + removeUnusedImports() + palantirJavaFormat('1.1.0') // last version supporting jvm 8 + } + kotlin { + toggleOffOn() + ktfmt('0.39') + } + groovyGradle { + toggleOffOn() + importOrder() + target '*.gradle' + greclipse('4.19.0') // last version supporting jvm 8 + } +} + if(JavaVersion.current() != JavaVersion.VERSION_1_8) { throw new GradleException("This project requires Java 8, but it's running on " + JavaVersion.current()) } @@ -103,6 +141,11 @@ checkPropertyExists("usesShadowedDependencies") checkPropertyExists("developmentEnvironmentUserName") boolean noPublishedSources = project.findProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false +boolean usesMixinDebug = project.findProperty('usesMixinDebug') ?: project.usesMixins.toBoolean() +boolean forceEnableMixins = project.findProperty('forceEnableMixins') ? project.forceEnableMixins.toBoolean() : false +String channel = project.findProperty('channel') ? project.channel : 'stable' +String mappingsVersion = project.findProperty('mappingsVersion') ? project.mappingsVersion : '12' +String remoteMappings = project.findProperty('remoteMappings') ? project.remoteMappings : 'https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/' String javaSourceDir = "src/main/java/" String scalaSourceDir = "src/main/scala/" @@ -213,11 +256,11 @@ else { def arguments = [] def jvmArguments = [] -if (usesMixins.toBoolean()) { +if (usesMixins.toBoolean() || forceEnableMixins) { arguments += [ "--tweakClass org.spongepowered.asm.launch.MixinTweaker" ] - if (!project.hasProperty(usesMixinDebug) || usesMixinDebug.toBoolean()) { + if (usesMixinDebug.toBoolean()) { jvmArguments += [ "-Dmixin.debug.countInjections=true", "-Dmixin.debug.verbose=true", @@ -278,7 +321,7 @@ repositories { name 'Overmind forge repo mirror' url 'https://gregtech.overminddl1.com/' } - if(usesMixins.toBoolean()) { + if(usesMixins.toBoolean() || forceEnableMixins) { maven { name 'sponge' url 'https://repo.spongepowered.org/repository/maven-public' @@ -295,6 +338,8 @@ dependencies { annotationProcessor('com.google.guava:guava:24.1.1-jre') annotationProcessor('com.google.code.gson:gson:2.8.6') annotationProcessor('org.spongepowered:mixin:0.8-SNAPSHOT') + } + if(usesMixins.toBoolean() || forceEnableMixins) { // using 0.8 to workaround a issue in 0.7 which fails mixin application compile('com.github.GTNewHorizons:SpongePoweredMixin:0.7.12-GTNH') { // Mixin includes a lot of dependencies that are too up-to-date @@ -567,7 +612,7 @@ publishing { artifact source: shadowJar, classifier: "" } if(!noPublishedSources) { - artifact source: sourcesJar, classifier: "src" + artifact source: sourcesJar, classifier: "sources" } artifact source: usesShadowedDependencies.toBoolean() ? shadowDevJar : devJar, classifier: "dev" if (apiPackage) { @@ -667,7 +712,103 @@ configure(updateBuildScript) { description = 'Updates the build script to the latest version' } -// Deobfuscation +// Parameter Deobfuscation + +task deobfParams { + doLast { + + String mcpDir = "$project.gradle.gradleUserHomeDir/caches/minecraft/de/oceanlabs/mcp/mcp_$channel/$mappingsVersion" + String mcpZIP = "$mcpDir/mcp_$channel-$mappingsVersion-${minecraftVersion}.zip" + String paramsCSV = "$mcpDir/params.csv" + + download.run { + src "https://maven.minecraftforge.net/de/oceanlabs/mcp/mcp_$channel/$mappingsVersion-$minecraftVersion/mcp_$channel-$mappingsVersion-${minecraftVersion}.zip" + dest mcpZIP + overwrite false + } + + if(!file(paramsCSV).exists()) { + println("Extracting MCP archive ...") + unzip(mcpZIP, mcpDir) + } + + println("Parsing params.csv ...") + Map<String, String> params = new HashMap<>() + Files.lines(Paths.get(paramsCSV)).forEach{line -> + String[] cells = line.split(",") + if(cells.length > 2 && cells[0].matches("p_i?\\d+_\\d+_")) { + params.put(cells[0], cells[1]) + } + } + + out.style(Style.Success).println("Modified ${replaceParams(file("$projectDir/src/main/java"), params)} files!") + out.style(Style.Failure).println("Don't forget to verify that the code still works as before!\n It could be broken due to duplicate variables existing now\n or parameters taking priority over other variables.") + } +} + +static int replaceParams(File file, Map<String, String> params) { + int fileCount = 0 + + if(file.isDirectory()) { + for(File f : file.listFiles()) { + fileCount += replaceParams(f, params) + } + return fileCount + } + println("Visiting ${file.getName()} ...") + try { + String content = new String(Files.readAllBytes(file.toPath())) + int hash = content.hashCode() + params.forEach{key, value -> + content = content.replaceAll(key, value) + } + if(hash != content.hashCode()) { + Files.write(file.toPath(), content.getBytes("UTF-8")) + return 1 + } + } catch(Exception e) { + e.printStackTrace() + } + return 0 +} + +// Credit: bitsnaps (https://gist.github.com/bitsnaps/00947f2dce66f4bbdabc67d7e7b33681) +static unzip(String zipFileName, String outputDir) { + byte[] buffer = new byte[16384] + ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFileName)) + ZipEntry zipEntry = zis.getNextEntry() + while (zipEntry != null) { + File newFile = new File(outputDir + File.separator, zipEntry.name) + if (zipEntry.isDirectory()) { + if (!newFile.isDirectory() && !newFile.mkdirs()) { + throw new IOException("Failed to create directory $newFile") + } + } else { + // fix for Windows-created archives + File parent = newFile.parentFile + if (!parent.isDirectory() && !parent.mkdirs()) { + throw new IOException("Failed to create directory $parent") + } + // write file content + FileOutputStream fos = new FileOutputStream(newFile) + int len = 0 + while ((len = zis.read(buffer)) > 0) { + fos.write(buffer, 0, len) + } + fos.close() + } + zipEntry = zis.getNextEntry() + } + zis.closeEntry() + zis.close() +} + +configure(deobfParams) { + group = 'forgegradle' + description = 'Rename all obfuscated parameter names inherited from Minecraft classes' +} + +// Dependency Deobfuscation def deobf(String sourceURL) { try { @@ -680,7 +821,7 @@ def deobf(String sourceURL) { fileName = fileName.substring(lastSlash + 1) } //get rid of extension: - if(fileName.endsWith(".jar")) { + if(fileName.endsWith(".jar") || fileName.endsWith(".litemod")) { fileName = fileName.substring(0, fileName.lastIndexOf(".")) } @@ -692,26 +833,40 @@ def deobf(String sourceURL) { Collections.reverse(parts) hostName = String.join(".", parts) - return deobf(sourceURL, hostName + "/" + fileName) + return deobf(sourceURL, "$hostName/$fileName") } catch(Exception e) { - return deobf(sourceURL, "deobf/" + String.valueOf(sourceURL.hashCode())) + return deobf(sourceURL, "deobf/${sourceURL.hashCode()}") } } // The method above is to be preferred. Use this method if the filename is not at the end of the URL. -def deobf(String sourceURL, String fileName) { - String cacheDir = System.getProperty("user.home") + "/.gradle/caches/" - String bon2Dir = cacheDir + "forge_gradle/deobf" - String bon2File = bon2Dir + "/BON2-2.5.0.jar" - String obfFile = cacheDir + "modules-2/files-2.1/" + fileName + ".jar" - String deobfFile = cacheDir + "modules-2/files-2.1/" + fileName + "-deobf.jar" +def deobf(String sourceURL, String rawFileName) { + String bon2Version = "2.5.1" + String fileName = URLDecoder.decode(rawFileName, "UTF-8") + String cacheDir = "$project.gradle.gradleUserHomeDir/caches" + String bon2Dir = "$cacheDir/forge_gradle/deobf" + String bon2File = "$bon2Dir/BON2-${bon2Version}.jar" + String obfFile = "$cacheDir/modules-2/files-2.1/${fileName}.jar" + String deobfFile = "$cacheDir/modules-2/files-2.1/${fileName}-deobf.jar" if(file(deobfFile).exists()) { return files(deobfFile) } + String mappingsVer + if(remoteMappings) { + String id = "${forgeVersion.split("\\.")[3]}-$minecraftVersion" + String mappingsZIP = "$cacheDir/forge_gradle/maven_downloader/de/oceanlabs/mcp/mcp_snapshot_nodoc/$id/mcp_snapshot_nodoc-${id}.zip" + + zipMappings(mappingsZIP, remoteMappings, bon2Dir) + + mappingsVer = "snapshot_$id" + } else { + mappingsVer = "${channel}_$mappingsVersion" + } + download.run { - src 'https://github.com/GTNewHorizons/BON2/releases/download/2.5.0/BON2-2.5.0.CUSTOM-all.jar' + src "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases/com/github/parker8283/BON2/$bon2Version-CUSTOM/BON2-$bon2Version-CUSTOM-all.jar" dest bon2File quiet true overwrite false @@ -725,14 +880,48 @@ def deobf(String sourceURL, String fileName) { } exec { - commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', '1.7.10', '--mappingsVer', 'stable_12', '--notch' + commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', minecraftVersion, '--mappingsVer', mappingsVer, '--notch' workingDir bon2Dir - standardOutput = new ByteArrayOutputStream() + standardOutput = new FileOutputStream("${deobfFile}.log") } return files(deobfFile) } +def zipMappings(String zipPath, String url, String bon2Dir) { + File zipFile = new File(zipPath) + if(zipFile.exists()) { + return + } + + String fieldsCache = "$bon2Dir/data/fields.csv" + String methodsCache = "$bon2Dir/data/methods.csv" + + download.run { + src "${url}fields.csv" + dest fieldsCache + quiet true + } + download.run { + src "${url}methods.csv" + dest methodsCache + quiet true + } + + zipFile.getParentFile().mkdirs() + ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFile)) + + zos.putNextEntry(new ZipEntry("fields.csv")) + Files.copy(Paths.get(fieldsCache), zos) + zos.closeEntry() + + zos.putNextEntry(new ZipEntry("methods.csv")) + Files.copy(Paths.get(methodsCache), zos) + zos.closeEntry() + + zos.close() +} + // Helper methods def checkPropertyExists(String propertyName) { diff --git a/dependencies.gradle b/dependencies.gradle index 8b9aa29518..2e91d093ad 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,39 +1,39 @@ // Add your dependencies here dependencies { - compile('com.github.GTNewHorizons:GT5-Unofficial:5.09.40.41:dev') + compile('com.github.GTNewHorizons:GT5-Unofficial:5.09.40.41:dev') compile('com.github.GTNewHorizons:NewHorizonsCoreMod:1.9.21:dev') - compile('com.github.GTNewHorizons:StructureLib:1.0.16:dev') - compile('com.github.GTNewHorizons:GTplusplus:1.7.30:dev') - compile('com.github.GTNewHorizons:GoodGenerator:0.4.1:dev') - compile('com.github.GTNewHorizons:TecTech:5.0.6:dev') - compile('com.github.GTNewHorizons:ForestryMC:4.4.6:dev') - compile('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-79-GTNH:dev') - compile('com.github.GTNewHorizons:bartworks:0.5.42:dev') - compile('com.github.GTNewHorizons:BuildCraft:7.1.27:dev') - compile('com.github.GTNewHorizons:NotEnoughItems:2.2.8-GTNH:dev') - - compile('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev') - - compileOnly('com.github.GTNewHorizons:EnderCore:0.2.6:dev') {transitive=false} - compileOnly('com.github.GTNewHorizons:AppleCore:3.1.9:dev') {transitive = false} - compileOnly('com.github.GTNewHorizons:Railcraft:9.13.6:dev') {transitive = false} - compileOnly('com.github.GTNewHorizons:EnderIO:2.3.1.31:dev') {transitive=false} - compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.9:dev') {transitive=false} - - compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev') {transitive=false} + compile('com.github.GTNewHorizons:StructureLib:1.0.16:dev') + compile('com.github.GTNewHorizons:GTplusplus:1.7.30:dev') + compile('com.github.GTNewHorizons:GoodGenerator:0.4.1:dev') + compile('com.github.GTNewHorizons:TecTech:5.0.6:dev') + compile('com.github.GTNewHorizons:ForestryMC:4.4.6:dev') + compile('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-79-GTNH:dev') + compile('com.github.GTNewHorizons:bartworks:0.5.42:dev') + compile('com.github.GTNewHorizons:BuildCraft:7.1.27:dev') + compile('com.github.GTNewHorizons:NotEnoughItems:2.2.8-GTNH:dev') + + compile('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev') + + compileOnly('com.github.GTNewHorizons:EnderCore:0.2.6:dev') {transitive=false} + compileOnly('com.github.GTNewHorizons:AppleCore:3.1.9:dev') {transitive = false} + compileOnly('com.github.GTNewHorizons:Railcraft:9.13.6:dev') {transitive = false} + compileOnly('com.github.GTNewHorizons:EnderIO:2.3.1.31:dev') {transitive=false} + compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.9:dev') {transitive=false} + + compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev') {transitive=false} //compile('com.github.GTNewHorizons:GalacticGregGT5:1.0.7:dev') //compile('com.github.GTNewHorizons:TecTech:5.0.6:dev') //compile('com.github.GTNewHorizons:Galacticraft:3.0.40-GTNH:dev') - //compileOnly('com.github.GTNewHorizons:Avaritia:1.25) + //compileOnly('com.github.GTNewHorizons:Avaritia:1.25) //compile files('ThaumicTinkerer-1.7.10-2.5-4-dev.jar') - //compile files('Botdustries-1.7.10-1.0.1.jar') + //compile files('Botdustries-1.7.10-1.0.1.jar') - //runtime('com.github.GTNewHorizons:Baubles:1.0.1.14:dev') - //runtime('com.github.GTNewHorizons:Yamcl:0.5.82:dev') - runtime('curse.maven:cofh-core-69162:2388751') //for GT++ - runtime('curse.maven:advsolar-362768:2885953') //for GT++ + //runtime('com.github.GTNewHorizons:Baubles:1.0.1.14:dev') + //runtime('com.github.GTNewHorizons:Yamcl:0.5.82:dev') + runtime('curse.maven:cofh-core-69162:2388751') //for GT++ + runtime('curse.maven:advsolar-362768:2885953') //for GT++ } diff --git a/repositories.gradle b/repositories.gradle index 1dc4c3cb4c..911d3c94a5 100644 --- a/repositories.gradle +++ b/repositories.gradle @@ -1,26 +1,26 @@ // Add any additional repositories for your dependencies here repositories { - maven { - name 'GTNH Maven' - url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/' - allowInsecureProtocol - } - maven { - name 'ic2' - url 'https://maven.ic2.player.to/' - metadataSources { - mavenPom() - artifact() - } - } - maven { - url 'https://cursemaven.com' - content { - includeGroup 'curse.maven' - } - } - maven { - url 'https://jitpack.io' - } + maven { + name 'GTNH Maven' + url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/' + allowInsecureProtocol + } + maven { + name 'ic2' + url 'https://maven.ic2.player.to/' + metadataSources { + mavenPom() + artifact() + } + } + maven { + url 'https://cursemaven.com' + content { + includeGroup 'curse.maven' + } + } + maven { + url 'https://jitpack.io' + } } diff --git a/src/main/java/com/elisis/gtnhlanth/GTNHLanthanides.java b/src/main/java/com/elisis/gtnhlanth/GTNHLanthanides.java index e15c3bcf33..f7837c68e6 100644 --- a/src/main/java/com/elisis/gtnhlanth/GTNHLanthanides.java +++ b/src/main/java/com/elisis/gtnhlanth/GTNHLanthanides.java @@ -1,108 +1,105 @@ -package com.elisis.gtnhlanth;
-
-import java.util.Arrays;
-import java.util.logging.Logger;
-
-import com.elisis.gtnhlanth.common.CommonProxy;
-import com.elisis.gtnhlanth.common.register.BotWerkstoffMaterialPool;
-import com.elisis.gtnhlanth.common.register.LanthItemList;
-import com.elisis.gtnhlanth.common.register.WerkstoffMaterialPool;
-import com.elisis.gtnhlanth.loader.BotRecipes;
-import com.elisis.gtnhlanth.loader.RecipeLoader;
-import com.elisis.gtnhlanth.loader.ZPMRubberChanges;
-import com.elisis.gtnhlanth.xmod.nei.IMC;
-import com.github.bartimaeusnek.bartworks.API.WerkstoffAdderRegistry;
-import com.github.bartimaeusnek.bartworks.system.material.Werkstoff;
-
-import cpw.mods.fml.common.Mod;
-import cpw.mods.fml.common.Mod.EventHandler;
-import cpw.mods.fml.common.SidedProxy;
-import cpw.mods.fml.common.event.FMLInitializationEvent;
-import cpw.mods.fml.common.event.FMLLoadCompleteEvent;
-import cpw.mods.fml.common.event.FMLPostInitializationEvent;
-import cpw.mods.fml.common.event.FMLPreInitializationEvent;
-import cpw.mods.fml.common.event.FMLServerAboutToStartEvent;
-import cpw.mods.fml.common.event.FMLServerStartedEvent;
-import gregtech.api.GregTech_API;
-import gregtech.api.enums.OrePrefixes;
-import gregtech.api.util.GT_Log;
-import net.minecraftforge.oredict.OreDictionary;
-
-@Mod(modid = Tags.MODID, version = Tags.VERSION, name = Tags.MODNAME,
- dependencies = "required-after:IC2; " + "required-after:gregtech; "
- + "required-after:bartworks; "
- + "required-after:GoodGenerator; "
- + "before:miscutils; "
- + "required-after:dreamcraft; "
- )
-public class GTNHLanthanides {
-
- public static Logger LOG = Logger.getLogger("GTNH:Lanthanides");
-
- @Mod.Instance
- public static GTNHLanthanides instance;
-
- @SidedProxy(clientSide = "com.elisis.gtnhlanth.client.ClientProxy",serverSide = "com.elisis.gtnhlanth.common.CommonProxy")
- public static CommonProxy proxy;
-
- @EventHandler
- public static void preInit(FMLPreInitializationEvent e) {
- WerkstoffAdderRegistry.addWerkstoffAdder(new WerkstoffMaterialPool());
- WerkstoffAdderRegistry.addWerkstoffAdder(new BotWerkstoffMaterialPool());
- LanthItemList.register();
- GregTech_API.sAfterGTPostload.add(new ZPMRubberChanges());
- proxy.preInit(e);
- }
-
- @EventHandler
- public static void init(FMLInitializationEvent e) {
- proxy.init(e);
- WerkstoffMaterialPool.runInit();
- IMC.IMCSender();
- }
-
- @EventHandler
- public static void postInit(FMLPostInitializationEvent e) {
- RecipeLoader.loadGeneral();
- RecipeLoader.loadLanthanideRecipes();
- RecipeLoader.addRandomChemCrafting();
- BotRecipes.addGTRecipe();
- BotRecipes.addFuels();
- //RecipeLoader.loadZylonRecipes();
- proxy.postInit(e);
- //GT_Log.out.print(FluidRegistry.getFluid("Sodium Tungstate").getName());
-
- GT_Log.out.print(Arrays.toString(Werkstoff.werkstoffNameHashMap.keySet().toArray()));
- GT_Log.out.print(Arrays.toString(Werkstoff.werkstoffHashMap.keySet().toArray()));
-
- GT_Log.out.print("HMMM " + Arrays.toString(OreDictionary.getOreIDs(WerkstoffMaterialPool.DephosphatedSamariumConcentrate.get(OrePrefixes.dust, 1))));
-
-
- }
-
- @EventHandler
- public static void onModLoadingComplete(FMLLoadCompleteEvent e) {
- GT_Log.out.print("AAAAAAAAAAAAAA");
- //
- GT_Log.out.print("We are done loading");
- BotRecipes.removeRecipes();
-
- GT_Log.out.print("blah blah " + WerkstoffMaterialPool.PTMEGElastomer.hasGenerationFeature(OrePrefixes.ingot));
-
-
-
- }
-
- // This is horrifying and I'm sorry
- @EventHandler
- public static void onServerAboutToStart(FMLServerAboutToStartEvent e) {
- //RecipeLoader.removeCeriumSources();
- }
-
- @EventHandler
- public static void onServerStart(FMLServerStartedEvent e) {
- RecipeLoader.removeCeriumSources();
- }
-
-
-}
+package com.elisis.gtnhlanth; + +import com.elisis.gtnhlanth.common.CommonProxy; +import com.elisis.gtnhlanth.common.register.BotWerkstoffMaterialPool; +import com.elisis.gtnhlanth.common.register.LanthItemList; +import com.elisis.gtnhlanth.common.register.WerkstoffMaterialPool; +import com.elisis.gtnhlanth.loader.BotRecipes; +import com.elisis.gtnhlanth.loader.RecipeLoader; +import com.elisis.gtnhlanth.loader.ZPMRubberChanges; +import com.elisis.gtnhlanth.xmod.nei.IMC; +import com.github.bartimaeusnek.bartworks.API.WerkstoffAdderRegistry; +import com.github.bartimaeusnek.bartworks.system.material.Werkstoff; +import cpw.mods.fml.common.Mod; +import cpw.mods.fml.common.Mod.EventHandler; +import cpw.mods.fml.common.SidedProxy; +import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.event.FMLLoadCompleteEvent; +import cpw.mods.fml.common.event.FMLPostInitializationEvent; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import cpw.mods.fml.common.event.FMLServerAboutToStartEvent; +import cpw.mods.fml.common.event.FMLServerStartedEvent; +import gregtech.api.GregTech_API; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GT_Log; +import java.util.Arrays; +import java.util.logging.Logger; +import net.minecraftforge.oredict.OreDictionary; + +@Mod( + modid = Tags.MODID, + version = Tags.VERSION, + name = Tags.MODNAME, + dependencies = "required-after:IC2; " + "required-after:gregtech; " + + "required-after:bartworks; " + + "required-after:GoodGenerator; " + + "before:miscutils; " + + "required-after:dreamcraft; ") +public class GTNHLanthanides { + + public static Logger LOG = Logger.getLogger("GTNH:Lanthanides"); + + @Mod.Instance + public static GTNHLanthanides instance; + + @SidedProxy( + clientSide = "com.elisis.gtnhlanth.client.ClientProxy", + serverSide = "com.elisis.gtnhlanth.common.CommonProxy") + public static CommonProxy proxy; + + @EventHandler + public static void preInit(FMLPreInitializationEvent e) { + WerkstoffAdderRegistry.addWerkstoffAdder(new WerkstoffMaterialPool()); + WerkstoffAdderRegistry.addWerkstoffAdder(new BotWerkstoffMaterialPool()); + LanthItemList.register(); + GregTech_API.sAfterGTPostload.add(new ZPMRubberChanges()); + proxy.preInit(e); + } + + @EventHandler + public static void init(FMLInitializationEvent e) { + proxy.init(e); + WerkstoffMaterialPool.runInit(); + IMC.IMCSender(); + } + + @EventHandler + public static void postInit(FMLPostInitializationEvent e) { + RecipeLoader.loadGeneral(); + RecipeLoader.loadLanthanideRecipes(); + RecipeLoader.addRandomChemCrafting(); + BotRecipes.addGTRecipe(); + BotRecipes.addFuels(); + // RecipeLoader.loadZylonRecipes(); + proxy.postInit(e); + // GT_Log.out.print(FluidRegistry.getFluid("Sodium Tungstate").getName()); + + GT_Log.out.print(Arrays.toString(Werkstoff.werkstoffNameHashMap.keySet().toArray())); + GT_Log.out.print(Arrays.toString(Werkstoff.werkstoffHashMap.keySet().toArray())); + + GT_Log.out.print("HMMM " + + Arrays.toString(OreDictionary.getOreIDs( + WerkstoffMaterialPool.DephosphatedSamariumConcentrate.get(OrePrefixes.dust, 1)))); + } + + @EventHandler + public static void onModLoadingComplete(FMLLoadCompleteEvent e) { + GT_Log.out.print("AAAAAAAAAAAAAA"); + // + GT_Log.out.print("We are done loading"); + BotRecipes.removeRecipes(); + + GT_Log.out.print("blah blah " + WerkstoffMaterialPool.PTMEGElastomer.hasGenerationFeature(OrePrefixes.ingot)); + } + + // This is horrifying and I'm sorry + @EventHandler + public static void onServerAboutToStart(FMLServerAboutToStartEvent e) { + // RecipeLoader.removeCeriumSources(); + } + + @EventHandler + public static void onServerStart(FMLServerStartedEvent e) { + RecipeLoader.removeCeriumSources(); + } +} diff --git a/src/main/java/com/elisis/gtnhlanth/Tags.java b/src/main/java/com/elisis/gtnhlanth/Tags.java index bd71de9398..93666809ba 100644 --- a/src/main/java/com/elisis/gtnhlanth/Tags.java +++ b/src/main/java/com/elisis/gtnhlanth/Tags.java @@ -1,10 +1,9 @@ -package com.elisis.gtnhlanth;
-
-public class Tags {
-
- public static final String MODID = "GRADLETOKEN_MODID";
- public static final String MODNAME = "GRADLETOKEN_MODNAME";
- public static final String VERSION = "GRADLETOKEN_VERSION";
- public static final String GROUPNAME = "GRADLETOKEN_GROUPNAME";
-
-}
+package com.elisis.gtnhlanth; + +public class Tags { + + public static final String MODID = "GRADLETOKEN_MODID"; + public static final String MODNAME = "GRADLETOKEN_MODNAME"; + public static final String VERSION = "GRADLETOKEN_VERSION"; + public static final String GROUPNAME = "GRADLETOKEN_GROUPNAME"; +} diff --git a/src/main/java/com/elisis/gtnhlanth/client/ClientProxy.java b/src/main/java/com/elisis/gtnhlanth/client/ClientProxy.java index d663dcde51..db2f43e2c6 100644 --- a/src/main/java/com/elisis/gtnhlanth/client/ClientProxy.java +++ b/src/main/java/com/elisis/gtnhlanth/client/ClientProxy.java @@ -1,7 +1,5 @@ -package com.elisis.gtnhlanth.client;
-
-import com.elisis.gtnhlanth.common.CommonProxy;
-
-public class ClientProxy extends CommonProxy {
-
-}
+package com.elisis.gtnhlanth.client; + +import com.elisis.gtnhlanth.common.CommonProxy; + +public class ClientProxy extends CommonProxy {} diff --git a/src/main/java/com/elisis/gtnhlanth/common/CommonProxy.java b/src/main/java/com/elisis/gtnhlanth/common/CommonProxy.java index a1022cf699..6e77ba200f 100644 --- a/src/main/java/com/elisis/gtnhlanth/common/CommonProxy.java +++ b/src/main/java/com/elisis/gtnhlanth/common/CommonProxy.java @@ -1,21 +1,14 @@ -package com.elisis.gtnhlanth.common;
-
-import cpw.mods.fml.common.event.FMLInitializationEvent;
-import cpw.mods.fml.common.event.FMLPostInitializationEvent;
-import cpw.mods.fml.common.event.FMLPreInitializationEvent;
-
-public class CommonProxy {
-
- public void preInit(FMLPreInitializationEvent e) {
-
- }
-
- public void init(FMLInitializationEvent e) {
-
- }
-
- public void postInit(FMLPostInitializationEvent e) {
-
- }
-
-}
+package com.elisis.gtnhlanth.common; + +import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.event.FMLPostInitializationEvent; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; + +public class CommonProxy { + + public void preInit(FMLPreInitializationEvent e) {} + + public void init(FMLInitializationEvent e) {} + + public void postInit(FMLPostInitializationEvent e) {} +} diff --git a/src/main/java/com/elisis/gtnhlanth/common/register/BotWerkstoffMaterialPool.java b/src/main/java/com/elisis/gtnhlanth/common/register/BotWerkstoffMaterialPool.java index 73e6ec8607..f7c2569cbb 100644 --- a/src/main/java/com/elisis/gtnhlanth/common/register/BotWerkstoffMaterialPool.java +++ b/src/main/java/com/elisis/gtnhlanth/common/register/BotWerkstoffMaterialPool.java @@ -1,14 +1,12 @@ package com.elisis.gtnhlanth.common.register; -import com.github.bartimaeusnek.bartworks.system.material.Werkstoff; -import com.github.bartimaeusnek.bartworks.util.Pair; - -import static gregtech.api.enums.Materials.*; -import static gregtech.api.enums.TextureSet.*; - import static com.github.bartimaeusnek.bartworks.system.material.Werkstoff.Types.*; import static com.github.bartimaeusnek.bartworks.util.BW_Util.subscriptNumbers; +import static gregtech.api.enums.Materials.*; +import static gregtech.api.enums.TextureSet.*; +import com.github.bartimaeusnek.bartworks.system.material.Werkstoff; +import com.github.bartimaeusnek.bartworks.util.Pair; /* * @@ -18,20 +16,19 @@ import static com.github.bartimaeusnek.bartworks.util.BW_Util.subscriptNumbers; @SuppressWarnings("unchecked") public class BotWerkstoffMaterialPool implements Runnable { - public static final Werkstoff TungsticAcid = new Werkstoff( - new short[]{0xf5, 0xf1, 0x16}, + public static final Werkstoff TungsticAcid = new Werkstoff( + new short[] |
