mirror of
https://github.com/GTNewHorizons/ForgeMultipart.git
synced 2026-11-26 23:13:07 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0106b4e5bc | ||
|
|
12bc43c8d4 | ||
|
|
b0097f4c2e | ||
|
|
3e877b618e | ||
|
|
cce6c61061 | ||
|
|
7c09417b1c | ||
|
|
19a6540aff | ||
|
|
8ee4202610 | ||
|
|
4509df8f1b | ||
|
|
e3a9ba324b | ||
|
|
2e762a04c1 | ||
|
|
6188bc655d | ||
|
|
496eb2b3ea | ||
|
|
24aa5f818e | ||
|
|
aef46a8851 | ||
|
|
e1e0215080 | ||
|
|
54992ccb71 | ||
|
|
77c1b603bc | ||
|
|
d7bc4873ad | ||
|
|
5a36570a35 | ||
|
|
f784161937 | ||
|
|
eb24fc8f62 | ||
|
|
02aad542d6 |
No files matched your search
@@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
name: Build and test
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches: [ master, main ]
|
||||||
|
push:
|
||||||
|
branches: [ master, main ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-test:
|
||||||
|
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/build-and-test.yml@master
|
||||||
|
secrets: inherit
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
# 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 pull request
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
branches: [ master, main ]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
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
|
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
name: Release tagged build
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags: [ '*' ]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release-tags:
|
||||||
|
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/release-tags.yml@master
|
||||||
|
secrets: inherit
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
# 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 release main branch
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ master, main ]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
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
|
|
||||||
|
|
||||||
- uses: "marvinpinto/action-automatic-releases@latest"
|
|
||||||
with:
|
|
||||||
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
|
||||||
automatic_release_tag: "latest"
|
|
||||||
prerelease: true
|
|
||||||
title: "Latest Development Build"
|
|
||||||
files: build/libs/*.jar
|
|
||||||
|
|
||||||
+1
-1
@@ -21,9 +21,9 @@ server.properties
|
|||||||
servers.dat
|
servers.dat
|
||||||
usercache.json
|
usercache.json
|
||||||
whitelist.json
|
whitelist.json
|
||||||
world/
|
|
||||||
/out/
|
/out/
|
||||||
*.iml
|
*.iml
|
||||||
*.ipr
|
*.ipr
|
||||||
*.iws
|
*.iws
|
||||||
src/main/resources/mixins.*.json
|
src/main/resources/mixins.*.json
|
||||||
|
*.bat
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# Any Github changes require admin approval
|
||||||
|
/.github/** @GTNewHorizons/admin
|
||||||
|
|
||||||
+423
-201
@@ -1,53 +1,72 @@
|
|||||||
//version: 21647c763d3f6c90d59c900edae1248239c49dfb
|
//version: 1652851397
|
||||||
/*
|
/*
|
||||||
DO NOT CHANGE THIS FILE!
|
DO NOT CHANGE THIS FILE!
|
||||||
|
|
||||||
Also, you may replace this file at any time if there is an update available.
|
Also, you may replace this file at any time if there is an update available.
|
||||||
Please check https://github.com/SinTh0r4s/ExampleMod1.7.10/blob/main/build.gradle for updates.
|
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.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
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
name = "jitpack"
|
name 'forge'
|
||||||
url = "https://jitpack.io"
|
url 'https://maven.minecraftforge.net'
|
||||||
}
|
}
|
||||||
maven {
|
maven {
|
||||||
name = "forge"
|
name 'sonatype'
|
||||||
url = "https://maven.minecraftforge.net"
|
url 'https://oss.sonatype.org/content/repositories/snapshots/'
|
||||||
}
|
}
|
||||||
maven {
|
maven {
|
||||||
name = "sonatype"
|
name 'Scala CI dependencies'
|
||||||
url = "https://oss.sonatype.org/content/repositories/snapshots/"
|
url 'https://repo1.maven.org/maven2/'
|
||||||
}
|
}
|
||||||
maven {
|
maven {
|
||||||
name = "Scala CI dependencies"
|
name 'jitpack'
|
||||||
url = "https://repo1.maven.org/maven2/"
|
url 'https://jitpack.io'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.github.TheElan:ForgeGradle:1.2.2'
|
classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.7'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("org.ajoberstar.grgit") version("3.1.1")
|
id 'java-library'
|
||||||
id("com.github.johnrengelman.shadow") version("4.0.4")
|
id 'idea'
|
||||||
id("com.palantir.git-version") version("0.12.3")
|
id 'eclipse'
|
||||||
|
id 'scala'
|
||||||
|
id 'maven-publish'
|
||||||
|
id 'org.jetbrains.kotlin.jvm' version '1.5.30' apply false
|
||||||
|
id 'org.jetbrains.kotlin.kapt' version '1.5.30' apply false
|
||||||
|
id '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
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'scala'
|
if (project.file('.git/HEAD').isFile()) {
|
||||||
|
apply plugin: 'com.palantir.git-version'
|
||||||
|
}
|
||||||
|
|
||||||
|
def out = services.get(StyledTextOutputFactory).create('an-output')
|
||||||
|
|
||||||
apply plugin: 'forge'
|
apply plugin: 'forge'
|
||||||
apply plugin: 'idea'
|
|
||||||
|
def projectJavaVersion = JavaLanguageVersion.of(8)
|
||||||
|
|
||||||
java {
|
java {
|
||||||
toolchain {
|
toolchain {
|
||||||
languageVersion.set(JavaLanguageVersion.of(8))
|
languageVersion.set(projectJavaVersion)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,6 +78,10 @@ idea {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(JavaVersion.current() != JavaVersion.VERSION_1_8) {
|
||||||
|
throw new GradleException("This project requires Java 8, but it's running on " + JavaVersion.current())
|
||||||
|
}
|
||||||
|
|
||||||
checkPropertyExists("modName")
|
checkPropertyExists("modName")
|
||||||
checkPropertyExists("modId")
|
checkPropertyExists("modId")
|
||||||
checkPropertyExists("modGroup")
|
checkPropertyExists("modGroup")
|
||||||
@@ -80,33 +103,32 @@ checkPropertyExists("containsMixinsAndOrCoreModOnly")
|
|||||||
checkPropertyExists("usesShadowedDependencies")
|
checkPropertyExists("usesShadowedDependencies")
|
||||||
checkPropertyExists("developmentEnvironmentUserName")
|
checkPropertyExists("developmentEnvironmentUserName")
|
||||||
|
|
||||||
def checkPropertyExists(String propertyName) {
|
boolean noPublishedSources = project.findProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false
|
||||||
if (project.hasProperty(propertyName) == false) {
|
boolean usesMixinDebug = project.findProperty('usesMixinDebug') ?: project.usesMixins.toBoolean()
|
||||||
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/SinTh0r4s/ExampleMod1.7.10/blob/main/gradle.properties")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
String javaSourceDir = "src/main/java/"
|
String javaSourceDir = "src/main/java/"
|
||||||
String scalaSourceDir = "src/main/scala/"
|
String scalaSourceDir = "src/main/scala/"
|
||||||
|
String kotlinSourceDir = "src/main/kotlin/"
|
||||||
|
|
||||||
String targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/")
|
String targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/")
|
||||||
String targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/")
|
String targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/")
|
||||||
if((new File(targetPackageJava).exists() || new File(targetPackageScala).exists()) == false) {
|
String targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/")
|
||||||
throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala)
|
if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) {
|
||||||
|
throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(apiPackage) {
|
if(apiPackage) {
|
||||||
targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
|
targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
|
||||||
targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
|
targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
|
||||||
if((new File(targetPackageJava).exists() || new File(targetPackageScala).exists()) == false) {
|
targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
|
||||||
throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala)
|
if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) {
|
||||||
|
throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(accessTransformersFile) {
|
if(accessTransformersFile) {
|
||||||
String targetFile = "src/main/resources/META-INF/" + accessTransformersFile
|
String targetFile = "src/main/resources/META-INF/" + accessTransformersFile
|
||||||
if(new File(targetFile).exists() == false) {
|
if(!getFile(targetFile).exists()) {
|
||||||
throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile)
|
throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -118,15 +140,17 @@ if(usesMixins.toBoolean()) {
|
|||||||
|
|
||||||
targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
|
targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
|
||||||
targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
|
targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
|
||||||
if((new File(targetPackageJava).exists() || new File(targetPackageScala).exists()) == false) {
|
targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
|
||||||
throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala)
|
if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) {
|
||||||
|
throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin)
|
||||||
}
|
}
|
||||||
|
|
||||||
String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java"
|
String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java"
|
||||||
String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".scala"
|
String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".scala"
|
||||||
String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java"
|
String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java"
|
||||||
if((new File(targetFileJava).exists() || new File(targetFileScala).exists() || new File(targetFileScalaJava).exists()) == false) {
|
String targetFileKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".kt"
|
||||||
throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava)
|
if(!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) {
|
||||||
|
throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,8 +158,9 @@ if(coreModClass) {
|
|||||||
String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java"
|
String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java"
|
||||||
String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".scala"
|
String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".scala"
|
||||||
String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java"
|
String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java"
|
||||||
if((new File(targetFileJava).exists() || new File(targetFileScala).exists() || new File(targetFileScalaJava).exists()) == false) {
|
String targetFileKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".kt"
|
||||||
throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava)
|
if(!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) {
|
||||||
|
throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,15 +173,64 @@ configurations.all {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fix Jenkins' Git: chmod a file should not be detected as a change and append a '.dirty' to the version
|
// 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()
|
try {
|
||||||
// Pulls version from git tag
|
'git config core.fileMode false'.execute()
|
||||||
version = minecraftVersion + "-" + gitVersion()
|
}
|
||||||
|
catch (Exception ignored) {
|
||||||
|
out.style(Style.Failure).println("git isn't installed at all")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pulls version first from the VERSION env and then git tag
|
||||||
|
String identifiedVersion
|
||||||
|
String versionOverride = System.getenv("VERSION") ?: null
|
||||||
|
try {
|
||||||
|
identifiedVersion = versionOverride == null ? gitVersion() : versionOverride
|
||||||
|
}
|
||||||
|
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' +
|
||||||
|
'clone the repository, see ').style(Style.Info).text('https://gtnh.miraheze.org/wiki/Development').style(Style.SuccessHeader).println(' for details.)'
|
||||||
|
)
|
||||||
|
versionOverride = 'NO-GIT-TAG-SET'
|
||||||
|
identifiedVersion = versionOverride
|
||||||
|
}
|
||||||
|
version = minecraftVersion + '-' + identifiedVersion
|
||||||
|
ext {
|
||||||
|
modVersion = identifiedVersion
|
||||||
|
}
|
||||||
|
|
||||||
|
if(identifiedVersion == versionOverride) {
|
||||||
|
out.style(Style.Failure).text('Override version to ').style(Style.Identifier).text(modVersion).style(Style.Failure).println('!\7')
|
||||||
|
}
|
||||||
|
|
||||||
group = modGroup
|
group = modGroup
|
||||||
archivesBaseName = modId
|
if(project.hasProperty("customArchiveBaseName") && customArchiveBaseName) {
|
||||||
|
archivesBaseName = customArchiveBaseName
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
archivesBaseName = modId
|
||||||
|
}
|
||||||
|
|
||||||
|
def arguments = []
|
||||||
|
def jvmArguments = []
|
||||||
|
|
||||||
|
if (usesMixins.toBoolean()) {
|
||||||
|
arguments += [
|
||||||
|
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
|
||||||
|
]
|
||||||
|
if (usesMixinDebug.toBoolean()) {
|
||||||
|
jvmArguments += [
|
||||||
|
"-Dmixin.debug.countInjections=true",
|
||||||
|
"-Dmixin.debug.verbose=true",
|
||||||
|
"-Dmixin.debug.export=true"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
minecraft {
|
minecraft {
|
||||||
version = minecraftVersion + "-" + forgeVersion + "-" + minecraftVersion
|
version = minecraftVersion + '-' + forgeVersion + '-' + minecraftVersion
|
||||||
runDir = "run"
|
runDir = 'run'
|
||||||
|
|
||||||
if (replaceGradleTokenInFile) {
|
if (replaceGradleTokenInFile) {
|
||||||
replaceIn replaceGradleTokenInFile
|
replaceIn replaceGradleTokenInFile
|
||||||
@@ -166,139 +240,133 @@ minecraft {
|
|||||||
if(gradleTokenModName) {
|
if(gradleTokenModName) {
|
||||||
replace gradleTokenModName, modName
|
replace gradleTokenModName, modName
|
||||||
}
|
}
|
||||||
if(gradleTokenModName) {
|
if(gradleTokenVersion) {
|
||||||
replace gradleTokenVersion, versionDetails().lastTag
|
replace gradleTokenVersion, modVersion
|
||||||
}
|
}
|
||||||
if(gradleTokenGroupName) {
|
if(gradleTokenGroupName) {
|
||||||
replace gradleTokenGroupName, modGroup
|
replace gradleTokenGroupName, modGroup
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clientIntellijRun {
|
||||||
|
args(arguments)
|
||||||
|
jvmArgs(jvmArguments)
|
||||||
|
|
||||||
|
if(developmentEnvironmentUserName) {
|
||||||
|
args("--username", developmentEnvironmentUserName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
serverIntellijRun {
|
||||||
|
args(arguments)
|
||||||
|
jvmArgs(jvmArguments)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(file("addon.gradle").exists()) {
|
if(file('addon.gradle').exists()) {
|
||||||
apply from: "addon.gradle"
|
apply from: 'addon.gradle'
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: 'repositories.gradle'
|
apply from: 'repositories.gradle'
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
implementation.extendsFrom(shadowImplementation)
|
implementation.extendsFrom(shadowImplementation) // TODO: remove after all uses are refactored
|
||||||
|
implementation.extendsFrom(shadowCompile)
|
||||||
|
implementation.extendsFrom(shadeCompile)
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
maven {
|
||||||
|
name 'Overmind forge repo mirror'
|
||||||
|
url 'https://gregtech.overminddl1.com/'
|
||||||
|
}
|
||||||
if(usesMixins.toBoolean()) {
|
if(usesMixins.toBoolean()) {
|
||||||
maven {
|
maven {
|
||||||
name = "sponge"
|
name 'sponge'
|
||||||
url = "https://repo.spongepowered.org/repository/maven-public"
|
url 'https://repo.spongepowered.org/repository/maven-public'
|
||||||
}
|
}
|
||||||
maven {
|
maven {
|
||||||
url = "https://jitpack.io"
|
url 'https://jitpack.io'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
if(usesMixins.toBoolean()) {
|
if(usesMixins.toBoolean()) {
|
||||||
annotationProcessor("org.ow2.asm:asm-debug-all:5.0.3")
|
annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3')
|
||||||
annotationProcessor("com.google.guava:guava:24.1.1-jre")
|
annotationProcessor('com.google.guava:guava:24.1.1-jre')
|
||||||
annotationProcessor("com.google.code.gson:gson:2.8.6")
|
annotationProcessor('com.google.code.gson:gson:2.8.6')
|
||||||
annotationProcessor("org.spongepowered:mixin:0.8-SNAPSHOT")
|
annotationProcessor('org.spongepowered:mixin:0.8-SNAPSHOT')
|
||||||
// using 0.8 to workaround a issue in 0.7 which fails mixin application
|
// using 0.8 to workaround a issue in 0.7 which fails mixin application
|
||||||
compile("org.spongepowered:mixin:0.7.11-SNAPSHOT") {
|
compile('com.github.GTNewHorizons:SpongePoweredMixin:0.7.12-GTNH') {
|
||||||
// Mixin includes a lot of dependencies that are too up-to-date
|
// Mixin includes a lot of dependencies that are too up-to-date
|
||||||
exclude module: "launchwrapper"
|
exclude module: 'launchwrapper'
|
||||||
exclude module: "guava"
|
exclude module: 'guava'
|
||||||
exclude module: "gson"
|
exclude module: 'gson'
|
||||||
exclude module: "commons-io"
|
exclude module: 'commons-io'
|
||||||
exclude module: "log4j-core"
|
exclude module: 'log4j-core'
|
||||||
}
|
}
|
||||||
compile("com.github.GTNewHorizons:SpongeMixins:1.3.3:dev")
|
compile('com.github.GTNewHorizons:SpongeMixins:1.5.0')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: 'dependencies.gradle'
|
apply from: 'dependencies.gradle'
|
||||||
|
|
||||||
task relocateShadowJar(type: ConfigureShadowRelocation) {
|
def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json'
|
||||||
target = tasks.shadowJar
|
|
||||||
prefix = modGroup + ".shadow"
|
|
||||||
}
|
|
||||||
|
|
||||||
def mixinConfigJson = "mixins." + modId + ".json"
|
|
||||||
def mixingConfigRefMap = "mixins." + modId + ".refmap.json"
|
|
||||||
def refMap = "${tasks.compileJava.temporaryDir}" + File.separator + mixingConfigRefMap
|
def refMap = "${tasks.compileJava.temporaryDir}" + File.separator + mixingConfigRefMap
|
||||||
def mixinSrg = "${tasks.reobf.temporaryDir}" + File.separator + "mixins.srg"
|
def mixinSrg = "${tasks.reobf.temporaryDir}" + File.separator + "mixins.srg"
|
||||||
|
|
||||||
task generateAssets {
|
task generateAssets {
|
||||||
if(usesMixins.toBoolean()) {
|
if (usesMixins.toBoolean()) {
|
||||||
new File(projectDir.toString() + "/src/main/resources/", mixinConfigJson).text = """{
|
def mixinConfigFile = getFile("/src/main/resources/mixins." + modId + ".json");
|
||||||
|
if (!mixinConfigFile.exists()) {
|
||||||
|
mixinConfigFile.text = """{
|
||||||
"required": true,
|
"required": true,
|
||||||
"minVersion": "0.7.11",
|
"minVersion": "0.7.11",
|
||||||
"package": "${modGroup}.${mixinsPackage}",
|
"package": "${modGroup}.${mixinsPackage}",
|
||||||
"plugin": "${modGroup}.${mixinPlugin}",
|
"plugin": "${modGroup}.${mixinPlugin}",
|
||||||
"refmap": "${mixingConfigRefMap}",
|
"refmap": "${mixingConfigRefMap}",
|
||||||
"target": "@env(DEFAULT)",
|
"target": "@env(DEFAULT)",
|
||||||
"compatibilityLevel": "JAVA_8"
|
"compatibilityLevel": "JAVA_8",
|
||||||
|
"mixins": [],
|
||||||
|
"client": [],
|
||||||
|
"server": []
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"""
|
task relocateShadowJar(type: ConfigureShadowRelocation) {
|
||||||
}
|
target = tasks.shadowJar
|
||||||
|
prefix = modGroup + ".shadow"
|
||||||
}
|
}
|
||||||
|
|
||||||
shadowJar {
|
shadowJar {
|
||||||
def manifestAttributes = [:]
|
project.configurations.shadeCompile.each { dep ->
|
||||||
if(containsMixinsAndOrCoreModOnly.toBoolean() == false) {
|
from(project.zipTree(dep)) {
|
||||||
manifestAttributes += ["FMLCorePluginContainsFMLMod": true]
|
exclude 'META-INF', 'META-INF/**'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(accessTransformersFile) {
|
|
||||||
manifestAttributes += ["FMLAT" : accessTransformersFile.toString()]
|
|
||||||
}
|
|
||||||
|
|
||||||
if(coreModClass) {
|
|
||||||
manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass]
|
|
||||||
}
|
|
||||||
|
|
||||||
if(usesMixins.toBoolean()) {
|
|
||||||
from refMap
|
|
||||||
manifestAttributes += [
|
|
||||||
"TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
|
|
||||||
"MixinConfigs" : mixinConfigJson,
|
|
||||||
"ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false
|
|
||||||
]
|
|
||||||
}
|
|
||||||
manifest {
|
manifest {
|
||||||
attributes(manifestAttributes)
|
attributes(getManifestAttributes())
|
||||||
}
|
}
|
||||||
|
|
||||||
minimize()
|
minimize() // This will only allow shading for actually used classes
|
||||||
configurations = [project.configurations.shadowImplementation]
|
configurations = [project.configurations.shadowImplementation, project.configurations.shadowCompile]
|
||||||
dependsOn(relocateShadowJar)
|
dependsOn(relocateShadowJar)
|
||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
def manifestAttributes = [:]
|
project.configurations.shadeCompile.each { dep ->
|
||||||
if(containsMixinsAndOrCoreModOnly.toBoolean() == false) {
|
from(project.zipTree(dep)) {
|
||||||
manifestAttributes += ["FMLCorePluginContainsFMLMod": true]
|
exclude 'META-INF', 'META-INF/**'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(accessTransformersFile) {
|
|
||||||
manifestAttributes += ["FMLAT" : accessTransformersFile.toString()]
|
|
||||||
}
|
|
||||||
|
|
||||||
if(coreModClass) {
|
|
||||||
manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass]
|
|
||||||
}
|
|
||||||
|
|
||||||
if(usesMixins.toBoolean()) {
|
|
||||||
from refMap
|
|
||||||
manifestAttributes += [
|
|
||||||
"TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
|
|
||||||
"MixinConfigs" : mixinConfigJson,
|
|
||||||
"ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false
|
|
||||||
]
|
|
||||||
}
|
|
||||||
manifest {
|
manifest {
|
||||||
attributes(manifestAttributes)
|
attributes(getManifestAttributes())
|
||||||
}
|
}
|
||||||
|
|
||||||
if(usesShadowedDependencies.toBoolean()) {
|
if(usesShadowedDependencies.toBoolean()) {
|
||||||
@@ -329,15 +397,6 @@ afterEvaluate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
runClient {
|
runClient {
|
||||||
def arguments = []
|
|
||||||
|
|
||||||
if(usesMixins.toBoolean()) {
|
|
||||||
arguments += [
|
|
||||||
"--mods=../build/libs/$modId-${version}.jar",
|
|
||||||
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
if(developmentEnvironmentUserName) {
|
if(developmentEnvironmentUserName) {
|
||||||
arguments += [
|
arguments += [
|
||||||
"--username",
|
"--username",
|
||||||
@@ -346,51 +405,51 @@ runClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
args(arguments)
|
args(arguments)
|
||||||
|
jvmArgs(jvmArguments)
|
||||||
}
|
}
|
||||||
|
|
||||||
runServer {
|
runServer {
|
||||||
def arguments = []
|
|
||||||
|
|
||||||
if(usesMixins.toBoolean()) {
|
|
||||||
arguments += [
|
|
||||||
"--mods=../build/libs/$modId-${version}.jar",
|
|
||||||
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
args(arguments)
|
args(arguments)
|
||||||
|
jvmArgs(jvmArguments)
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources
|
tasks.withType(JavaExec).configureEach {
|
||||||
{
|
javaLauncher.set(
|
||||||
// this will ensure that this task is redone when the versions change.
|
javaToolchains.launcherFor {
|
||||||
inputs.property "version", project.version
|
languageVersion = projectJavaVersion
|
||||||
inputs.property "mcversion", project.minecraft.version
|
|
||||||
|
|
||||||
// replace stuff in mcmod.info, nothing else
|
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
|
||||||
include 'mcmod.info'
|
|
||||||
|
|
||||||
// replace version and mcversion
|
|
||||||
expand "minecraftVersion": project.minecraft.version,
|
|
||||||
"modVersion": versionDetails().lastTag,
|
|
||||||
"modId": modId,
|
|
||||||
"modName": modName
|
|
||||||
}
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
// copy everything else, thats not the mcmod.info
|
processResources {
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
// this will ensure that this task is redone when the versions change.
|
||||||
exclude 'mcmod.info'
|
inputs.property "version", project.version
|
||||||
}
|
inputs.property "mcversion", project.minecraft.version
|
||||||
}
|
|
||||||
|
|
||||||
task sourcesJar(type: Jar) {
|
// replace stuff in mcmod.info, nothing else
|
||||||
from (sourceSets.main.allJava)
|
from(sourceSets.main.resources.srcDirs) {
|
||||||
from (file("$projectDir/LICENSE"))
|
include 'mcmod.info'
|
||||||
getArchiveClassifier().set('sources')
|
|
||||||
|
|
||||||
|
// replace modVersion and minecraftVersion
|
||||||
|
expand "minecraftVersion": project.minecraft.version,
|
||||||
|
"modVersion": modVersion,
|
||||||
|
"modId": modId,
|
||||||
|
"modName": modName
|
||||||
|
}
|
||||||
|
|
||||||
|
if(usesMixins.toBoolean()) {
|
||||||
|
from refMap
|
||||||
|
}
|
||||||
|
|
||||||
|
// copy everything else that's not the mcmod.info
|
||||||
|
from(sourceSets.main.resources.srcDirs) {
|
||||||
|
exclude 'mcmod.info'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def getManifestAttributes() {
|
||||||
def manifestAttributes = [:]
|
def manifestAttributes = [:]
|
||||||
if(containsMixinsAndOrCoreModOnly.toBoolean() == false) {
|
if(!containsMixinsAndOrCoreModOnly.toBoolean() && (usesMixins.toBoolean() || coreModClass)) {
|
||||||
manifestAttributes += ["FMLCorePluginContainsFMLMod": true]
|
manifestAttributes += ["FMLCorePluginContainsFMLMod": true]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -403,55 +462,77 @@ task sourcesJar(type: Jar) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(usesMixins.toBoolean()) {
|
if(usesMixins.toBoolean()) {
|
||||||
from refMap
|
|
||||||
manifestAttributes += [
|
manifestAttributes += [
|
||||||
"TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
|
"TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
|
||||||
"MixinConfigs" : mixinConfigJson,
|
"MixinConfigs" : "mixins." + modId + ".json",
|
||||||
"ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false
|
"ForceLoadAsMod" : !containsMixinsAndOrCoreModOnly.toBoolean()
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
manifest {
|
return manifestAttributes
|
||||||
attributes(manifestAttributes)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
task devJar(type: Jar) {
|
task sourcesJar(type: Jar) {
|
||||||
|
from (sourceSets.main.allSource)
|
||||||
|
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
|
from sourceSets.main.output
|
||||||
getArchiveClassifier().set("dev")
|
getArchiveClassifier().set("dev")
|
||||||
|
|
||||||
def manifestAttributes = [:]
|
|
||||||
if(containsMixinsAndOrCoreModOnly.toBoolean() == false) {
|
|
||||||
manifestAttributes += ["FMLCorePluginContainsFMLMod": true]
|
|
||||||
}
|
|
||||||
|
|
||||||
if(accessTransformersFile) {
|
|
||||||
manifestAttributes += ["FMLAT" : accessTransformersFile.toString()]
|
|
||||||
}
|
|
||||||
|
|
||||||
if(coreModClass) {
|
|
||||||
manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass]
|
|
||||||
}
|
|
||||||
|
|
||||||
if(usesMixins.toBoolean()) {
|
|
||||||
from refMap
|
|
||||||
manifestAttributes += [
|
|
||||||
"TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
|
|
||||||
"MixinConfigs" : mixinConfigJson,
|
|
||||||
"ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false
|
|
||||||
]
|
|
||||||
}
|
|
||||||
manifest {
|
manifest {
|
||||||
attributes(manifestAttributes)
|
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) {
|
||||||
|
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 apiJar(type: Jar) {
|
task apiJar(type: Jar) {
|
||||||
from (sourceSets.main.allJava) {
|
from (sourceSets.main.allSource) {
|
||||||
include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString() + '/**'
|
include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**'
|
||||||
}
|
}
|
||||||
|
|
||||||
from (sourceSets.main.output) {
|
from (sourceSets.main.output) {
|
||||||
include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString() + '/**'
|
include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**'
|
||||||
}
|
}
|
||||||
|
|
||||||
from (sourceSets.main.resources.srcDirs) {
|
from (sourceSets.main.resources.srcDirs) {
|
||||||
@@ -462,48 +543,111 @@ task apiJar(type: Jar) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
artifacts {
|
artifacts {
|
||||||
archives sourcesJar
|
if(!noPublishedSources) {
|
||||||
|
archives sourcesJar
|
||||||
|
}
|
||||||
archives devJar
|
archives devJar
|
||||||
if(apiPackage) {
|
if(apiPackage) {
|
||||||
archives apiJar
|
archives apiJar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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) {
|
||||||
|
from components.java
|
||||||
|
if(usesShadowedDependencies.toBoolean()) {
|
||||||
|
artifact source: shadowJar, classifier: ""
|
||||||
|
}
|
||||||
|
if(!noPublishedSources) {
|
||||||
|
artifact source: sourcesJar, classifier: "sources"
|
||||||
|
}
|
||||||
|
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
|
||||||
|
|
||||||
|
// remove extra garbage from minecraft and minecraftDeps configuration
|
||||||
|
pom.withXml {
|
||||||
|
def badArtifacts = [:].withDefault {[] as Set<String>}
|
||||||
|
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() {
|
||||||
|
badArtifacts[it.groupId.text()].contains(it.artifactId.text())
|
||||||
|
}.each() {
|
||||||
|
it.parent().remove(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
// Updating
|
||||||
task updateBuildScript {
|
task updateBuildScript {
|
||||||
doLast {
|
doLast {
|
||||||
if (updateBuildScript()) return
|
if (performBuildScriptUpdate(projectDir.toString())) return
|
||||||
|
|
||||||
print("Build script already up-to-date!")
|
print("Build script already up-to-date!")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isNewBuildScriptVersionAvailable()) {
|
if (isNewBuildScriptVersionAvailable(projectDir.toString())) {
|
||||||
if (autoUpdateBuildScript.toBoolean()) {
|
if (autoUpdateBuildScript.toBoolean()) {
|
||||||
updateBuildScript()
|
performBuildScriptUpdate(projectDir.toString())
|
||||||
} else {
|
} else {
|
||||||
println("Build script update available! Run 'gradle updateBuildScript'")
|
out.style(Style.SuccessHeader).println("Build script update available! Run 'gradle updateBuildScript'")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static URL availableBuildScriptUrl() {
|
static URL availableBuildScriptUrl() {
|
||||||
new URL("https://raw.githubusercontent.com/SinTh0r4s/ExampleMod1.7.10/main/build.gradle")
|
new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/main/build.gradle")
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean updateBuildScript() {
|
boolean performBuildScriptUpdate(String projectDir) {
|
||||||
if (isNewBuildScriptVersionAvailable()) {
|
if (isNewBuildScriptVersionAvailable(projectDir)) {
|
||||||
def buildscriptFile = new File("build.gradle")
|
def buildscriptFile = getFile("build.gradle")
|
||||||
availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } }
|
availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } }
|
||||||
print("Build script updated. Please REIMPORT the project or RESTART your IDE!")
|
out.style(Style.Success).print("Build script updated. Please REIMPORT the project or RESTART your IDE!")
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean isNewBuildScriptVersionAvailable() {
|
boolean isNewBuildScriptVersionAvailable(String projectDir) {
|
||||||
Map parameters = ["connectTimeout": 2000, "readTimeout": 2000]
|
Map parameters = ["connectTimeout": 2000, "readTimeout": 2000]
|
||||||
|
|
||||||
String currentBuildScript = new File("build.gradle").getText()
|
String currentBuildScript = getFile("build.gradle").getText()
|
||||||
String currentBuildScriptHash = getVersionHash(currentBuildScript)
|
String currentBuildScriptHash = getVersionHash(currentBuildScript)
|
||||||
String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText()
|
String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText()
|
||||||
String availableBuildScriptHash = getVersionHash(availableBuildScript)
|
String availableBuildScriptHash = getVersionHash(availableBuildScript)
|
||||||
@@ -524,3 +668,81 @@ configure(updateBuildScript) {
|
|||||||
group = 'forgegradle'
|
group = 'forgegradle'
|
||||||
description = 'Updates the build script to the latest version'
|
description = 'Updates the build script to the latest version'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Deobfuscation
|
||||||
|
|
||||||
|
def deobf(String sourceURL) {
|
||||||
|
try {
|
||||||
|
URL url = new URL(sourceURL)
|
||||||
|
String fileName = url.getFile()
|
||||||
|
|
||||||
|
//get rid of directories:
|
||||||
|
int lastSlash = fileName.lastIndexOf("/")
|
||||||
|
if(lastSlash > 0) {
|
||||||
|
fileName = fileName.substring(lastSlash + 1)
|
||||||
|
}
|
||||||
|
//get rid of extension:
|
||||||
|
if(fileName.endsWith(".jar")) {
|
||||||
|
fileName = fileName.substring(0, fileName.lastIndexOf("."))
|
||||||
|
}
|
||||||
|
|
||||||
|
String hostName = url.getHost()
|
||||||
|
if(hostName.startsWith("www.")) {
|
||||||
|
hostName = hostName.substring(4)
|
||||||
|
}
|
||||||
|
List parts = Arrays.asList(hostName.split("\\."))
|
||||||
|
Collections.reverse(parts)
|
||||||
|
hostName = String.join(".", parts)
|
||||||
|
|
||||||
|
return deobf(sourceURL, hostName + "/" + fileName)
|
||||||
|
} catch(Exception e) {
|
||||||
|
return deobf(sourceURL, "deobf/" + String.valueOf(sourceURL.hashCode()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// The method above is to be preferred. Use this method if the filename is not at the end of the URL.
|
||||||
|
def deobf(String sourceURL, String fileName) {
|
||||||
|
String cacheDir = System.getProperty("user.home") + "/.gradle/caches/"
|
||||||
|
String bon2Dir = cacheDir + "forge_gradle/deobf"
|
||||||
|
String bon2File = bon2Dir + "/BON2-2.5.0.jar"
|
||||||
|
String obfFile = cacheDir + "modules-2/files-2.1/" + fileName + ".jar"
|
||||||
|
String deobfFile = cacheDir + "modules-2/files-2.1/" + fileName + "-deobf.jar"
|
||||||
|
|
||||||
|
if(file(deobfFile).exists()) {
|
||||||
|
return files(deobfFile)
|
||||||
|
}
|
||||||
|
|
||||||
|
download.run {
|
||||||
|
src 'https://github.com/GTNewHorizons/BON2/releases/download/2.5.0/BON2-2.5.0.CUSTOM-all.jar'
|
||||||
|
dest bon2File
|
||||||
|
quiet true
|
||||||
|
overwrite false
|
||||||
|
}
|
||||||
|
|
||||||
|
download.run {
|
||||||
|
src sourceURL
|
||||||
|
dest obfFile
|
||||||
|
quiet true
|
||||||
|
overwrite false
|
||||||
|
}
|
||||||
|
|
||||||
|
exec {
|
||||||
|
commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', '1.7.10', '--mappingsVer', 'stable_12', '--notch'
|
||||||
|
workingDir bon2Dir
|
||||||
|
standardOutput = new ByteArrayOutputStream()
|
||||||
|
}
|
||||||
|
|
||||||
|
return files(deobfFile)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Helper methods
|
||||||
|
|
||||||
|
def checkPropertyExists(String propertyName) {
|
||||||
|
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")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def getFile(String relativePath) {
|
||||||
|
return new File(projectDir, relativePath)
|
||||||
|
}
|
||||||
+2
-4
@@ -1,8 +1,6 @@
|
|||||||
// Add your dependencies here
|
// Add your dependencies here
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile("codechicken:CodeChickenLib:1.7.10-1.1.3.140:dev")
|
compile("com.github.GTNewHorizons:CodeChickenLib:1.1.5.5:dev")
|
||||||
compile("codechicken:NotEnoughItems:1.7.10-1.0.5.120:dev")
|
compile("com.github.GTNewHorizons:NotEnoughItems:2.3.5-GTNH:dev")
|
||||||
|
|
||||||
runtime("codechicken:CodeChickenCore:1.7.10-1.0.7.47:dev")
|
|
||||||
}
|
}
|
||||||
+1
-1
@@ -18,7 +18,7 @@ forgeVersion = 10.13.4.1614
|
|||||||
# restart Minecraft in development. Choose this dependent on your mod:
|
# 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 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
|
# 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:
|
# Define a source file of your project with:
|
||||||
# public static final String VERSION = "GRADLETOKEN_VERSION";
|
# public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||||
|
|||||||
+5
-2
@@ -2,7 +2,10 @@
|
|||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
name = "chickenbones"
|
name = "GTNH"
|
||||||
url = "http://chickenbones.net/maven"
|
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
url = "https://jitpack.io"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"repo": "http://files.minecraftforge.net/maven/codechicken/CodeChickenLib/${mc_version}-${ccl_version}/",
|
"repo": "https://github.com/GTNewHorizons/CodeChickenLib/releases/download/1.1.5.5/",
|
||||||
"file": "CodeChickenLib-${mc_version}-${ccl_version}-universal.jar",
|
"file": "CodeChickenLib-1.7.10-1.1.5.5.jar",
|
||||||
"dev": "CodeChickenLib-${mc_version}-${ccl_version}-dev.jar",
|
"dev": "https://github.com/GTNewHorizons/CodeChickenLib/releases/download/1.1.5.5/CodeChickenLib-1.7.10-1.1.5.5-dev.jar",
|
||||||
"class": "codechicken.lib.asm.ASMHelper"
|
"class": "codechicken.lib.asm.ASMHelper",
|
||||||
|
"coreLib": true
|
||||||
}
|
}
|
||||||
@@ -132,8 +132,6 @@ object MicroMaterialRegistry
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug("Registered micro material: " + name)
|
|
||||||
|
|
||||||
typeMap.put(name, material)
|
typeMap.put(name, material)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,16 +9,19 @@ import cpw.mods.fml.relauncher.Side
|
|||||||
import net.minecraft.item.crafting.CraftingManager
|
import net.minecraft.item.crafting.CraftingManager
|
||||||
import net.minecraft.item.Item
|
import net.minecraft.item.Item
|
||||||
import net.minecraft.item.crafting.IRecipe
|
import net.minecraft.item.crafting.IRecipe
|
||||||
|
|
||||||
import java.util.{List => JList}
|
import java.util.{List => JList}
|
||||||
import codechicken.lib.config.ConfigFile
|
import codechicken.lib.config.ConfigFile
|
||||||
import net.minecraftforge.oredict.OreDictionary
|
import net.minecraftforge.oredict.OreDictionary
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
import net.minecraftforge.oredict.ShapedOreRecipe
|
import net.minecraftforge.oredict.ShapedOreRecipe
|
||||||
import codechicken.lib.packet.PacketCustom
|
import codechicken.lib.packet.PacketCustom
|
||||||
|
import cpw.mods.fml.common.Loader
|
||||||
import cpw.mods.fml.common.registry.GameRegistry
|
import cpw.mods.fml.common.registry.GameRegistry
|
||||||
import net.minecraft.client.renderer.RenderBlocks
|
import net.minecraft.client.renderer.RenderBlocks
|
||||||
import net.minecraft.init.{Blocks, Items}
|
import net.minecraft.init.{Blocks, Items}
|
||||||
import org.apache.logging.log4j.Logger
|
import org.apache.logging.log4j.Logger
|
||||||
|
|
||||||
import scala.collection.mutable
|
import scala.collection.mutable
|
||||||
|
|
||||||
class MicroblockProxy_serverImpl
|
class MicroblockProxy_serverImpl
|
||||||
@@ -70,10 +73,12 @@ class MicroblockProxy_serverImpl
|
|||||||
|
|
||||||
def init() {
|
def init() {
|
||||||
CraftingManager.getInstance.getRecipeList.asInstanceOf[JList[IRecipe]].add(MicroRecipe)
|
CraftingManager.getInstance.getRecipeList.asInstanceOf[JList[IRecipe]].add(MicroRecipe)
|
||||||
CraftingManager.getInstance.addRecipe(new ItemStack(stoneRod, 4), "s", "s", 's': Character, Blocks.stone)
|
if (!Loader.isModLoaded("dreamcraft")) {
|
||||||
addSawRecipe(sawStone, Items.flint)
|
CraftingManager.getInstance.addRecipe(new ItemStack(stoneRod, 4), "s", "s", 's': Character, Blocks.stone)
|
||||||
addSawRecipe(sawIron, Items.iron_ingot)
|
addSawRecipe(sawStone, Items.flint)
|
||||||
addSawRecipe(sawDiamond, Items.diamond)
|
addSawRecipe(sawIron, Items.iron_ingot)
|
||||||
|
addSawRecipe(sawDiamond, Items.diamond)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def postInit() {
|
def postInit() {
|
||||||
|
|||||||
@@ -191,6 +191,9 @@ class BlockMultipart extends Block(Material.rock)
|
|||||||
val tile = getTile(world, x, y, z)
|
val tile = getTile(world, x, y, z)
|
||||||
if(tile != null)
|
if(tile != null)
|
||||||
{
|
{
|
||||||
|
if (!hit.isInstanceOf[ExtendedMOP]) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
val (index, mop) = reduceMOP(hit)
|
val (index, mop) = reduceMOP(hit)
|
||||||
return tile.partList(index).pickItem(mop)
|
return tile.partList(index).pickItem(mop)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,8 +124,6 @@ object MultiPartRegistry
|
|||||||
if (typeMap.contains(s))
|
if (typeMap.contains(s))
|
||||||
throw new IllegalStateException("Part with id " + s + " is already registered.")
|
throw new IllegalStateException("Part with id " + s + " is already registered.")
|
||||||
|
|
||||||
logger.debug("Registered multipart: "+s)
|
|
||||||
|
|
||||||
typeMap.put(s, partFactory)
|
typeMap.put(s, partFactory)
|
||||||
containers.put(s, container)
|
containers.put(s, container)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -579,7 +579,7 @@ object ASMMixinCompiler
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fields += FieldMixin(sym.name.trim, getReturnType(sym.jDesc).getDescriptor,
|
fields += FieldMixin(sym.name.trim, sym.jDesc,
|
||||||
if (fieldAccessors(sym.name.trim).isPrivate) ACC_PRIVATE else ACC_PUBLIC)
|
if (fieldAccessors(sym.name.trim).isPrivate) ACC_PRIVATE else ACC_PUBLIC)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user