diff --git a/build.gradle b/build.gradle index 0cb9185a7..c09bee22f 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1644510936 +//version: 1652851397 /* DO NOT CHANGE THIS FILE! @@ -6,12 +6,11 @@ Also, you may replace this file at any time if there is an update available. Please check https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/build.gradle for updates. */ -import org.gradle.internal.logging.text.StyledTextOutput -import org.gradle.internal.logging.text.StyledTextOutputFactory -import org.gradle.internal.logging.text.StyledTextOutput.Style import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation 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.util.concurrent.TimeUnit @@ -45,18 +44,21 @@ plugins { id 'eclipse' id 'scala' id 'maven-publish' - id('org.jetbrains.kotlin.jvm') version ('1.6.10') 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('de.undercouch.download') version('5.0.1') + 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 'de.undercouch.download' version '5.0.1' + id 'com.github.gmazzo.buildconfig' version '3.0.3' apply false } if (project.file('.git/HEAD').isFile()) { apply plugin: 'com.palantir.git-version' } -def out = services.get(StyledTextOutputFactory).create("an-output") +def out = services.get(StyledTextOutputFactory).create('an-output') apply plugin: 'forge' @@ -102,6 +104,7 @@ checkPropertyExists("usesShadowedDependencies") checkPropertyExists("developmentEnvironmentUserName") boolean noPublishedSources = project.findProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false +boolean usesMixinDebug = project.findProperty('usesMixinDebug') ?: project.usesMixins.toBoolean() String javaSourceDir = "src/main/java/" String scalaSourceDir = "src/main/scala/" @@ -173,7 +176,7 @@ configurations.all { try { 'git config core.fileMode false'.execute() } -catch (Exception e) { +catch (Exception ignored) { out.style(Style.Failure).println("git isn't installed at all") } @@ -183,7 +186,7 @@ String versionOverride = System.getenv("VERSION") ?: null try { identifiedVersion = versionOverride == null ? gitVersion() : versionOverride } -catch (Exception e) { +catch (Exception ignored) { out.style(Style.Failure).text( 'This mod must be version controlled by Git AND the repository must provide at least one tag,\n' + 'or the VERSION override must be set! ').style(Style.SuccessHeader).text('(Do NOT download from GitHub using the ZIP option, instead\n' + @@ -193,9 +196,11 @@ catch (Exception e) { identifiedVersion = versionOverride } version = minecraftVersion + '-' + identifiedVersion -String modVersion = identifiedVersion +ext { + modVersion = identifiedVersion +} -if( identifiedVersion.equals(versionOverride) ) { +if(identifiedVersion == versionOverride) { out.style(Style.Failure).text('Override version to ').style(Style.Identifier).text(modVersion).style(Style.Failure).println('!\7') } @@ -207,22 +212,25 @@ else { archivesBaseName = modId } - def arguments = [] def jvmArguments = [] -if(usesMixins.toBoolean()) { +if (usesMixins.toBoolean()) { arguments += [ - "--tweakClass org.spongepowered.asm.launch.MixinTweaker" - ] - jvmArguments += [ - "-Dmixin.debug.countInjections=true", "-Dmixin.debug.verbose=true", "-Dmixin.debug.export=true" + "--tweakClass org.spongepowered.asm.launch.MixinTweaker" ] + if (usesMixinDebug.toBoolean()) { + jvmArguments += [ + "-Dmixin.debug.countInjections=true", + "-Dmixin.debug.verbose=true", + "-Dmixin.debug.export=true" + ] + } } minecraft { - version = minecraftVersion + "-" + forgeVersion + "-" + minecraftVersion - runDir = "run" + version = minecraftVersion + '-' + forgeVersion + '-' + minecraftVersion + runDir = 'run' if (replaceGradleTokenInFile) { replaceIn replaceGradleTokenInFile @@ -255,8 +263,8 @@ minecraft { } } -if(file("addon.gradle").exists()) { - apply from: "addon.gradle" +if(file('addon.gradle').exists()) { + apply from: 'addon.gradle' } apply from: 'repositories.gradle' @@ -304,23 +312,28 @@ dependencies { apply from: 'dependencies.gradle' -def mixingConfigRefMap = "mixins." + modId + ".refmap.json" +def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json' def refMap = "${tasks.compileJava.temporaryDir}" + File.separator + mixingConfigRefMap def mixinSrg = "${tasks.reobf.temporaryDir}" + File.separator + "mixins.srg" task generateAssets { - if(usesMixins.toBoolean()) { - getFile("/src/main/resources/mixins." + modId + ".json").text = """{ + if (usesMixins.toBoolean()) { + def mixinConfigFile = getFile("/src/main/resources/mixins." + modId + ".json"); + if (!mixinConfigFile.exists()) { + mixinConfigFile.text = """{ "required": true, "minVersion": "0.7.11", "package": "${modGroup}.${mixinsPackage}", "plugin": "${modGroup}.${mixinPlugin}", "refmap": "${mixingConfigRefMap}", "target": "@env(DEFAULT)", - "compatibilityLevel": "JAVA_8" + "compatibilityLevel": "JAVA_8", + "mixins": [], + "client": [], + "server": [] } - """ + } } } @@ -408,8 +421,7 @@ tasks.withType(JavaExec).configureEach { ) } -processResources -{ +processResources { // this will ensure that this task is redone when the versions change. inputs.property "version", project.version inputs.property "mcversion", project.minecraft.version @@ -437,7 +449,7 @@ processResources def getManifestAttributes() { def manifestAttributes = [:] - if(containsMixinsAndOrCoreModOnly.toBoolean() == false && (usesMixins.toBoolean() || coreModClass)) { + if(!containsMixinsAndOrCoreModOnly.toBoolean() && (usesMixins.toBoolean() || coreModClass)) { manifestAttributes += ["FMLCorePluginContainsFMLMod": true] } @@ -453,14 +465,14 @@ def getManifestAttributes() { manifestAttributes += [ "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", "MixinConfigs" : "mixins." + modId + ".json", - "ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false + "ForceLoadAsMod" : !containsMixinsAndOrCoreModOnly.toBoolean() ] } return manifestAttributes } task sourcesJar(type: Jar) { - from (sourceSets.main.allJava) + from (sourceSets.main.allSource) from (file("$projectDir/LICENSE")) getArchiveClassifier().set('sources') } @@ -515,7 +527,7 @@ task devJar(type: Jar) { } task apiJar(type: Jar) { - from (sourceSets.main.allJava) { + from (sourceSets.main.allSource) { include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**' } @@ -540,12 +552,15 @@ artifacts { } } -// The gradle metadata includes all of the additional deps that we disabled from POM generation (including forgeBin with no groupID), +// The gradle metadata includes all of the additional deps that we disabled from POM generation (including forgeBin with no groupID), // and isn't strictly needed with the POM so just disable it. tasks.withType(GenerateModuleMetadata) { enabled = false } +// workaround variable hiding in pom processing +def projectConfigs = project.configurations + publishing { publications { maven(MavenPublication) { @@ -554,7 +569,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) { @@ -566,16 +581,20 @@ publishing { // Using the identified version, not project.version as it has the prepended 1.7.10 version = System.getenv("RELEASE_VERSION") ?: identifiedVersion - // remove extra garbage from who knows where + // remove extra garbage from minecraft and minecraftDeps configuration pom.withXml { - def badPomGroup = ['net.minecraft', 'com.google.code.findbugs', 'org.ow2.asm', 'com.typesafe.akka', 'com.typesafe', 'org.scala-lang', - 'org.scala-lang.plugins', 'net.sf.jopt-simple', 'lzma', 'com.mojang', 'org.apache.commons', 'org.apache.httpcomponents', - 'commons-logging', 'java3d', 'net.sf.trove4j', 'com.ibm.icu', 'com.paulscode', 'io.netty', 'com.google.guava', - 'commons-io', 'commons-codec', 'net.java.jinput', 'net.java.jutils', 'com.google.code.gson', 'org.apache.logging.log4j', - 'org.lwjgl.lwjgl', 'tv.twitch', ''] + def badArtifacts = [:].withDefault {[] as Set} + for (configuration in [projectConfigs.minecraft, projectConfigs.minecraftDeps]) { + for (dependency in configuration.allDependencies) { + badArtifacts[dependency.group == null ? "" : dependency.group] += dependency.name + } + } + // example for specifying extra stuff to ignore + // badArtifacts["org.example.group"] += "artifactName" + Node pomNode = asNode() pomNode.dependencies.'*'.findAll() { - badPomGroup.contains(it.groupId.text()) + badArtifacts[it.groupId.text()].contains(it.artifactId.text()) }.each() { it.parent().remove(it) } @@ -719,7 +738,7 @@ def deobf(String sourceURL, String fileName) { // Helper methods def checkPropertyExists(String propertyName) { - if (project.hasProperty(propertyName) == false) { + if (!project.hasProperty(propertyName)) { throw new GradleException("This project requires a property \"" + propertyName + "\"! Please add it your \"gradle.properties\". You can find all properties and their description here: https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/gradle.properties") } } diff --git a/dependencies.gradle b/dependencies.gradle index f980c93fc..e0b038a23 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -3,9 +3,9 @@ dependencies { shadowImplementation('com.github.GTNewHorizons:AVRcore:master-SNAPSHOT') - compile('com.github.GTNewHorizons:GT5-Unofficial:5.09.40.43:dev') + compile('com.github.GTNewHorizons:GT5-Unofficial:5.09.40.49:dev') compile('com.github.GTNewHorizons:Yamcl:0.5.82:dev') - compile('com.github.GTNewHorizons:NotEnoughItems:2.2.7-GTNH:dev') + compile('com.github.GTNewHorizons:NotEnoughItems:2.2.15-GTNH:dev') compile('com.github.GTNewHorizons:CodeChickenLib:1.1.5.3:dev') compile('com.github.GTNewHorizons:CodeChickenCore:1.1.4:dev') compile('com.github.GTNewHorizons:StructureLib:1.0.15:dev') @@ -13,8 +13,8 @@ dependencies { compileOnly('com.github.GTNewHorizons:OpenModularTurrets:2.2.11-247:dev') {transitive=false} compileOnly('com.github.GTNewHorizons:OpenComputers:1.7.5.23-GTNH:dev') {transitive=false} - compileOnly('com.github.GTNewHorizons:GTplusplus:1.7.27:dev') {transitive=false} - compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-76-GTNH:dev') {transitive=false} + compileOnly('com.github.GTNewHorizons:GTplusplus:1.7.32:dev') {transitive=false} + compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-85-GTNH:dev') {transitive=false} compileOnly('curse.maven:cofh-lib-220333:2388748') {transitive=false} compileOnly('curse.maven:computercraft-67504:2269339') {transitive=false} diff --git a/gradle.properties b/gradle.properties index 3d49d30e9..86fedd756 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,7 +19,7 @@ forgeVersion = 10.13.4.1614 # 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" +developmentEnvironmentUserName = Developer # Define a source file of your project with: # public static final String VERSION = "GRADLETOKEN_VERSION"; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/Textures.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/Textures.java index bc853334d..d9ccb1529 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/Textures.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/Textures.java @@ -201,9 +201,10 @@ public static void run(){ } MACHINE_CASINGS=MACHINE_CASINGS_TT; - OVERLAYS_ENERGY_IN=OVERLAYS_ENERGY_IN_TT; - OVERLAYS_ENERGY_OUT=OVERLAYS_ENERGY_OUT_TT; - OVERLAYS_ENERGY_IN_MULTI=OVERLAYS_ENERGY_IN_MULTI_TT; - OVERLAYS_ENERGY_OUT_MULTI=OVERLAYS_ENERGY_OUT_MULTI_TT; + // These will throw IndexOutOfBoundsException if one of the arrays are the wrong length + System.arraycopy(OVERLAYS_ENERGY_IN_TT, 0, OVERLAYS_ENERGY_IN, 0, OVERLAYS_ENERGY_IN_TT.length); + System.arraycopy(OVERLAYS_ENERGY_OUT_TT, 0, OVERLAYS_ENERGY_OUT, 0, OVERLAYS_ENERGY_OUT_TT.length); + System.arraycopy(OVERLAYS_ENERGY_IN_MULTI_TT, 0, OVERLAYS_ENERGY_IN_MULTI, 0, OVERLAYS_ENERGY_IN_MULTI_TT.length); + System.arraycopy(OVERLAYS_ENERGY_OUT_MULTI_TT, 0, OVERLAYS_ENERGY_OUT_MULTI, 0, OVERLAYS_ENERGY_OUT_MULTI_TT.length); } } \ No newline at end of file