diff options
author | Raven Szewczyk <git@eigenraven.me> | 2023-02-10 14:32:09 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-10 14:32:09 +0000 |
commit | ce3825fdbc4bacb5efe6cf18a445719c02b53fa4 (patch) | |
tree | 46d81e34516b2cc044653d97c2b426f70fb11d20 | |
parent | f069e4fa8875869cc07a7613e593903aa1a51d50 (diff) | |
download | GT5-Unofficial-ce3825fdbc4bacb5efe6cf18a445719c02b53fa4.tar.gz GT5-Unofficial-ce3825fdbc4bacb5efe6cf18a445719c02b53fa4.tar.bz2 GT5-Unofficial-ce3825fdbc4bacb5efe6cf18a445719c02b53fa4.zip |
Rfg cleanup (#1726)
* Update buildscript, add all recently added gradle.properties entries
* Dependency version bumps and cleanup
* Bump eternal singularity version
* Update buildscript
* Make AE2 a required dependency
* Switch version to class generation from token replacement
17 files changed, 356 insertions, 249 deletions
diff --git a/build.gradle b/build.gradle index 447de38414..b808930520 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1675268365 +//version: 1676031737 /* DO NOT CHANGE THIS FILE! Also, you may replace this file at any time if there is an update available. @@ -9,11 +9,15 @@ import com.diffplug.blowdryer.Blowdryer import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar +import com.gtnewhorizons.retrofuturagradle.ObfuscationAttribute import com.gtnewhorizons.retrofuturagradle.mcp.ReobfuscatedJar +import com.gtnewhorizons.retrofuturagradle.minecraft.RunMinecraftTask import com.matthewprenger.cursegradle.CurseArtifact import com.matthewprenger.cursegradle.CurseRelation import com.modrinth.minotaur.dependencies.ModDependency import com.modrinth.minotaur.dependencies.VersionDependency +import cpw.mods.fml.relauncher.Side +import org.gradle.api.tasks.options.Option; import org.gradle.internal.logging.text.StyledTextOutput.Style import org.gradle.internal.logging.text.StyledTextOutputFactory import org.jetbrains.gradle.ext.* @@ -23,6 +27,7 @@ import java.nio.file.Paths import java.util.concurrent.TimeUnit import java.util.zip.ZipEntry import java.util.zip.ZipOutputStream +import javax.inject.Inject buildscript { repositories { @@ -66,7 +71,7 @@ plugins { id 'com.diffplug.spotless' version '6.7.2' apply false id 'com.modrinth.minotaur' version '2.+' apply false id 'com.matthewprenger.cursegradle' version '1.4.0' apply false - id 'com.gtnewhorizons.retrofuturagradle' version '1.1.4' + id 'com.gtnewhorizons.retrofuturagradle' version '1.1.6' } boolean settingsupdated = verifySettingsGradle() settingsupdated = verifyGitAttributes() || settingsupdated @@ -186,11 +191,21 @@ configurations { } if (enableModernJavaSyntax.toBoolean()) { + repositories { + mavenCentral { + mavenContent { + includeGroup("me.eigenraven.java8unsupported") + } + } + } + dependencies { annotationProcessor 'com.github.bsideup.jabel:jabel-javac-plugin:1.0.0' compileOnly('com.github.bsideup.jabel:jabel-javac-plugin:1.0.0') { transitive = false // We only care about the 1 annotation class } + // Allow using jdk.unsupported classes like sun.misc.Unsafe in the compiled code, working around JDK-8206937. + patchedMinecraft('me.eigenraven.java8unsupported:java-8-unsupported-shim:1.0.0') } tasks.withType(JavaCompile).configureEach { @@ -401,6 +416,16 @@ configurations.configureEach { } } } + def obfuscationAttr = it.attributes.getAttribute(ObfuscationAttribute.OBFUSCATION_ATTRIBUTE) + if (obfuscationAttr != null && obfuscationAttr.name == ObfuscationAttribute.SRG) { + resolutionStrategy.eachDependency { DependencyResolveDetails details -> + // Remap CoFH core cursemaven dev jar to the obfuscated version for runObfClient/Server + if (details.requested.group == 'curse.maven' && details.requested.name.endsWith('-69162') && details.requested.version == '2388751') { + details.useVersion '2388750' + details.because 'Pick obfuscated jar' + } + } + } } // Ensure tests have access to minecraft classes @@ -520,20 +545,20 @@ dependencies { annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3') annotationProcessor('com.google.guava:guava:24.1.1-jre') annotationProcessor('com.google.code.gson:gson:2.8.6') - annotationProcessor('com.gtnewhorizon:gtnhmixins:2.1.10:processor') + annotationProcessor('com.gtnewhorizon:gtnhmixins:2.1.12:processor') if (usesMixinDebug.toBoolean()) { runtimeOnlyNonPublishable('org.jetbrains:intellij-fernflower:1.2.1.16') } } if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) { - implementation('com.gtnewhorizon:gtnhmixins:2.1.10') + implementation('com.gtnewhorizon:gtnhmixins:2.1.12') } } pluginManager.withPlugin('org.jetbrains.kotlin.kapt') { if (usesMixins.toBoolean()) { dependencies { - kapt('com.gtnewhorizon:gtnhmixins:2.1.10:processor') + kapt('com.gtnewhorizon:gtnhmixins:2.1.12:processor') } } } @@ -633,9 +658,142 @@ tasks.named("processResources", ProcessResources).configure { if (usesMixins.toBoolean()) { from refMap + dependsOn("compileJava", "compileScala") + } +} + +ext.java17Toolchain = (JavaToolchainSpec spec) -> { + spec.languageVersion.set(JavaLanguageVersion.of(17)) + spec.vendor.set(JvmVendorSpec.matching("jetbrains")) +} + +ext.java17DependenciesCfg = configurations.create("java17Dependencies") +ext.java17PatchDependenciesCfg = configurations.create("java17PatchDependencies") + +dependencies { + def lwjgl3ifyVersion = '1.1.21' + def asmVersion = '9.4' + if (modId != 'lwjgl3ify') { + java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}") + } + if (modId != 'hodgepodge') { + java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.0.31') + } + + java17PatchDependencies('net.minecraft:launchwrapper:1.15') {transitive = false} + java17PatchDependencies("org.ow2.asm:asm:${asmVersion}") + java17PatchDependencies("org.ow2.asm:asm-commons:${asmVersion}") + java17PatchDependencies("org.ow2.asm:asm-tree:${asmVersion}") + java17PatchDependencies("org.ow2.asm:asm-analysis:${asmVersion}") + java17PatchDependencies("org.ow2.asm:asm-util:${asmVersion}") + java17PatchDependencies('org.ow2.asm:asm-deprecated:7.1') + java17PatchDependencies("org.apache.commons:commons-lang3:3.12.0") + java17PatchDependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}:forgePatches") +} + +ext.java17JvmArgs = [ + // Java 9+ support + "--illegal-access=warn", + "-Dfile.encoding=UTF-8", + "-Djava.security.manager=allow", + "--add-opens", "java.base/jdk.internal.loader=ALL-UNNAMED", + "--add-opens", "java.base/java.net=ALL-UNNAMED", + "--add-opens", "java.base/java.nio=ALL-UNNAMED", + "--add-opens", "java.base/java.io=ALL-UNNAMED", + "--add-opens", "java.base/java.lang=ALL-UNNAMED", + "--add-opens", "java.base/java.lang.reflect=ALL-UNNAMED", + "--add-opens", "java.base/java.text=ALL-UNNAMED", + "--add-opens", "java.base/java.util=ALL-UNNAMED", + "--add-opens", "java.base/jdk.internal.reflect=ALL-UNNAMED", + "--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED", + "--add-opens", "java.desktop/sun.awt.image=ALL-UNNAMED", + "--add-modules", "jdk.dynalink", + "--add-opens", "jdk.dynalink/jdk.dynalink.beans=ALL-UNNAMED", + "--add-modules", "java.sql.rowset", + "--add-opens", "java.sql.rowset/javax.sql.rowset.serial=ALL-UNNAMED" +] + +ext.hotswapJvmArgs = [ + // DCEVM advanced hot reload + "-XX:+AllowEnhancedClassRedefinition", + "-XX:HotswapAgent=fatjar" +] + +ext.setupHotswapAgentTask = tasks.register("setupHotswapAgent") { + group = "GTNH Buildscript" + description = "Installs a recent version of HotSwapAgent into the Java 17 JetBrains runtime directory" + def hsaUrl = 'https://github.com/HotswapProjects/HotswapAgent/releases/download/1.4.2-SNAPSHOT/hotswap-agent-1.4.2-SNAPSHOT.jar' + def targetFolderProvider = javaToolchains.launcherFor(java17Toolchain).map {it.metadata.installationPath.dir("lib/hotswap")} + def targetFilename = "hotswap-agent.jar" + onlyIf { + !targetFolderProvider.get().file(targetFilename).asFile.exists() + } + doLast { + def targetFolder = targetFolderProvider.get() + targetFolder.asFile.mkdirs() + download.run { + src hsaUrl + dest targetFolder.file(targetFilename).asFile + overwrite false + tempAndMove true + } + } +} + +public abstract class RunHotswappableMinecraftTask extends RunMinecraftTask { + // IntelliJ doesn't seem to allow commandline arguments so we also support an env variable + private boolean enableHotswap = Boolean.valueOf(System.getenv("HOTSWAP")); + + @Input + public boolean getEnableHotswap() { return enableHotswap } + @Option(option = "hotswap", description = "Enables HotSwapAgent for enhanced class reloading under a debugger") + public boolean setEnableHotswap(boolean enable) { enableHotswap = enable } + + @Inject + public RunHotswappableMinecraftTask(Side side, String superTask) { + super(side) + + this.lwjglVersion = 3 + this.javaLauncher = project.javaToolchains.launcherFor(project.java17Toolchain) + this.extraJvmArgs.addAll(project.java17JvmArgs) + this.extraJvmArgs.addAll(project.provider(() -> enableHotswap ? project.hotswapJvmArgs : [])) + + this.classpath(project.java17PatchDependenciesCfg) + if (side == Side.CLIENT) { + this.classpath(project.minecraftTasks.lwjgl3Configuration) + } + // Use a raw provider instead of map to not create a dependency on the task + this.classpath(project.provider(() -> project.tasks.named(superTask, RunMinecraftTask).get().classpath)) + this.classpath.filter { file -> + !file.path.contains("2.9.4-nightly-20150209") // Remove lwjgl2 + } + this.classpath(project.java17DependenciesCfg) + + if (!(project.usesMixins.toBoolean() || project.forceEnableMixins.toBoolean())) { + this.extraArgs.addAll("--tweakClass", "org.spongepowered.asm.launch.MixinTweaker") + } } } +def runClient17Task = tasks.register("runClient17", RunHotswappableMinecraftTask, Side.CLIENT, "runClient") +runClient17Task.configure { + setup(project) + group = "Modded Minecraft" + description = "Runs the modded client using Java 17, lwjgl3ify and Hodgepodge" + dependsOn(setupHotswapAgentTask, mcpTasks.launcherSources.classesTaskName, minecraftTasks.taskDownloadVanillaAssets, mcpTasks.taskPackagePatchedMc, 'jar') + mainClass = "GradleStart" +} + +def runServer17Task = tasks.register("runServer17", RunHotswappableMinecraftTask, Side.SERVER, "runServer") +runServer17Task.configure { + setup(project) + group = "Modded Minecraft" + description = "Runs the modded server using Java 17, lwjgl3ify and Hodgepodge" + dependsOn(setupHotswapAgentTask, mcpTasks.launcherSources.classesTaskName, minecraftTasks.taskDownloadVanillaAssets, mcpTasks.taskPackagePatchedMc, 'jar') + mainClass = "GradleStartServer" + extraArgs.add("nogui") +} + def getManifestAttributes() { def manifestAttributes = [:] if (!containsMixinsAndOrCoreModOnly.toBoolean() && (usesMixins.toBoolean() || coreModClass)) { @@ -705,7 +863,7 @@ if (usesShadowedDependencies.toBoolean()) { javaComponent.withVariantsFromConfiguration(configurations.shadowRuntimeElements) { skip() } - for (runTask in ["runClient", "runServer"]) { + for (runTask in ["runClient", "runServer", "runClient17", "runServer17"]) { tasks.named(runTask).configure { dependsOn("shadowJar") } @@ -754,6 +912,20 @@ idea { "2. Run Server"(Gradle) { taskNames = ["runServer"] } + "1a. Run Client (Java 17)"(Gradle) { + taskNames = ["runClient17"] + } + "2a. Run Server (Java 17)"(Gradle) { + taskNames = ["runServer17"] + } + "1b. Run Client (Java 17, Hotswap)"(Gradle) { + taskNames = ["runClient17"] + envs = ["HOTSWAP": "true"] + } + "2b. Run Server (Java 17, Hotswap)"(Gradle) { + taskNames = ["runServer17"] + envs = ["HOTSWAP": "true"] + } "3. Run Obfuscated Client"(Gradle) { taskNames = ["runObfClient"] } diff --git a/dependencies.gradle b/dependencies.gradle index 7353113def..418d3f99d1 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,79 +1,58 @@ -// NOTE: Using explicit tags now instead of master-SNAPSHOT. (READ: Don't use master-SNAPSHOT anymore!!!) -// That means if you are depending on a change in a dependency, you need to tag the dependency -// and update the pinned tag here. This _should_ allow for more reproducible historical builds, while -// also being more explicit about what is depended on. - +/* + * Add your dependencies here. Supported configurations: + * - api("group:name:version:classifier"): if you use the types from this dependency in the public API of this mod + * Available at runtime and compiletime for mods depending on this mod + * - implementation("g:n:v:c"): if you need this for internal implementation details of the mod, but none of it is visible via the public API + * Available at runtime but not compiletime for mods depending on this mod + * - compileOnly("g:n:v:c"): if the mod you're building doesn't need this dependency during runtime at all, e.g. for optional mods + * Not available at all for mods depending on this mod, only visible at compiletime for this mod + * - runtimeOnly("g:n:v:c"): if you don't need this at compile time, but want it to be present at runtime + * Available at runtime for mods depending on this mod + * - annotationProcessor("g:n:v:c"): mostly for java compiler plugins, if you know you need this, use it, otherwise don't worry + * - testCONFIG("g:n:v:c") - replace CONFIG by one of the above (except api), same as above but for the test sources instead of main + * + * - shadowImplementation("g:n:v:c"): effectively the same as API, but the dependency is included in your jar under a renamed package name + * Requires you to enable usesShadowedDependencies in gradle.properties + * + * - compile("g:n:v:c"): deprecated, replace with "api" (works like the old "compile") or "implementation" (can be more efficient) + * + * You can exclude transitive dependencies (dependencies of the chosen dependency) by appending { transitive = false } if needed, + * but use this sparingly as it can break using your mod as another mod's dependency if you're not careful. + * + * For more details, see https://docs.gradle.org/7.6/userguide/java_library_plugin.html#sec:java_library_configurations_graph + */ dependencies { - compile("com.github.GTNewHorizons:StructureLib:1.2.1:dev") + api("com.github.GTNewHorizons:StructureLib:1.2.1:dev") + + api("com.github.GTNewHorizons:NotEnoughItems:2.3.28-GTNH:dev") + api("com.github.GTNewHorizons:GTNHLib:0.0.12:dev") + api("com.github.GTNewHorizons:ModularUI:1.0.60:dev") + api("com.github.GTNewHorizons:waila:1.5.23:dev") + api("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-155-GTNH:dev") + implementation("com.github.GTNewHorizons:Eternal-Singularity:1.0.10:dev") - compile("com.github.GTNewHorizons:NotEnoughItems:2.3.24-GTNH:dev") - compile("com.github.GTNewHorizons:CodeChickenLib:1.1.5.7:dev") - compile("com.github.GTNewHorizons:GTNHLib:0.0.11:dev") - compile("com.github.GTNewHorizons:ModularUI:1.0.56:dev") - compile("com.github.GTNewHorizons:waila:1.5.22:dev") - compile("com.github.GTNewHorizons:Eternal-Singularity:1.0.8:dev") + api("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev") - compile("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev") + compileOnly("com.github.GTNewHorizons:EnderCore:0.2.12:dev") { transitive = false } + compileOnly("com.github.GTNewHorizons:ForestryMC:4.5.6:dev") { transitive = false } + compileOnly("com.github.GTNewHorizons:gendustry:1.6.5.5-GTNH:dev") { transitive = false } + compileOnly("com.github.GTNewHorizons:Railcraft:9.13.18:dev") { transitive = false } + compileOnly("com.github.GTNewHorizons:Galacticraft:3.0.65-GTNH:dev") { transitive = false } + compileOnly("com.github.GTNewHorizons:AppleCore:3.2.10:dev") { transitive = false } + compileOnly("com.github.GTNewHorizons:TinkersConstruct:1.9.19-GTNH:dev") { transitive = false } + compileOnly("com.github.GTNewHorizons:Chisel:2.10.17-GTNH:dev") { transitive = false } + compileOnly("com.github.GTNewHorizons:EnderIO:2.3.1.57:dev") { transitive = false } + compileOnly("com.github.GTNewHorizons:BuildCraft:7.1.28:dev") { transitive = false } + compileOnly("com.github.GTNewHorizons:Translocators:1.1.2.21:dev") { transitive = false } + compileOnly("curse.maven:cofh-core-69162:2388751") { transitive = false } + compileOnly("com.github.GTNewHorizons:Nuclear-Control:2.4.16:dev") { transitive = false } + compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") { transitive = false } + compileOnly("com.github.GTNewHorizons:Avaritia:1.31:dev") { transitive = false } + compileOnly("com.github.GTNewHorizons:ProjectRed:4.7.9-GTNH:dev") { transitive = false } - compileOnly("com.github.GTNewHorizons:EnderCore:0.2.12:dev") { - transitive = false - } - compileOnly("com.github.GTNewHorizons:ForestryMC:4.5.6:dev") { - transitive = false - } - compileOnly("com.github.GTNewHorizons:gendustry:1.6.5.5-GTNH:dev") { - transitive = false - } - compileOnly("com.github.GTNewHorizons:Railcraft:9.13.16:dev") { - transitive = false - } - compileOnly("com.github.GTNewHorizons:Galacticraft:3.0.64-GTNH:dev") { - transitive = false - } - compileOnly("com.github.GTNewHorizons:AppleCore:3.2.8:dev") { - transitive = false - } - compileOnly("com.github.GTNewHorizons:TinkersConstruct:1.9.16-GTNH:dev") { - transitive = false - } - compile("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-152-GTNH:dev") { - transitive = false - } - compile("com.github.GTNewHorizons:Chisel:2.10.16-GTNH:dev") { - transitive = false - } - compileOnly("com.github.GTNewHorizons:EnderIO:2.3.1.54:dev") { - transitive = false - } - compileOnly("com.github.GTNewHorizons:BuildCraft:7.1.28:dev") { - transitive = false - } - compileOnly("commons-io:commons-io:2.4") { - transitive = false - } - compileOnly("com.github.GTNewHorizons:Translocators:1.1.2.20:dev") { - transitive = false - } - compileOnly("curse.maven:cofh-core-69162:2388751") { - transitive = false - } - compileOnly("com.github.GTNewHorizons:Nuclear-Control:2.4.16:dev") { - transitive = false - } - compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") { - transitive = false - } - compileOnly("com.github.GTNewHorizons:Avaritia:1.31:dev") { - transitive = false - } - compileOnly("com.github.GTNewHorizons:ProjectRed:4.7.9-GTNH:dev") { - transitive = false - } - compileOnly("com.google.auto.value:auto-value-annotations:1.9") { - transitive = false - } - annotationProcessor("com.google.auto.value:auto-value:1.9") + compileOnly("com.google.auto.value:auto-value-annotations:1.10.1") { transitive = false } + annotationProcessor("com.google.auto.value:auto-value:1.10.1") - testImplementation(platform('org.junit:junit-bom:5.8.2')) + testImplementation(platform('org.junit:junit-bom:5.9.2')) testImplementation('org.junit.jupiter:junit-jupiter') } diff --git a/gradle.properties b/gradle.properties index 028ed36c1c..a478e626d1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,35 +15,56 @@ autoUpdateBuildScript = false minecraftVersion = 1.7.10 forgeVersion = 10.13.4.1614 +# Specify a MCP channel and mappings version for dependency deobfuscation and the deobfParams task. +channel = stable +mappingsVersion = 12 + +# Define other MCP mappings for dependency deobfuscation +remoteMappings = https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/ + # Select a username for testing your mod with breakpoints. You may leave this empty for a random username each time you # restart Minecraft in development. Choose this dependent on your mod: # Do you need consistent player progressing (for example Thaumcraft)? -> Select a name # Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty developmentEnvironmentUserName = Developer -# Define a source file of your project with: +# Enables using modern java syntax (up to version 17) via Jabel, while still targetting JVM 8. +# See https://github.com/bsideup/jabel for details on how this works. +enableModernJavaSyntax = false + +# Enables injecting missing generics into the decompiled source code for a better coding experience +# Turns most publically visible List, Map, etc. into proper List<Type>, Map<K, V> types +enableGenericInjection = false + + +# Generate a class with String fields for the mod id, name, version and group name named with the fields below +generateGradleTokenClass = gregtech.GT_Version +gradleTokenModId = +gradleTokenModName = +gradleTokenVersion = VERSION +gradleTokenGroupName = +# [DEPRECATED] +# Multiple source files can be defined here by providing a comma-seperated list: Class1.java,Class2.java,Class3.java # public static final String VERSION = "GRADLETOKEN_VERSION"; # The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's # version in @Mod([...], version = VERSION, [...]) # Leave these properties empty to skip individual token replacements -replaceGradleTokenInFile = GT_Mod.java -gradleTokenModId = -gradleTokenModName = -gradleTokenVersion = GRADLETOKEN_VERSION -gradleTokenGroupName = +replaceGradleTokenInFile = # In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can # leave this property empty. # Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api apiPackage = -# Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/ +# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/ # Example value: mymodid_at.cfg accessTransformersFile = # Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled! usesMixins = false -# Specify the location of your implementation of IMixinPlugin. Leave it empty otherwise. +# Adds some debug arguments like verbose output and export +usesMixinDebug = false +# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise. mixinPlugin = # Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail! mixinsPackage = @@ -55,9 +76,60 @@ coreModClass = # that is annotated with @Mod) you want this to be true. When in doubt: leave it on false! containsMixinsAndOrCoreModOnly = false -# If enabled, you may use 'shadowImplementation' for dependencies. They will be integrated in your jar. It is your +# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins. +forceEnableMixins = true + +# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated in your jar. It is your # responsibility check the licence and request permission for distribution, if required. usesShadowedDependencies = false +# If disabled, won't remove unused classes from shaded dependencies. Some libraries use reflection to access +# their own classes, making the minimization unreliable. +minimizeShadowedDependencies = true +# If disabled, won't rename the shadowed classes. +relocateShadowedDependencies = true -# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins. -forceEnableMixins = true +# Adds the GTNH maven, CurseMaven, IC2/Player maven, and some more well-known 1.7.10 repositories +includeWellKnownRepositories = true + +# Publishing to modrinth requires you to set the MODRINTH_TOKEN environment variable to your current modrinth API token. + +# The project's ID on Modrinth. Can be either the slug or the ID. +# Leave this empty if you don't want to publish on Modrinth. +modrinthProjectId = + +# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth. +# Syntax: scope1-type1:name1;scope2-type2:name2;... +# Where scope can be one of [required, optional, incompatible, embedded], +# type can be one of [project, version], +# and the name is the Modrinth project or version slug/id of the other mod. +# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech +# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true +modrinthRelations = + + +# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens. + +# The project's numeric ID on CurseForge. You can find this in the About Project box. +# Leave this empty if you don't want to publish on CurseForge. +curseForgeProjectId = + +# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge. +# Syntax: type1:name1;type2:name2;... +# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible], +# and the name is the CurseForge project slug of the other mod. +# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft +# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true +curseForgeRelations = + + +# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older +# projects. New projects should not use this parameter. +# customArchiveBaseName = + +# Optional parameter to prevent the source code from being published +# noPublishedSources = + +# Uncomment this to disable spotless checks +# This should only be uncommented to keep it easier to sync with upstream/other forks. +# That is, if there is no other active fork/upstream, NEVER change this. +# disableSpotless = true diff --git a/repositories.gradle b/repositories.gradle index 8c26061aab..c227b16ec2 100644 --- a/repositories.gradle +++ b/repositories.gradle @@ -1,32 +1,4 @@ // Add any additional repositories for your dependencies here repositories { - mavenLocal() - maven { - name = "GTNH" - url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/" - } - maven { - name = "ic2" - url = "https://maven.ic2.player.to/" - metadataSources { - mavenPom() - artifact() - } - } - maven { - name = "ic2" - url = "https://maven2.ic2.player.to/" - metadataSources { - mavenPom() - artifact() - } - } - maven { - url "https://cursemaven.com" - } - maven { - name = "jitpack.io" - url = "https://jitpack.io" - } } diff --git a/src/main/java/gregtech/GT_Mod.java b/src/main/java/gregtech/GT_Mod.java index 14ff8b2c2d..33c02f37dd 100644 --- a/src/main/java/gregtech/GT_Mod.java +++ b/src/main/java/gregtech/GT_Mod.java @@ -111,7 +111,7 @@ import ic2.api.recipe.RecipeOutput; + " after:PFAAGeologica;" + " after:Thaumcraft;" + " after:Railcraft;" - + " after:appliedenergistics2;" + + " required-after:appliedenergistics2;" + " after:ThermalExpansion;" + " after:TwilightForest;" + " after:harvestcraft;" diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java index d8a512c954..8cf45d1984 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java @@ -49,7 +49,6 @@ import com.gtnewhorizon.structurelib.alignment.IAlignmentProvider; import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; import com.gtnewhorizon.structurelib.alignment.constructable.IConstructableProvider; -import cpw.mods.fml.common.Optional; import cpw.mods.fml.relauncher.ReflectionHelper; import gregtech.GT_Mod; import gregtech.api.GregTech_API; @@ -80,16 +79,6 @@ import ic2.api.Direction; * <p/> * This is the main TileEntity for EVERYTHING. */ -@Optional.InterfaceList( - value = { - @Optional.Interface( - iface = "appeng.api.networking.security.IActionHost", - modid = "appliedenergistics2", - striprefs = true), - @Optional.Interface( - iface = "appeng.me.helpers.IGridProxyable", - modid = "appliedenergistics2", - striprefs = true) }) public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTechTileEntity, IActionHost, IGridProxyable, IAlignmentProvider, IConstructableProvider, IDebugableTileEntity, IGregtechWailaProvider { @@ -2329,7 +2318,6 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec } @Override - @Optional.Method(modid = "appliedenergistics2") public IGridNode getGridNode(ForgeDirection forgeDirection) { if (mFacing != forgeDirection.ordinal()) return null; final AENetworkProxy gp = getProxy(); @@ -2337,61 +2325,51 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec } @Override - @Optional.Method(modid = "appliedenergistics2") public AECableType getCableConnectionType(ForgeDirection forgeDirection) { return mMetaTileEntity == null ? AECableType.NONE : mMetaTileEntity.getCableConnectionType(forgeDirection); } @Override - @Optional.Method(modid = "appliedenergistics2") public void securityBreak() {} @Override - @Optional.Method(modid = "appliedenergistics2") public IGridNode getActionableNode() { final AENetworkProxy gp = getProxy(); return gp != null ? gp.getNode() : null; } @Override - @Optional.Method(modid = "appliedenergistics2") public AENetworkProxy getProxy() { return mMetaTileEntity == null ? null : mMetaTileEntity.getProxy(); } @Override - @Optional.Method(modid = "appliedenergistics2") public DimensionalCoord getLocation() { return new DimensionalCoord(this); } @Override - @Optional.Method(modid = "appliedenergistics2") public void gridChanged() { if (mMetaTileEntity != null) mMetaTileEntity.gridChanged(); } @TileEvent(TileEventType.WORLD_NBT_READ) - @Optional.Method(modid = "appliedenergistics2") public void readFromNBT_AENetwork(final NBTTagCompound data) { final AENetworkProxy gp = getProxy(); if (gp != null) getProxy().readFromNBT(data); } @TileEvent(TileEventType.WORLD_NBT_WRITE) - @Optional.Method(modid = "appliedenergistics2") public void writeToNBT_AENetwork(final NBTTagCompound data) { final AENetworkProxy gp = getProxy(); if (gp != null) gp.writeToNBT(data); } - @Optional.Method(modid = "appliedenergistics2") void onChunkUnloadAE() { final AENetworkProxy gp = getProxy(); if (gp != null) gp.onChunkUnload(); } - @Optional.Method(modid = "appliedenergistics2") void invalidateAE() { final AENetworkProxy gp = getProxy(); if (gp != null) gp.invalidate(); diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java index 64bc531947..26caeaa416 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java @@ -39,8 +39,6 @@ import appeng.me.helpers.AENetworkProxy; import com.gtnewhorizons.modularui.api.forge.ItemStackHandler; -import cpw.mods.fml.common.Loader; -import cpw.mods.fml.common.Optional; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gnu.trove.list.TIntList; @@ -151,7 +149,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac /** * This method will only be called on client side - * + * * @return whether the secondary description should be display. default is false */ @Deprecated @@ -1164,17 +1162,14 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac // === AE2 compat === - @Optional.Method(modid = "appliedenergistics2") public AECableType getCableConnectionType(ForgeDirection forgeDirection) { return AECableType.NONE; } - @Optional.Method(modid = "appliedenergistics2") public AENetworkProxy getProxy() { return null; } - @Optional.Method(modid = "appliedenergistics2") public void gridChanged() {} // === Waila compat === @@ -1187,7 +1182,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac "Facing: %s", ForgeDirection.getOrientation(mBaseMetaTileEntity.getFrontFacing()).name())); - if (Loader.isModLoaded("appliedenergistics2") && this instanceof IPowerChannelState) { + if (this instanceof IPowerChannelState) { // adapted from PowerStateWailaDataProvider final IPowerChannelState state = (IPowerChannelState) this; NBTTagCompound tag = accessor.getNBTData(); @@ -1210,7 +1205,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac @Override public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, int z) { - if (Loader.isModLoaded("appliedenergistics2") && this instanceof IPowerChannelState) { + if (this instanceof IPowerChannelState) { // adapted from PowerStateWailaDataProvider final IPowerChannelState state = (IPowerChannelState) this; final boolean isActive = state.isActive(); @@ -1222,7 +1217,6 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac } } - @Optional.Method(modid = "appliedenergistics2") protected String getAEDiagnostics() { try { if (getProxy() == null) return "(proxy)"; diff --git a/src/main/java/gregtech/api/multitileentity/MultiTileEntityBlock.java b/src/main/java/gregtech/api/multitileentity/MultiTileEntityBlock.java index 99dd459fb8..8eddd5980b 100644 --- a/src/main/java/gregtech/api/multitileentity/MultiTileEntityBlock.java +++ b/src/main/java/gregtech/api/multitileentity/MultiTileEntityBlock.java @@ -41,6 +41,7 @@ import net.minecraftforge.event.ForgeEventFactory; import com.cricketcraft.chisel.api.IFacade; +import cpw.mods.fml.common.Optional; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -74,6 +75,7 @@ import gregtech.common.render.IRenderedBlock; /* * MultiTileEntityBlock ported from GT6 */ +@Optional.Interface(iface = "com.cricketcraft.chisel.api.IFacade", modid = "ChiselAPI") public class MultiTileEntityBlock extends Block implements IDebugableBlock, ITileEntityProvider, IRenderedBlock, IFacade { diff --git a/src/main/java/gregtech/api/objects/AE2DigitalChestHandler.java b/src/main/java/gregtech/api/objects/AE2DigitalChestHandler.java index 3294af2fd0..06ab3788b3 100644 --- a/src/main/java/gregtech/api/objects/AE2DigitalChestHandler.java +++ b/src/main/java/gregtech/api/objects/AE2DigitalChestHandler.java @@ -3,18 +3,12 @@ package gregtech.api.objects; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; -import cpw.mods.fml.common.Optional; import gregtech.api.metatileentity.BaseMetaTileEntity; import gregtech.common.tileentities.storage.GT_MetaTileEntity_DigitalChestBase; -@Optional.Interface( - iface = "appeng.api.storage.IExternalStorageHandler", - modid = "appliedenergistics2", - striprefs = true) public class AE2DigitalChestHandler implements appeng.api.storage.IExternalStorageHandler { @Override - @Optional.Method(modid = "appliedenergistics2") public boolean canHandle(final TileEntity te, final ForgeDirection d, final appeng.api.storage.StorageChannel chan, final appeng.api.networking.security.BaseActionSource mySrc) { return chan == appeng.api.storage.StorageChannel.ITEMS && te instanceof BaseMetaTileEntity @@ -22,7 +16,6 @@ public class AE2DigitalChestHandler implements appeng.api.storage.IExternalStora } @Override - @Optional.Method(modid = "appliedenergistics2") public appeng.api.storage.IMEInventory getInventory(final TileEntity te, final ForgeDirection d, final appeng.api.storage.StorageChannel chan, final appeng.api.networking.security.BaseActionSource src) { if (chan == appeng.api.storage.StorageChannel.ITEMS) { diff --git a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_InputBus_ME.java b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_InputBus_ME.java index cac1ef936e..bc2ad3f94f 100644 --- a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_InputBus_ME.java +++ b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_InputBus_ME.java @@ -30,7 +30,6 @@ import com.gtnewhorizons.modularui.common.widget.DrawableWidget; import com.gtnewhorizons.modularui.common.widget.SlotGroup; import com.gtnewhorizons.modularui.common.widget.SlotWidget; -import cpw.mods.fml.common.Optional; import gregtech.api.GregTech_API; import gregtech.api.enums.ItemList; import gregtech.api.gui.modularui.GT_UITextures; @@ -45,7 +44,6 @@ import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Utility; import gregtech.common.gui.modularui.widget.AESlotWidget; -@Optional.Interface(iface = "appeng.api.implementations.IPowerChannelState", modid = "appliedenergistics2") public class GT_MetaTileEntity_Hatch_InputBus_ME extends GT_MetaTileEntity_Hatch_InputBus implements IConfigurationCircuitSupport, IAddGregtechLogo, IAddUIWidgets, IPowerChannelState { @@ -96,13 +94,11 @@ public class GT_MetaTileEntity_Hatch_InputBus_ME extends GT_MetaTileEntity_Hatch } @Override - @Optional.Method(modid = "appliedenergistics2") public AECableType getCableConnectionType(ForgeDirection forgeDirection) { return isOutputFacing((byte) forgeDirection.ordinal()) ? AECableType.SMART : AECableType.NONE; } @Override - @Optional.Method(modid = "appliedenergistics2") public AENetworkProxy getProxy() { if (gridProxy == null) { if (getBaseMetaTileEntity() instanceof IGridProxyable) { @@ -121,17 +117,14 @@ public class GT_MetaTileEntity_Hatch_InputBus_ME extends GT_MetaTileEntity_Hatch } @Override - @Optional.Method(modid = "appliedenergistics2") public void gridChanged() {} @Override - @Optional.Method(modid = "appliedenergistics2") public boolean isPowered() { return getProxy() != null && getProxy().isPowered(); } @Override - @Optional.Method(modid = "appliedenergistics2") public boolean isActive() { return getProxy() != null && getProxy().isActive(); } @@ -256,7 +249,6 @@ public class GT_MetaTileEntity_Hatch_InputBus_ME extends GT_MetaTileEntity_Hatch return mInventory[aIndex]; } - @Optional.Method(modid = "appliedenergistics2") private BaseActionSource getRequestSource() { if (requestSource == null) requestSource = new MachineSource((IActionHost) getBaseMetaTileEntity()); return requestSource; diff --git a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java index 6099473660..3e802b6304 100644 --- a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java +++ b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java @@ -31,7 +31,6 @@ import appeng.me.helpers.IGridProxyable; import appeng.util.IWideReadableNumberConverter; import appeng.util.Platform; import appeng.util.ReadableNumberConverter; -import cpw.mods.fml.common.Optional; import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; @@ -43,7 +42,6 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Outpu import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Utility; -@Optional.Interface(iface = "appeng.api.implementations.IPowerChannelState", modid = "appliedenergistics2") public class GT_MetaTileEntity_Hatch_OutputBus_ME extends GT_MetaTileEntity_Hatch_OutputBus implements IPowerChannelState { @@ -104,21 +102,18 @@ public class GT_MetaTileEntity_Hatch_OutputBus_ME extends GT_MetaTileEntity_Hatc * @param stack input stack * @return amount of items left over */ - @Optional.Method(modid = "appliedenergistics2") public int store(final ItemStack stack) { if (!infiniteCache && lastOutputFailed) return stack.stackSize; itemCache.add(AEApi.instance().storage().createItemStack(stack)); return 0; } - @Optional.Method(modid = "appliedenergistics2") private BaseActionSource getRequest() { if (requestSource == null) requestSource = new MachineSource((IActionHost) getBaseMetaTileEntity()); return requestSource; } @Override - @Optional.Method(modid = "appliedenergistics2") public AECableType getCableConnectionType(ForgeDirection forgeDirection) { return isOutputFacing((byte) forgeDirection.ordinal()) ? AECableType.SMART : AECableType.NONE; } @@ -137,7 +132,6 @@ public class GT_MetaTileEntity_Hatch_OutputBus_ME extends GT_MetaTileEntity_Hatc } @Override - @Optional.Method(modid = "appliedenergistics2") public AENetworkProxy getProxy() { if (gridProxy == null) { if (getBaseMetaTileEntity() instanceof IGridProxyable) { @@ -156,10 +150,8 @@ public class GT_MetaTileEntity_Hatch_OutputBus_ME extends GT_MetaTileEntity_Hatc } @Override - @Optional.Method(modid = "appliedenergistics2") public void gridChanged() {} - @Optional.Method(modid = "appliedenergistics2") private void flushCachedStack() { lastOutputFailed = false; AENetworkProxy proxy = getProxy(); @@ -186,13 +178,11 @@ public class GT_MetaTileEntity_Hatch_OutputBus_ME extends GT_MetaTileEntity_Hatc } @Override - @Optional.Method(modid = "appliedenergistics2") public boolean isPowered() { return getProxy() != null && getProxy().isPowered(); } @Override - @Optional.Method(modid = "appliedenergistics2") public boolean isActive() { return getProxy() != null && getProxy().isActive(); } diff --git a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_Output_ME.java b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_Output_ME.java index e60dec5c51..8ae9b395c1 100644 --- a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_Output_ME.java +++ b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_Output_ME.java @@ -36,7 +36,6 @@ import appeng.me.helpers.AENetworkProxy; import appeng.me.helpers.IGridProxyable; import appeng.util.IWideReadableNumberConverter; import appeng.util.ReadableNumberConverter; -import cpw.mods.fml.common.Optional; import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; @@ -48,7 +47,6 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Outpu import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Utility; -@Optional.Interface(iface = "appeng.api.implementations.IPowerChannelState", modid = "appliedenergistics2") public class GT_MetaTileEntity_Hatch_Output_ME extends GT_MetaTileEntity_Hatch_Output implements IPowerChannelState { private BaseActionSource requestSource = null; @@ -111,21 +109,18 @@ public class GT_MetaTileEntity_Hatch_Output_ME extends GT_MetaTileEntity_Hatch_O * @param aFluid input fluid * @return amount of fluid filled */ - @Optional.Method(modid = "appliedenergistics2") public int tryFillAE(final FluidStack aFluid) { if ((!infiniteCache && lastOutputFailed) || aFluid == null) return 0; fluidCache.add(AEApi.instance().storage().createFluidStack(aFluid)); return aFluid.amount; } - @Optional.Method(modid = "appliedenergistics2") private BaseActionSource getRequest() { if (requestSource == null) requestSource = new MachineSource((IActionHost) getBaseMetaTileEntity()); return requestSource; } @Override - @Optional.Method(modid = "appliedenergistics2") public AECableType getCableConnectionType(ForgeDirection forgeDirection) { return isOutputFacing((byte) forgeDirection.ordinal()) ? AECableType.SMART : AECableType.NONE; } @@ -159,7 +154,6 @@ public class GT_MetaTileEntity_Hatch_Output_ME extends GT_MetaTileEntity_Hatch_O } @Override - @Optional.Method(modid = "appliedenergistics2") public AENetworkProxy getProxy() { if (gridProxy == null) { if (getBaseMetaTileEntity() instanceof IGridProxyable) { @@ -178,10 +172,8 @@ public class GT_MetaTileEntity_Hatch_Output_ME extends GT_MetaTileEntity_Hatch_O } @Override - @Optional.Method(modid = "appliedenergistics2") public void gridChanged() {} - @Optional.Method(modid = "appliedenergistics2") private void flushCachedStack() { lastOutputFailed = false; AENetworkProxy proxy = getProxy(); @@ -208,13 +200,11 @@ public class GT_MetaTileEntity_Hatch_Output_ME extends GT_MetaTileEntity_Hatch_O } @Override - @Optional.Method(modid = "appliedenergistics2") public boolean isPowered() { return getProxy() != null && getProxy().isPowered(); } @Override - @Optional.Method(modid = "appliedenergistics2") public boolean isActive() { return getProxy() != null && getProxy().isActive(); } @@ -307,7 +297,6 @@ public class GT_MetaTileEntity_Hatch_Output_ME extends GT_MetaTileEntity_Hatch_O return ss.toArray(new String[fluidCache.size() + 2]); } - @Optional.Method(modid = "appliedenergistics2") public static IAEFluidStack fluidAEInsert(final IEnergySource energy, final IMEInventory<IAEFluidStack> cell, final IAEFluidStack input, final BaseActionSource src) { final IAEFluidStack possible = cell.injectItems(input.copy(), Actionable.SIMULATE, src); diff --git a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java index c40e05090b..ce434bc371 100644 --- a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java +++ b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java @@ -27,7 +27,6 @@ import com.gtnewhorizons.modularui.common.widget.DrawableWidget; import com.gtnewhorizons.modularui.common.widget.SlotWidget; import com.gtnewhorizons.modularui.common.widget.TextWidget; -import cpw.mods.fml.common.Optional; import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.gui.modularui.GT_UIInfos; @@ -40,7 +39,6 @@ import gregtech.api.objects.AE2DigitalChestHandler; import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Utility; -@Optional.Interface(iface = "appeng.api.storage.IMEMonitor", modid = "appliedenergistics2", striprefs = true) public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEntity_TieredMachineBlock implements appeng.api.storage.IMEMonitor<appeng.api.storage.data.IAEItemStack>, IAddUIWidgets { @@ -96,13 +94,11 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti super(aName, aTier, 3, aDescription, aTextures); } - @Optional.Method(modid = "appliedenergistics2") public static void registerAEIntegration() { appeng.api.AEApi.instance().registries().externalStorage() .addExternalStorageInterface(new AE2DigitalChestHandler()); } - @Optional.Method(modid = "appliedenergistics2") @Override public void addListener( appeng.api.storage.IMEMonitorHandlerReceiver<appeng.api.storage.data.IAEItemStack> imeMonitorHandlerReceiver, @@ -111,7 +107,6 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti listeners.put(imeMonitorHandlerReceiver, o); } - @Optional.Method(modid = "appliedenergistics2") @Override public void removeListener( appeng.api.storage.IMEMonitorHandlerReceiver<appeng.api.storage.data.IAEItemStack> imeMonitorHandlerReceiver) { @@ -119,13 +114,11 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti listeners.remove(imeMonitorHandlerReceiver); } - @Optional.Method(modid = "appliedenergistics2") @Override public appeng.api.config.AccessRestriction getAccess() { return appeng.api.config.AccessRestriction.READ_WRITE; } - @Optional.Method(modid = "appliedenergistics2") @Override public boolean isPrioritized(appeng.api.storage.data.IAEItemStack iaeItemStack) { ItemStack s = getItemStack(); @@ -133,7 +126,6 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti return iaeItemStack.isSameType(s); } - @Optional.Method(modid = "appliedenergistics2") @Override public boolean canAccept(appeng.api.storage.data.IAEItemStack iaeItemStack) { ItemStack s = getItemStack(); @@ -141,19 +133,16 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti return iaeItemStack.isSameType(s); } - @Optional.Method(modid = "appliedenergistics2") @Override public int getPriority() { return 0; } - @Optional.Method(modid = "appliedenergistics2") @Override public int getSlot() { return 0; } - @Optional.Method(modid = "appliedenergistics2") @Override public boolean validForPass(int i) { return true; @@ -164,7 +153,6 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti protected abstract void setItemStack(ItemStack s); @Override - @Optional.Method(modid = "appliedenergistics2") public appeng.api.storage.data.IItemList<appeng.api.storage.data.IAEItemStack> getAvailableItems( final appeng.api.storage.data.IItemList out) { ItemStack storedStack = getItemStack(); @@ -176,7 +164,6 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti return out; } - @Optional.Method(modid = "appliedenergistics2") @Override public appeng.api.storage.data.IItemList<appeng.api.storage.data.IAEItemStack> getStorageList() { appeng.api.storage.data.IItemList<appeng.api.storage.data.IAEItemStack> res = new appeng.util.item.ItemList(); @@ -205,7 +192,6 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti } @Override - @Optional.Method(modid = "appliedenergistics2") public appeng.api.storage.data.IAEItemStack injectItems(final appeng.api.storage.data.IAEItemStack input, final appeng.api.config.Actionable mode, final appeng.api.networking.security.BaseActionSource src) { final ItemStack inputStack = input.getItemStack(); @@ -234,7 +220,6 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti return null; } - @Optional.Method(modid = "appliedenergistics2") private appeng.api.storage.data.IAEItemStack createOverflowStack(long size, appeng.api.config.Actionable mode) { final appeng.api.storage.data.IAEItemStack overflow = appeng.util.item.AEItemStack.create(getItemStack()); overflow.setStackSize(size - getMaxItemCount()); @@ -243,7 +228,6 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti } @Override - @Optional.Method(modid = "appliedenergistics2") public appeng.api.storage.data.IAEItemStack extractItems(final appeng.api.storage.data.IAEItemStack request, final appeng.api.config.Actionable mode, final appeng.api.networking.security.BaseActionSource src) { if (request.isSameType(getItemStack())) { @@ -264,7 +248,6 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti } @Override - @Optional.Method(modid = "appliedenergistics2") public appeng.api.storage.StorageChannel getChannel() { return appeng.api.storage.StorageChannel.ITEMS; } @@ -416,7 +399,6 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti protected abstract String chestName(); - @Optional.Method(modid = "appliedenergistics2") private void notifyListeners(int count, ItemStack stack) { if (listeners == null) { listeners = new HashMap<>(); @@ -433,7 +415,6 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti }); } - @Optional.Method(modid = "appliedenergistics2") private boolean hasActiveMEConnection() { if (listeners == null || listeners.isEmpty()) return false; for (Map.Entry<appeng.api.storage.IMEMonitorHandlerReceiver<appeng.api.storage.data.IAEItemStack>, Object> e : listeners diff --git a/src/main/java/gregtech/loaders/misc/GT_BeeDefinition.java b/src/main/java/gregtech/loaders/misc/GT_BeeDefinition.java index 2ad9274c43..f5c4a6c707 100644 --- a/src/main/java/gregtech/loaders/misc/GT_BeeDefinition.java +++ b/src/main/java/gregtech/loaders/misc/GT_BeeDefinition.java @@ -286,8 +286,7 @@ public enum GT_BeeDefinition implements IBeeDefinition { beeSpecies.setTemperature(EnumTemperature.NORMAL); }, template -> AlleleHelper.instance.set(template, SPEED, Speed.SLOWER), dis -> { IBeeMutationCustom tMutation = dis.registerMutation(getSpecies(FORESTRY, "Hermitic"), LAPIS, 10); - if (Loader.isModLoaded("appliedenergistics2")) - tMutation.requireResource(GameRegistry.findBlock("appliedenergistics2", "tile.BlockQuartz"), 0); + tMutation.requireResource(GameRegistry.findBlock("appliedenergistics2", "tile.BlockQuartz"), 0); }), FLUIX(GT_BranchDefinition.GEM, "FluixDust", true, new Color(0xA375FF), new Color(0xB591FF), beeSpecies -> { beeSpecies.addProduct(GT_Bees.combs.getStackForType(CombType.STONE), 0.30f); @@ -296,8 +295,7 @@ public enum GT_BeeDefinition implements IBeeDefinition { beeSpecies.setTemperature(EnumTemperature.NORMAL); }, template -> AlleleHelper.instance.set(template, SPEED, Speed.SLOWER), dis -> { IBeeMutationCustom tMutation = dis.registerMutation(REDSTONE, LAPIS, 7); - if (Loader.isModLoaded("appliedenergistics2")) - tMutation.requireResource(GameRegistry.findBlock("appliedenergistics2", "tile.BlockFluix"), 0); + tMutation.requireResource(GameRegistry.findBlock("appliedenergistics2", "tile.BlockFluix"), 0); }), DIAMOND(GT_BranchDefinition.GEM, "Diamond", false, new Color(0xCCFFFF), new Color(0xA3CCCC), beeSpecies -> { beeSpecies.addProduct(GT_Bees.combs.getStackForType(CombType.STONE), 0.30f); diff --git a/src/main/java/gregtech/loaders/oreprocessing/ProcessingWire.java b/src/main/java/gregtech/loaders/oreprocessing/ProcessingWire.java index 9b136ad29b..11333e2e2c 100644 --- a/src/main/java/gregtech/loaders/oreprocessing/ProcessingWire.java +++ b/src/main/java/gregtech/loaders/oreprocessing/ProcessingWire.java @@ -8,7 +8,6 @@ import net.minecraft.item.ItemStack; import appeng.api.config.TunnelType; import appeng.core.Api; -import cpw.mods.fml.common.Optional; import gregtech.GT_Mod; import gregtech.api.enums.*; import gregtech.api.util.GT_Log; @@ -449,17 +448,14 @@ public class ProcessingWire implements gregtech.api.interfaces.IOreRecipeRegistr if (GT_Mod.gregtechproxy.mAE2Integration) setAE2Field(); } - @Optional.Method(modid = "appliedenergistics2") private static void setAE2Field() { tt = TunnelType.ME; } - @Optional.Method(modid = "appliedenergistics2") private void AE2addNewAttunement(ItemStack aStack) { Api.INSTANCE.registries().p2pTunnel().addNewAttunement(aStack, (TunnelType) tt); } - @Optional.Method(modid = "appliedenergistics2") private void AE2AddNetAttunementCable(ItemStack aStack, OrePrefixes correspondingCable, Materials aMaterial) { Api.INSTANCE.registries().p2pTunnel().addNewAttunement(aStack, (TunnelType) tt); Api.INSTANCE.registries().p2pTunnel() diff --git a/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java b/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java index 3607df541c..ca518cd4a3 100644 --- a/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java +++ b/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java @@ -35,7 +35,9 @@ public class GT_MachineRecipeLoader implements Runnable { public static final Boolean isTinkersConstructLoaded = Loader.isModLoaded("TConstruct"); public static final Boolean isHardcoreEnderExpansionLoaded = Loader.isModLoaded("HardcoreEnderExpansion"); public static final Boolean isForestryLoaded = Loader.isModLoaded(MOD_ID_FR); - public static final Boolean isAE2Loaded = Loader.isModLoaded("appliedenergistics2"); + /** @deprecated AE2 is a required dependency now */ + @Deprecated + public static final Boolean isAE2Loaded = true; @Override public void run() { diff --git a/src/main/java/gregtech/loaders/postload/recipes/ThaumcraftRecipes.java b/src/main/java/gregtech/loaders/postload/recipes/ThaumcraftRecipes.java index 8af72a84e1..a7f3ec3202 100644 --- a/src/main/java/gregtech/loaders/postload/recipes/ThaumcraftRecipes.java +++ b/src/main/java/gregtech/loaders/postload/recipes/ThaumcraftRecipes.java @@ -2,7 +2,6 @@ package gregtech.loaders.postload.recipes; import static gregtech.api.enums.GT_Values.MOD_ID_TC; import static gregtech.api.util.GT_ModHandler.getModItem; -import static gregtech.loaders.postload.GT_MachineRecipeLoader.isAE2Loaded; import static gregtech.loaders.postload.GT_MachineRecipeLoader.isThaumcraftLoaded; import java.util.Arrays; @@ -553,41 +552,39 @@ public class ThaumcraftRecipes implements Runnable { new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.IGNIS, 1L))) }); - if (isAE2Loaded) { - tKey = "GT_TRANSSKYSTONE"; - GT_LanguageManager.addStringLocalization( - GT_MachineRecipeLoader.aTextTCGTPage + tKey, - "You have discovered a way to convert obsidian to skystone.<BR><BR>Not sure why you'd want to do this, unless skystone is somehow unavailable in your world."); - GregTech_API.sThaumcraftCompat.addResearch( - tKey, - "Skystone Transmutation", - "Transformation of obsidian into skystone", - new String[] { "GT_ADVANCEDMETALLURGY" }, - "ALCHEMY", - getModItem("appliedenergistics2", "tile.BlockSkyStone", 1), - 4, - 0, - 19, - 15, - Arrays.asList( - new TC_Aspects.TC_AspectStack(TC_Aspects.METALLUM, 5L), - new TC_Aspects.TC_AspectStack(TC_Aspects.PERMUTATIO, 3L), - new TC_Aspects.TC_AspectStack(TC_Aspects.VOLATUS, 3L), - new TC_Aspects.TC_AspectStack(TC_Aspects.ALIENIS, 3L), - new TC_Aspects.TC_AspectStack(TC_Aspects.TERRA, 3L)), - null, - new Object[] { GT_MachineRecipeLoader.aTextTCGTPage + tKey, - GregTech_API.sThaumcraftCompat.addCrucibleRecipe( - tKey, - new ItemStack(Blocks.obsidian), - getModItem("appliedenergistics2", "tile.BlockSkyStone", 1), - Arrays.asList( - new TC_Aspects.TC_AspectStack(TC_Aspects.PERMUTATIO, 2L), - new TC_Aspects.TC_AspectStack(TC_Aspects.VOLATUS, 1L), - new TC_Aspects.TC_AspectStack(TC_Aspects.TERRA, 1L), - new TC_Aspects.TC_AspectStack(TC_Aspects.ALIENIS, 2L), - new TC_Aspects.TC_AspectStack(TC_Aspects.TENEBRAE, 1L))) }); - } + tKey = "GT_TRANSSKYSTONE"; + GT_LanguageManager.addStringLocalization( + GT_MachineRecipeLoader.aTextTCGTPage + tKey, + "You have discovered a way to convert obsidian to skystone.<BR><BR>Not sure why you'd want to do this, unless skystone is somehow unavailable in your world."); + GregTech_API.sThaumcraftCompat.addResearch( + tKey, + "Skystone Transmutation", + "Transformation of obsidian into skystone", + new String[] { "GT_ADVANCEDMETALLURGY" }, + "ALCHEMY", + getModItem("appliedenergistics2", "tile.BlockSkyStone", 1), + 4, + 0, + 19, + 15, + Arrays.asList( + new TC_Aspects.TC_AspectStack(TC_Aspects.METALLUM, 5L), + new TC_Aspects.TC_AspectStack(TC_Aspects.PERMUTATIO, 3L), + new TC_Aspects.TC_AspectStack(TC_Aspects.VOLATUS, 3L), + new TC_Aspects.TC_AspectStack(TC_Aspects.ALIENIS, 3L), + new TC_Aspects.TC_AspectStack(TC_Aspects.TERRA, 3L)), + null, + new Object[] { GT_MachineRecipeLoader.aTextTCGTPage + tKey, + GregTech_API.sThaumcraftCompat.addCrucibleRecipe( + tKey, + new ItemStack(Blocks.obsidian), + getModItem("appliedenergistics2", "tile.BlockSkyStone", 1), + Arrays.asList( + new TC_Aspects.TC_AspectStack(TC_Aspects.PERMUTATIO, 2L), + new TC_Aspects.TC_AspectStack(TC_Aspects.VOLATUS, 1L), + new TC_Aspects.TC_AspectStack(TC_Aspects.TERRA, 1L), + new TC_Aspects.TC_AspectStack(TC_Aspects.ALIENIS, 2L), + new TC_Aspects.TC_AspectStack(TC_Aspects.TENEBRAE, 1L))) }); tKey = "GT_TRANSMINERAL"; GT_LanguageManager.addStringLocalization( |