aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/scripts/test-no-error-reports.sh27
-rw-r--r--.github/workflows/build-and-test.yml45
-rw-r--r--.github/workflows/release-tags.yml51
-rw-r--r--CODEOWNERS3
-rw-r--r--build.gradle582
-rw-r--r--dependencies.gradle47
-rw-r--r--gradle.properties71
-rw-r--r--gradle/wrapper/gradle-wrapper.jarbin53636 -> 55616 bytes
-rw-r--r--gradle/wrapper/gradle-wrapper.properties5
-rw-r--r--gradle/wrapper/gradle-wrapper.properties.bak5
-rw-r--r--repositories.gradle33
-rw-r--r--src/main/java/goodgenerator/main/GoodGenerator.java4
-rw-r--r--src/main/java/goodgenerator/main/GoodGenerator.java.bak75
-rw-r--r--src/main/resources/mcmod.info4
14 files changed, 862 insertions, 90 deletions
diff --git a/.github/scripts/test-no-error-reports.sh b/.github/scripts/test-no-error-reports.sh
new file mode 100644
index 0000000000..e3876606d5
--- /dev/null
+++ b/.github/scripts/test-no-error-reports.sh
@@ -0,0 +1,27 @@
+if [[ -d "run/crash-reports" ]]; then
+ echo "Crash reports detected:"
+ cat $directory/*
+ exit 1
+fi
+
+if grep --quiet "Fatal errors were detected" server.log; then
+ echo "Fatal errors detected:"
+ cat server.log
+ exit 1
+fi
+
+if grep --quiet "The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED" server.log; then
+ echo "Server force stopped:"
+ cat server.log
+ exit 1
+fi
+
+if grep --quiet 'Done .+ For help, type "help" or "?"' server.log; then
+ echo "Server didn't finish startup:"
+ cat server.log
+ exit 1
+fi
+
+echo "No crash reports detected"
+exit 0
+
diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml
new file mode 100644
index 0000000000..08df9fe89f
--- /dev/null
+++ b/.github/workflows/build-and-test.yml
@@ -0,0 +1,45 @@
+# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
+# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
+
+name: Build and test
+
+on:
+ pull_request:
+ branches: [ master, main ]
+ push:
+ branches: [ master, main ]
+
+jobs:
+ build-and-test:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ fetch-depth: 0
+
+ - name: Set up JDK 8
+ uses: actions/setup-java@v2
+ with:
+ java-version: '8'
+ distribution: 'adopt'
+ cache: gradle
+
+ - name: Grant execute permission for gradlew
+ run: chmod +x gradlew
+
+ - name: Setup the workspace
+ run: ./gradlew setupCIWorkspace
+
+ - name: Build the mod
+ run: ./gradlew build
+
+ - name: Run server for 1.5 minutes
+ run: |
+ mkdir run
+ echo "eula=true" > run/eula.txt
+ timeout 90 ./gradlew runServer | tee --append server.log || true
+
+ - name: Test no errors reported during server run
+ run: |
+ chmod +x .github/scripts/test-no-error-reports.sh
+ .github/scripts/test-no-error-reports.sh
diff --git a/.github/workflows/release-tags.yml b/.github/workflows/release-tags.yml
new file mode 100644
index 0000000000..c86d8889b7
--- /dev/null
+++ b/.github/workflows/release-tags.yml
@@ -0,0 +1,51 @@
+# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
+# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
+
+name: Release tagged build
+
+on:
+ push:
+ tags:
+ - '*'
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ fetch-depth: 0
+
+ - name: Set release version
+ run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
+
+ - name: Set up JDK 8
+ uses: actions/setup-java@v2
+ with:
+ java-version: '8'
+ distribution: 'adopt'
+ cache: gradle
+
+ - name: Grant execute permission for gradlew
+ run: chmod +x gradlew
+
+ - name: Setup the workspace
+ run: ./gradlew setupCIWorkspace
+
+ - name: Build the mod
+ run: ./gradlew build
+
+ - name: Release under current tag
+ uses: "marvinpinto/action-automatic-releases@latest"
+ with:
+ repo_token: "${{ secrets.GITHUB_TOKEN }}"
+ automatic_release_tag: "${{ env.RELEASE_VERSION }}"
+ prerelease: false
+ title: "${{ env.RELEASE_VERSION }}"
+ files: build/libs/*.jar
+
+ - name: Publish to Maven
+ run: ./gradlew publish
+ env:
+ MAVEN_USER: ${{ secrets.MAVEN_USER }}
+ MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
diff --git a/CODEOWNERS b/CODEOWNERS
new file mode 100644
index 0000000000..a6b5f68cd0
--- /dev/null
+++ b/CODEOWNERS
@@ -0,0 +1,3 @@
+# Any Github changes require admin approval
+/.github/** @GTNewHorizons/admin
+
diff --git a/build.gradle b/build.gradle
index 5beaed039c..ac03c5cc57 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,7 +1,23 @@
+//version: 1642484596
+/*
+DO NOT CHANGE THIS FILE!
+
+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 com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
+import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
+
import java.util.concurrent.TimeUnit
buildscript {
repositories {
+ maven {
+ name = "GTNH Maven"
+ url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
+ }
mavenCentral()
maven {
name = "gt"
@@ -23,9 +39,12 @@ buildscript {
}
plugins {
- // project.grgit is not available and the repository we're working in is not
- // interacted with:
- //id 'org.ajoberstar.grgit' version '4.0.2' apply false
+ id 'idea'
+ id 'scala'
+ id("org.ajoberstar.grgit") version("3.1.1")
+ id("com.github.johnrengelman.shadow") version("4.0.4")
+ id("com.palantir.git-version") version("0.12.3")
+ id("maven-publish")
}
apply plugin: 'forge'
@@ -34,6 +53,14 @@ apply plugin: 'java'
apply plugin: 'signing'
apply plugin: 'java-library'
+def projectJavaVersion = JavaLanguageVersion.of(8)
+
+java {
+ toolchain {
+ languageVersion.set(projectJavaVersion)
+ }
+}
+
idea {
module {
inheritOutputDirs = true
@@ -42,129 +69,532 @@ idea {
}
}
-configurations.all {
- resolutionStrategy.cacheChangingModulesFor(0, TimeUnit.SECONDS)
+if(JavaVersion.current() != JavaVersion.VERSION_1_8) {
+ throw new GradleException("This project requires Java 8, but it's running on " + JavaVersion.current())
}
-sourceCompatibility = targetCompatibility = 1.8
+checkPropertyExists("modName")
+checkPropertyExists("modId")
+checkPropertyExists("modGroup")
+checkPropertyExists("autoUpdateBuildScript")
+checkPropertyExists("minecraftVersion")
+checkPropertyExists("forgeVersion")
+checkPropertyExists("replaceGradleTokenInFile")
+checkPropertyExists("gradleTokenModId")
+checkPropertyExists("gradleTokenModName")
+checkPropertyExists("gradleTokenVersion")
+checkPropertyExists("gradleTokenGroupName")
+checkPropertyExists("apiPackage")
+checkPropertyExists("accessTransformersFile")
+checkPropertyExists("usesMixins")
+checkPropertyExists("mixinPlugin")
+checkPropertyExists("mixinsPackage")
+checkPropertyExists("coreModClass")
+checkPropertyExists("containsMixinsAndOrCoreModOnly")
+checkPropertyExists("usesShadowedDependencies")
+checkPropertyExists("developmentEnvironmentUserName")
-version = modVersion
-group= modGroup
-archivesBaseName = modId
+boolean noPublishedSources = project.findProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false
-minecraft {
- version = "${minecraftVersion}-${forgeVersion}-${minecraftVersion}"
- runDir = "run"
+String javaSourceDir = "src/main/java/"
+String scalaSourceDir = "src/main/scala/"
+
+String targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/")
+String targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/")
+if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) {
+ throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala)
}
-repositories {
- jcenter()
- maven { // EnderIO & EnderCore
- name = 'tterrag Repo'
- url = "http://maven.tterrag.com"
- }
- maven {
- name = "CodeChicken"
- url = "http://chickenbones.net/maven/"
+if(apiPackage) {
+ targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
+ targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
+ if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) {
+ throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala)
}
- maven {
- url = "https://jitpack.io"
+}
+
+if(accessTransformersFile) {
+ String targetFile = "src/main/resources/META-INF/" + accessTransformersFile
+ if(getFile(targetFile).exists() == false) {
+ throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile)
}
- maven {
- name = "ic2"
- url = "http://downloads.gtnewhorizons.com/Mods_for_Jenkins/"
+}
+
+if(usesMixins.toBoolean()) {
+ if(mixinsPackage.isEmpty() || mixinPlugin.isEmpty()) {
+ throw new GradleException("\"mixinPlugin\" requires \"mixinsPackage\" and \"mixinPlugin\" to be set!")
}
- ivy {
- name = "gtnh_download_source"
- artifactPattern("http://downloads.gtnewhorizons.com/Mods_for_Jenkins/[module]-[revision].[ext]")
+
+ targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
+ targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
+ if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) {
+ throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala)
}
- maven {
- name = "UsrvDE/GTNH"
- url = "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases/"
+
+ String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java"
+ String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".scala"
+ String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java"
+ if((getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists()) == false) {
+ throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava)
}
- maven {
- name = "gt"
- url = "https://gregtech.overminddl1.com/"
+}
+
+if(coreModClass) {
+ String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java"
+ String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".scala"
+ String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java"
+ if((getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists()) == false) {
+ throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava)
}
- maven {
- name = "cofhCore"
- url = "https://cursemaven.com"
+}
+
+configurations.all {
+ resolutionStrategy.cacheChangingModulesFor(0, TimeUnit.SECONDS)
+
+ // Make sure GregTech build won't time out
+ System.setProperty("org.gradle.internal.http.connectionTimeout", 120000 as String)
+ System.setProperty("org.gradle.internal.http.socketTimeout", 120000 as String)
+}
+
+// Fix Jenkins' Git: chmod a file should not be detected as a change and append a '.dirty' to the version
+'git config core.fileMode false'.execute()
+
+// Pulls version first from the VERSION env and then git tag
+String identifiedVersion
+try {
+ String versionOverride = System.getenv("VERSION") ?: null
+ identifiedVersion = versionOverride == null ? gitVersion() : versionOverride
+ version = minecraftVersion + "-" + identifiedVersion
+}
+catch (Exception e) {
+ throw new IllegalStateException("This mod must be version controlled by Git AND the repository must provide at least one tag, or the VERSION override must be set!");
+}
+
+group = modGroup
+if(project.hasProperty("customArchiveBaseName") && customArchiveBaseName) {
+ archivesBaseName = customArchiveBaseName
+}
+else {
+ archivesBaseName = modId
+}
+
+minecraft {
+ version = "${minecraftVersion}-${forgeVersion}-${minecraftVersion}"
+ runDir = "run"
+
+ if (replaceGradleTokenInFile) {
+ replaceIn replaceGradleTokenInFile
+ if(gradleTokenModId) {
+ replace gradleTokenModId, modId
+ }
+ if(gradleTokenModName) {
+ replace gradleTokenModName, modName
+ }
+ if(gradleTokenVersion) {
+ replace gradleTokenVersion, versionDetails().lastTag
+ }
+ if(gradleTokenGroupName) {
+ replace gradleTokenGroupName, modGroup
+ }
}
+}
+
+if(file("addon.gradle").exists()) {
+ apply from: "addon.gradle"
+}
+
+apply from: 'repositories.gradle'
+
+configurations {
+ implementation.extendsFrom(shadowImplementation) // TODO: remove after all uses are refactored
+ implementation.extendsFrom(shadowCompile)
+ implementation.extendsFrom(shadeCompile)
+}
+
+repositories {
maven {
- name = "ic2"
- url = "http://maven.ic2.player.to/"
+ name = "Overmind forge repo mirror"
+ url = "https://gregtech.overminddl1.com/"
}
- maven {
- url = "http://www.ryanliptak.com/maven/"
+ if(usesMixins.toBoolean()) {
+ maven {
+ name = "sponge"
+ url = "https://repo.spongepowered.org/repository/maven-public"
+ }
+ maven {
+ url = "https://jitpack.io"
+ }
}
}
dependencies {
- compile("com.github.GTNewHorizons:GT5-Unofficial:master-SNAPSHOT:dev")
- compileOnly("com.github.GTNewHorizons:EnderCore:master-SNAPSHOT:dev") {
- transitive = false
+ if(usesMixins.toBoolean()) {
+ 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("org.spongepowered:mixin:0.8-SNAPSHOT")
+ // 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
+ exclude module: "launchwrapper"
+ exclude module: "guava"
+ exclude module: "gson"
+ exclude module: "commons-io"
+ exclude module: "log4j-core"
+ }
+ compile("com.github.GTNewHorizons:SpongeMixins:1.5.0")
}
- compileOnly("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:master-SNAPSHOT:dev") {
- transitive = false
+}
+
+apply from: 'dependencies.gradle'
+
+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 = """{
+ "required": true,
+ "minVersion": "0.7.11",
+ "package": "${modGroup}.${mixinsPackage}",
+ "plugin": "${modGroup}.${mixinPlugin}",
+ "refmap": "${mixingConfigRefMap}",
+ "target": "@env(DEFAULT)",
+ "compatibilityLevel": "JAVA_8"
+}
+
+"""
}
- compileOnly("com.github.GTNewHorizons:bartworks:master-SNAPSHOT:dev") {
- transitive = false
+}
+
+task relocateShadowJar(type: ConfigureShadowRelocation) {
+ target = tasks.shadowJar
+ prefix = modGroup + ".shadow"
+}
+
+shadowJar {
+ project.configurations.shadeCompile.each { dep ->
+ from(project.zipTree(dep)) {
+ exclude 'META-INF', 'META-INF/**'
+ }
}
- compileOnly("com.github.GTNewHorizons:GTplusplus:master-SNAPSHOT:dev") {
- transitive = false
+
+ manifest {
+ attributes(getManifestAttributes())
}
- compileOnly("com.github.GTNewHorizons:AppleCore:master-SNAPSHOT:dev") {
- transitive = false
+
+ minimize() // This will only allow shading for actually used classes
+ configurations = [project.configurations.shadowImplementation, project.configurations.shadowCompile]
+ dependsOn(relocateShadowJar)
+}
+
+jar {
+ project.configurations.shadeCompile.each { dep ->
+ from(project.zipTree(dep)) {
+ exclude 'META-INF', 'META-INF/**'
+ }
}
- compileOnly("com.github.GTNewHorizons:TecTech:master-SNAPSHOT:dev") {
- transitive = false
+
+ manifest {
+ attributes(getManifestAttributes())
}
- compileOnly("com.github.GTNewHorizons:ForestryMC:master-SNAPSHOT:dev") {
- transitive = false
+
+ if(usesShadowedDependencies.toBoolean()) {
+ dependsOn(shadowJar)
+ enabled = false
}
- compileOnly("com.github.GTNewHorizons:Railcraft:master-SNAPSHOT:dev") {
- transitive = false
+}
+
+reobf {
+ if(usesMixins.toBoolean()) {
+ addExtraSrgFile mixinSrg
+ }
+}
+
+afterEvaluate {
+ if(usesMixins.toBoolean()) {
+ tasks.compileJava {
+ options.compilerArgs += [
+ "-AreobfSrgFile=${tasks.reobf.srg}",
+ "-AoutSrgFile=${mixinSrg}",
+ "-AoutRefMapFile=${refMap}",
+ // Elan: from what I understand they are just some linter configs so you get some warning on how to properly code
+ "-XDenableSunApiLintControl",
+ "-XDignore.symbol.file"
+ ]
+ }
}
- compileOnly("com.github.GTNewHorizons:EnderIO:master-SNAPSHOT:dev") {
- transitive = false
+}
+
+runClient {
+ def arguments = []
+
+ if(usesMixins.toBoolean()) {
+ arguments += [
+ "--mods=../build/libs/$modId-${version}.jar",
+ "--tweakClass org.spongepowered.asm.launch.MixinTweaker"
+ ]
}
- compileOnly("com.mod-buildcraft:buildcraft:7.1.23:dev") {
- transitive = false
+
+ if(developmentEnvironmentUserName) {
+ arguments += [
+ "--username",
+ developmentEnvironmentUserName
+ ]
}
- compileOnly("com.github.GTNewHorizons:ExtraCells2:master-SNAPSHOT:dev") {
- transitive = false
+
+ args(arguments)
+}
+
+runServer {
+ def arguments = []
+
+ if (usesMixins.toBoolean()) {
+ arguments += [
+ "--mods=../build/libs/$modId-${version}.jar",
+ "--tweakClass org.spongepowered.asm.launch.MixinTweaker"
+ ]
}
-/* compileOnly("com.github.GTNewHorizons:Avaritia:master-SNAPSHOT") {
- setChanging(true)
- }*/
- compile files('Thaumcraft-1.7.10-4.2.3.5.deobf.jar')
+
+ args(arguments)
}
+tasks.withType(JavaExec).configureEach {
+ javaLauncher.set(
+ javaToolchains.launcherFor {
+ languageVersion = projectJavaVersion
+ }
+ )
+}
processResources
{
+ // this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
+
+ // replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
- expand 'version':project.version, 'mcversion':project.minecraft.version
+
+ // replace version and mcversion
+ expand "minecraftVersion": project.minecraft.version,
+ "modVersion": versionDetails().lastTag,
+ "modId": modId,
+ "modName": modName
+ }
+
+ if(usesMixins.toBoolean()) {
+ from refMap
}
+
+ // copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
+def getManifestAttributes() {
+ def manifestAttributes = [:]
+ if(containsMixinsAndOrCoreModOnly.toBoolean() == false && (usesMixins.toBoolean() || coreModClass)) {
+ manifestAttributes += ["FMLCorePluginContainsFMLMod": true]
+ }
+
+ if(accessTransformersFile) {
+ manifestAttributes += ["FMLAT" : accessTransformersFile.toString()]
+ }
+
+ if(coreModClass) {
+ manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass]
+ }
+
+ if(usesMixins.toBoolean()) {
+ manifestAttributes += [
+ "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
+ "MixinConfigs" : "mixins." + modId + ".json",
+ "ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false
+ ]
+ }
+ return manifestAttributes
+}
+
+task sourcesJar(type: Jar) {
+ from (sourceSets.main.allJava)
+ from (file("$projectDir/LICENSE"))
+ getArchiveClassifier().set('sources')
+}
+
+task shadowDevJar(type: ShadowJar) {
+ project.configurations.shadeCompile.each { dep ->
+ from(project.zipTree(dep)) {
+ exclude 'META-INF', 'META-INF/**'
+ }
+ }
+
+ from sourceSets.main.output
+ getArchiveClassifier().set("dev")
+
+ manifest {
+ attributes(getManifestAttributes())
+ }
+
+ minimize() // This will only allow shading for actually used classes
+ configurations = [project.configurations.shadowImplementation, project.configurations.shadowCompile]
+}
+
+task relocateShadowDevJar(type: ConfigureShadowRelocation) {
+ target = tasks.shadowDevJar
+ prefix = modGroup + ".shadow"
+}
+
+task circularResolverJar(type: Jar) {
+ dependsOn(relocateShadowDevJar)
+ dependsOn(shadowDevJar)
+ enabled = false
+}
+
task devJar(type: Jar) {
- classifier = 'dev'
+ project.configurations.shadeCompile.each { dep ->
+ from(project.zipTree(dep)) {
+ exclude 'META-INF', 'META-INF/**'
+ }
+ }
+
from sourceSets.main.output
+ getArchiveClassifier().set("dev")
+
+ manifest {
+ attributes(getManifestAttributes())
+ }
+
+ if(usesShadowedDependencies.toBoolean()) {
+ dependsOn(circularResolverJar)
+ enabled = false
+ }
}
-task sourcesJar(type: Jar) {
- classifier = 'sources'
- from sourceSets.main.allSource
+task apiJar(type: Jar) {
+ from (sourceSets.main.allJava) {
+ include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**'
+ }
+
+ from (sourceSets.main.output) {
+ include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**'
+ }
+
+ from (sourceSets.main.resources.srcDirs) {
+ include("LICENSE")
+ }
+
+ getArchiveClassifier().set('api')
}
artifacts {
- archives(devJar)
- archives(sourcesJar)
+ if(!noPublishedSources) {
+ archives sourcesJar
+ }
+ archives devJar
+ if(apiPackage) {
+ archives apiJar
+ }
+}
+
+// publishing
+publishing {
+ publications {
+ maven(MavenPublication) {
+ artifact source: usesShadowedDependencies.toBoolean() ? shadowJar : jar, classifier: ""
+ if(!noPublishedSources) {
+ artifact source: sourcesJar, classifier: "src"
+ }
+ artifact source: usesShadowedDependencies.toBoolean() ? shadowDevJar : devJar, classifier: "dev"
+ if (apiPackage) {
+ artifact source: apiJar, classifier: "api"
+ }
+
+ groupId = System.getenv("ARTIFACT_GROUP_ID") ?: "com.github.GTNewHorizons"
+ artifactId = System.getenv("ARTIFACT_ID") ?: project.name
+ // Using the identified version, not project.version as it has the prepended 1.7.10
+ version = System.getenv("RELEASE_VERSION") ?: identifiedVersion
+ }
+ }
+
+ repositories {
+ maven {
+ url = "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases"
+ credentials {
+ username = System.getenv("MAVEN_USER") ?: "NONE"
+ password = System.getenv("MAVEN_PASSWORD") ?: "NONE"
+ }
+ }
+ }
+}
+
+// Updating
+task updateBuildScript {
+ doLast {
+ if (performBuildScriptUpdate(projectDir.toString())) return
+
+ print("Build script already up-to-date!")
+ }
+}
+
+if (isNewBuildScriptVersionAvailable(projectDir.toString())) {
+ if (autoUpdateBuildScript.toBoolean()) {
+ performBuildScriptUpdate(projectDir.toString())
+ } else {
+ println("Build script update available! Run 'gradle updateBuildScript'")
+ }
+}
+
+static URL availableBuildScriptUrl() {
+ new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/main/build.gradle")
+}
+
+boolean performBuildScriptUpdate(String projectDir) {
+ if (isNewBuildScriptVersionAvailable(projectDir)) {
+ def buildscriptFile = getFile("build.gradle")
+ availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } }
+ print("Build script updated. Please REIMPORT the project or RESTART your IDE!")
+ return true
+ }
+ return false
+}
+
+boolean isNewBuildScriptVersionAvailable(String projectDir) {
+ Map parameters = ["connectTimeout": 2000, "readTimeout": 2000]
+
+ String currentBuildScript = getFile("build.gradle").getText()
+ String currentBuildScriptHash = getVersionHash(currentBuildScript)
+ String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText()
+ String availableBuildScriptHash = getVersionHash(availableBuildScript)
+
+ boolean isUpToDate = currentBuildScriptHash.empty || availableBuildScriptHash.empty || currentBuildScriptHash == availableBuildScriptHash
+ return !isUpToDate
+}
+
+static String getVersionHash(String buildScriptContent) {
+ String versionLine = buildScriptContent.find("^//version: [a-z0-9]*")
+ if(versionLine != null) {
+ return versionLine.split(": ").last()
+ }
+ return ""
+}
+
+configure(updateBuildScript) {
+ group = 'forgegradle'
+ description = 'Updates the build script to the latest version'
+}
+
+// Helper methods
+
+def checkPropertyExists(String propertyName) {
+ if (project.hasProperty(propertyName) == false) {
+ 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")
+ }
+}
+
+def getFile(String relativePath) {
+ return new File(projectDir, relativePath)
}
diff --git a/dependencies.gradle b/dependencies.gradle
new file mode 100644
index 0000000000..fb7f4b0308
--- /dev/null
+++ b/dependencies.gradle
@@ -0,0 +1,47 @@
+// Add your dependencies here
+
+dependencies {
+ compile("com.github.GTNewHorizons:GT5-Unofficial:5.09.40.18:dev")
+ compile("com.github.GTNewHorizons:StructureLib:1.0.14:dev")
+ compile("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev")
+
+ compile("com.github.GTNewHorizons:NotEnoughItems:2.1.22-GTNH:dev")
+ compileOnly("com.github.GTNewHorizons:EnderCore:0.2.6:dev") {
+ transitive = false
+ }
+ compileOnly("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-70-GTNH:dev") {
+ transitive = false
+ }
+ compile("com.github.GTNewHorizons:bartworks:0.5.34:dev")
+ compileOnly("com.github.GTNewHorizons:GTplusplus:1.7.24:dev") {
+ transitive = false
+ }
+ compileOnly("com.github.GTNewHorizons:AppleCore:3.1.6:dev") {
+ transitive = false
+ }
+ compile("com.github.GTNewHorizons:TecTech:4.10.15:dev")
+ compileOnly("com.github.GTNewHorizons:ForestryMC:4.4.4:dev") {
+ transitive = false
+ }
+ compileOnly("com.github.GTNewHorizons:Railcraft:9.13.5:dev") {
+ transitive = false
+ }
+ compileOnly("com.github.GTNewHorizons:EnderIO:2.3.1.27:dev") {
+ transitive = false
+ }
+ compileOnly("com.mod-buildcraft:buildcraft:7.1.23:dev") {
+ transitive = false
+ }
+
+ compile("com.github.GTNewHorizons:CodeChickenLib:1.1.5.1:dev")
+ compile("com.github.GTNewHorizons:CodeChickenCore:1.1.3:dev")
+ runtime("com.github.GTNewHorizons:Baubles:1.0.1.14:dev")
+ runtime("com.github.GTNewHorizons:Yamcl:0.5.82:dev")
+ compileOnly("com.github.GTNewHorizons:ExtraCells2:2.5.4:dev") {
+ transitive = false
+ }
+/* compileOnly("com.github.GTNewHorizons:Avaritia:1.22) {
+ setChanging(true)
+ }*/
+ compile files('Thaumcraft-1.7.10-4.2.3.5.deobf.jar')
+}
diff --git a/gradle.properties b/gradle.properties
index d5ee5bc157..36c8099a4b 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,10 +1,67 @@
+modName = Good Generator
+
+# This is a case-sensitive string to identify your mod. Convention is to use lower case.
modId = GoodGenerator
-modGroup = GoodGenerator
-modVersion = 0.3.4
-minecraftVersion=1.7.10
-forgeVersion=10.13.4.1614
+modGroup = goodgenerator
+
+# WHY is there no version field?
+# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the
+# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/
+
+# Will update your build.gradle automatically whenever an update is available
+autoUpdateBuildScript = false
+
+minecraftVersion = 1.7.10
+forgeVersion = 10.13.4.1614
+
+# Select a username for testing your mod with breakpoints. You may leave this empty for a random user name 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:
+# public static final String VERSION = "GRADLETOKEN_VERSION";
+# The string's content will be replaced with your mods 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 = GoodGenerator.java
+gradleTokenModId = GRADLETOKEN_MODID
+gradleTokenModName = GRADLETOKEN_MODNAME
+gradleTokenVersion = GRADLETOKEN_VERSION
+gradleTokenGroupName = GRADLETOKEN_GROUPNAME
+
+# 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/
+# 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 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 =
+# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
+# This parameter is for legacy compatibility only
+# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
+coreModClass =
+# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
+# 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 '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
+
+# 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 =
-# Make sure GregTech build won't time out
-systemProp.org.gradle.internal.http.connectionTimeout=120000
-systemProp.org.gradle.internal.http.socketTimeout=120000
+# Optional parameter to prevent the source code from being published
+# noPublishedSources =
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index fd7e590e51..5c2d1cf016 100644
--- a/gradle/wrapper/gradle-wrapper.jar
+++ b/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index a76db97411..3ab0b725ef 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,5 @@
-#Mon Jul 12 17:07:40 CST 2021
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/gradle/wrapper/gradle-wrapper.properties.bak b/gradle/wrapper/gradle-wrapper.properties.bak
new file mode 100644
index 0000000000..2d80b69a76
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties.bak
@@ -0,0 +1,5 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-bin.zip
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/repositories.gradle b/repositories.gradle
new file mode 100644
index 0000000000..7333c199b8
--- /dev/null
+++ b/repositories.gradle
@@ -0,0 +1,33 @@
+// Add any additional repositories for your dependencies here
+
+repositories {
+ maven {
+ name = "GTNH Maven"
+ url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
+ }
+ jcenter()
+ maven {
+ name = "ic2"
+ url = "http://maven.ic2.player.to/"
+ metadataSources {
+ mavenPom()
+ artifact()
+ }
+
+ }
+
+ maven {
+ name = "gt"
+ url = "https://gregtech.overminddl1.com/"
+ }
+ maven {
+ name = "cofhCore"
+ url = "https://cursemaven.com"
+ }
+ maven {
+ url = "http://www.ryanliptak.com/maven/"
+ }
+ maven {
+ url = "https://jitpack.io"
+ }
+}
diff --git a/src/main/java/goodgenerator/main/GoodGenerator.java b/src/main/java/goodgenerator/main/GoodGenerator.java
index 48c6dbfb2e..1daa7dfedb 100644
--- a/src/main/java/goodgenerator/main/GoodGenerator.java
+++ b/src/main/java/goodgenerator/main/GoodGenerator.java
@@ -24,8 +24,8 @@ import cpw.mods.fml.common.Mod;
+ "required-after:bartworks; "
+ "required-after:tectech; ")
public final class GoodGenerator {
- public static final String MOD_ID = "GoodGenerator";
- public static final String MOD_NAME = "Good Generator";
+ public static final String MOD_ID = "GRADLETOKEN_MODID";
+ public static final String MOD_NAME = "GRADLETOKEN_MODNAME";
public static final String VERSION = "GRADLETOKEN_VERSION";
public static final CreativeTabs GG = new MyTabs("Good Generator");
diff --git a/src/main/java/goodgenerator/main/GoodGenerator.java.bak b/src/main/java/goodgenerator/main/GoodGenerator.java.bak
new file mode 100644
index 0000000000..b072ba04db
--- /dev/null
+++ b/src/main/java/goodgenerator/main/GoodGenerator.java.bak
@@ -0,0 +1,75 @@
+package goodgenerator.main;
+
+import goodgenerator.common.CommonProxy;
+import goodgenerator.crossmod.thaumcraft.Research;
+import goodgenerator.items.MyMaterial;
+import goodgenerator.loader.*;
+import goodgenerator.network.MessageOpenNeutronSensorGUI;
+import goodgenerator.network.MessageSetNeutronSensorData;
+import goodgenerator.tabs.MyTabs;
+import com.github.bartimaeusnek.bartworks.API.WerkstoffAdderRegistry;
+import cpw.mods.fml.common.Loader;
+import cpw.mods.fml.common.SidedProxy;
+import cpw.mods.fml.common.event.*;
+import cpw.mods.fml.common.network.NetworkRegistry;
+import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
+import cpw.mods.fml.relauncher.Side;
+import net.minecraft.creativetab.CreativeTabs;
+import cpw.mods.fml.common.Mod;
+
+@SuppressWarnings("ALL")
+@Mod(modid = GoodGenerator.MOD_ID, version = GoodGenerator.VERSION,
+ dependencies = "required-after:IC2; "
+ + "required-after:gregtech; "
+ + "required-after:bartworks; "
+ + "required-after:tectech; ")
+public final class GoodGenerator {
+ public static final String MOD_ID = "GoodGenerator";
+ public static final String MOD_NAME = "GRADLETOKEN_MODNAME";
+ public static final String VERSION = "GRADLETOKEN_VERSION";
+
+ public static final CreativeTabs GG = new MyTabs("Good Generator");
+
+ @SidedProxy(clientSide = "goodgenerator.client.ClientProxy",serverSide = "goodgenerator.common.CommonProxy")
+ public static CommonProxy proxy;
+ public static SimpleNetworkWrapper CHANNEL = NetworkRegistry.INSTANCE.newSimpleChannel(MOD_ID);
+
+ static {
+ CHANNEL.registerMessage(MessageSetNeutronSensorData.ServerHandler.class, MessageSetNeutronSensorData.class, 0, Side.SERVER);
+ CHANNEL.registerMessage(MessageOpenNeutronSensorGUI.ClientHandler.class, MessageOpenNeutronSensorGUI.class, 1, Side.CLIENT);
+ }
+
+ @Mod.Instance(GoodGenerator.MOD_ID)
+ public static GoodGenerator instance;
+
+ @Mod.EventHandler
+ public static void preInit(FMLPreInitializationEvent event) {
+ GG_Config_Loader.run();
+ WerkstoffAdderRegistry.addWerkstoffAdder(new MyMaterial());
+ //WerkstoffAdderRegistry.addWerkstoffAdder(new IsotopeMaterialLoader());
+ Loaders.preInitLoad();
+ proxy.preInit(event);
+ }
+ @Mod.EventHandler
+ public static void init(FMLInitializationEvent event) {
+ Loaders.initLoad();
+ proxy.init(event);
+ }
+ @Mod.EventHandler
+ public static void postInit(FMLPostInitializationEvent event) {
+ Loaders.postInitLoad();
+ crossMod();
+ proxy.postInit(event);
+ }
+ @Mod.EventHandler
+ public void onLoadComplete(FMLLoadCompleteEvent event) {
+ //NaquadahReworkRecipeLoader.SmallRecipeChange();
+ NaquadahReworkRecipeLoader.Remover();
+ }
+
+ public static void crossMod() {
+ if (Loader.isModLoaded("Thaumcraft")) {
+ Research.addResearch();
+ }
+ }
+} \ No newline at end of file
diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info
index 1b37becea3..ea26d88ac7 100644
--- a/src/main/resources/mcmod.info
+++ b/src/main/resources/mcmod.info
@@ -3,8 +3,8 @@
"modid": "GoodGenerator",
"name": "Good Generator",
"description": "Add some powerful generators",
- "version": "${version}",
- "mcversion": "${mcversion}",
+ "version": "${modVersion}",
+ "mcversion": "${minecraftVersion}",
"url": "",
"updateUrl": "",
"authorList": ["GlodBlock"],