Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensworks committed Jun 17, 2024
1 parent 4811615 commit acd9842
Show file tree
Hide file tree
Showing 381 changed files with 3,021 additions and 2,831 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ jobs:
SIGN_STOREPASS: ${{ secrets.SIGN_STOREPASS }}
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_KEY: ${{ secrets.MAVEN_KEY }}
GITHUB_USER: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: 'Test'
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
doc/info.txt
/build
/run
/runs

# Ignore project specific files
.classpath
Expand All @@ -17,6 +18,7 @@ repo/*
*.iws
out/*
keystore.jks
.idea

# Ignore mac-specific file(s)
.DS_Store
Expand Down
159 changes: 75 additions & 84 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
plugins {
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
id 'com.matthewprenger.cursegradle' version '1.4.0'
id 'net.neoforged.gradle.userdev' version '7.0.97'
id 'net.darkhax.curseforgegradle' version '1.0.8'
id 'com.github.kt3k.coveralls' version '2.10.2'
id 'com.diffplug.spotless' version '5.14.3'
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'com.modrinth.minotaur' version '2.+'
}

apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'idea'
apply plugin: 'maven-publish'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'jacoco'

import net.minecraftforge.gradle.common.tasks.SignJar
import net.neoforged.gradle.common.tasks.PotentiallySignJar

// Determine build number
String build_number = "DEV" // this will be referenced as simply build_number from now on.
Expand All @@ -30,7 +29,10 @@ logger.lifecycle "BUILDING VERSION: " + build_number
// Set mod details
version = project.mod_version
group = "org.cyclops.evilcraft"
archivesBaseName = "EvilCraft"
archivesBaseName = "EvilCraft-${project.minecraft_version}-neoforge"
base {
archivesName = archivesBaseName
}

// Set Java details
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
Expand All @@ -51,6 +53,7 @@ sourceSets {
main
test
}
sourceSets.main.resources { srcDir 'src/generated/resources' }

configurations {
shadow.setTransitive(true);
Expand All @@ -69,32 +72,33 @@ repositories {
name "Cyclops Repo"
url "https://maven.pkg.github.com/CyclopsMC/packages"
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("MAVEN_USERNAME")
password = project.findProperty("gpr.key") ?: System.getenv("MAVEN_KEY")
username = project.findProperty("gpr.user") ?: System.getenv("MAVEN_USERNAME") ?: System.getenv("GITHUB_USER")
password = project.findProperty("gpr.key") ?: System.getenv("MAVEN_KEY") ?: System.getenv("GITHUB_TOKEN")
}
}
}

dependencies {
minecraft "net.minecraftforge:forge:${project.minecraft_version}-${project.forge_version}"
implementation "net.neoforged:neoforge:${project.neoforge_version}"

// Add something like 'cyclopscore_version_local=0.1.0-DEV' to your secrets.properties if you want to use a custom local CyclopsCore version.
if(secrets.cyclopscore_version_local) {
implementation "org.cyclops.cyclopscore:cyclopscore:${project.minecraft_version}-${secrets.cyclopscore_version_local}:deobf"
implementation "org.cyclops.cyclopscore:cyclopscore-${project.minecraft_version}-neoforge:${secrets.cyclopscore_version_local}:deobf"
} else {
implementation "org.cyclops.cyclopscore:cyclopscore:${project.minecraft_version}-${project.cyclopscore_version}:deobf"
implementation "org.cyclops.cyclopscore:cyclopscore-${project.minecraft_version}-neoforge:${project.cyclopscore_version}:deobf"
}

// Add something like 'evilcraftcompat_version_local=0.1.0-DEV' to your secrets.properties if you want to use a custom local EvilCraft Compat version.
if(secrets.evilcraftcompat_version_local) {
shadow("org.cyclops.evilcraftcompat:evilcraftcompat:${secrets.evilcraftcompat_version_local}") {
transitive = false
}
} else {
shadow("org.cyclops.evilcraftcompat:evilcraftcompat:${project.evilcraftcompat_version}") {
transitive = false
}
}
// TODO
// if(secrets.evilcraftcompat_version_local) {
// shadow("org.cyclops.evilcraftcompat:evilcraftcompat-${project.minecraft_version}-neoforge:${secrets.evilcraftcompat_version_local}") {
// transitive = false
// }
// } else {
// shadow("org.cyclops.evilcraftcompat:evilcraftcompat-${project.minecraft_version}-neoforge:${project.evilcraftcompat_version}") {
// transitive = false
// }
// }

// Project lombok
compileOnly 'org.projectlombok:lombok:1.18.22'
Expand All @@ -106,49 +110,41 @@ dependencies {
}

minecraft {
mappings channel: "official", version: "${project.minecraft_version}"

accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')

runs {
client {
workingDirectory project.file('run')
//property 'forge.logging.markers', 'REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
mods {
evilcraft {
source sourceSets.main
}
}
}
accessTransformers {
file('src/main/resources/META-INF/accesstransformer.cfg')
}
}

server {
workingDirectory project.file('run')
property 'forge.logging.console.level', 'debug'
mods {
evilcraft {
source sourceSets.main
}
}
}
runs {
configureEach {
systemProperty 'forge.logging.markers', 'REGISTRIES'
systemProperty 'forge.logging.console.level', 'debug'
systemProperty 'forge.logging.console.level', 'debug'
modSource project.sourceSets.main
}

client {
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
}

data {
workingDirectory project.file('run')
property 'forge.logging.console.level', 'debug'
args '--mod', 'evilcraft', '--all', '--output', file('src/generated/resources/')
mods {
evilcraft {
source sourceSets.main
}
}
}
server {
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
programArgument '--nogui'
}

gameTestServer {
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
}

data {
programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
}
}

if (build_number.equals("RELEASE"))
version = "${project.minecraft_version}-${project.mod_version}"
version = "${project.mod_version}"
else
version = "${project.minecraft_version}-${project.mod_version}-${build_number}"
version = "${project.mod_version}-${build_number}"

jar {
archiveClassifier.set('slim')
Expand All @@ -172,7 +168,9 @@ javadoc {
options.addStringOption('Xdoclint:accessibility,html,reference,syntax', '-quiet')
}

task signJar(type: SignJar, dependsOn: jar) {
task signJar(type: PotentiallySignJar, dependsOn: jar) {
dependsOn(tasks.jar)

onlyIf {
System.getenv().SIGN_KEYSTORE
}
Expand All @@ -181,10 +179,9 @@ task signJar(type: SignJar, dependsOn: jar) {
alias = System.getenv().SIGN_ALIAS
storePass = System.getenv().SIGN_STOREPASS
keyPass = System.getenv().SIGN_KEYPASS
inputFile = jar.archivePath
outputFile = jar.archivePath
input = jar.archivePath
output = jar.archivePath
}
build.dependsOn signJar

task deobfJar(type: Jar) {
from sourceSets.main.output
Expand Down Expand Up @@ -219,12 +216,10 @@ shadowJar {
configurations = [project.configurations.shadow]
archiveClassifier.set(''); // Replace the default JAR
append 'META-INF/mods.toml'
finalizedBy 'reobfShadowJar'
}

assemble.dependsOn shadowJar
reobf {
shadowJar {} // Reobfuscate the shadowed JAR
jar {
shadowJar {}
}

artifacts {
Expand All @@ -234,32 +229,28 @@ artifacts {
archives javadocJar
}

curseforge {
if(secrets.curseforge_key) {
apiKey = secrets.curseforge_key
task publishCurseForge(type: net.darkhax.curseforgegradle.TaskPublishCurseForge) {
dependsOn(tasks.jar)

if(secrets.hasProperty("curseforge_key") && secrets.hasProperty("changelog")) {
apiToken = secrets.curseforge_key
} else if(System.getenv().GITHUB_ACTIONS && System.getenv().CURSEFORGE_KEY_SECRET) {
apiKey = System.getenv().CURSEFORGE_KEY_SECRET
apiToken = System.getenv().CURSEFORGE_KEY_SECRET
} else {
apiToken = "DUMMY"
}

project {
id = "74610" // my project url is http://minecraft.curseforge.com/mc-mods/74610/
releaseType = project.project.release_type
addGameVersion project.minecraft_version
mainArtifact(shadowJar) {
relations {
requiredDependency 'cyclops-core'
}
}

changelog = ""
if (new File("resources/changelog/${project.version}.txt").exists()) {
changelog = new File("resources/changelog/${project.version}.txt").text
}
def projectId = "74610" // my project url is http://minecraft.curseforge.com/mc-mods/74610/

addArtifact deobfJar
addArtifact sourcesJar
addArtifact javadocJar
def mainFile = upload(projectId, shadowJar)
mainFile.changelogType = "text"
if (new File("resources/changelog/${project.version}.txt").exists()) {
mainFile.changelog = file("resources/changelog/${project.version}.txt")
}
mainFile.addGameVersion(project.minecraft_version)
mainFile.addModLoader("NeoForge")

mainFile.addRequirement('cyclops-core')
}

modrinth {
Expand Down
7 changes: 4 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
mod_id=evilcraft
mod_version=1.2.37
minecraft_version=1.20.1
forge_version=47.2.1
cyclopscore_version=1.18.4-340
minecraft_version=1.20.4
neoforge_version=20.4.160-beta
cyclopscore_version=1.19.0-423
evilcraftcompat_version=1.20.1-1.1.0-43
release_type=release
fingerprint=bd0353b3e8a2810d60dd584e256e364bc3bedd44
Expand Down
6 changes: 2 additions & 4 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
pluginManagement {
repositories {
mavenLocal()
gradlePluginPortal()
maven {
name = 'MinecraftForge'
url = 'https://maven.minecraftforge.net/'
}
maven { url = 'https://maven.neoforged.net/releases' }
}
}

Expand Down
26 changes: 0 additions & 26 deletions src/main/java/org/cyclops/evilcraft/Advancements.java

This file was deleted.

Loading

0 comments on commit acd9842

Please sign in to comment.