Skip to content

Commit

Permalink
Update to NeoForge 1.20.4
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensworks committed Jun 15, 2024
1 parent cfb6539 commit b149c0f
Show file tree
Hide file tree
Showing 40 changed files with 284 additions and 272 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
160 changes: 71 additions & 89 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
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.12.0'
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: '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 @@ -29,7 +28,10 @@ logger.lifecycle "BUILDING VERSION: " + build_number
// Set mod details
version = project.mod_version
group = "org.cyclops.integratedscripting"
archivesBaseName = "IntegratedScripting"
archivesBaseName = "IntegratedScripting-${project.minecraft_version}-neoforge"
base {
archivesName = archivesBaseName
}

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

configurations {
modLib
Expand All @@ -69,33 +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 'integrateddynamics_version_local=0.1.0-DEV' to your secrets.properties if you want to use a custom local Integrated Tunnels Compat version.
if(secrets.integrateddynamics_version_local) {
implementation "org.cyclops.integrateddynamics:integrateddynamics:${secrets.integrateddynamics_version_local}:deobf"
implementation "org.cyclops.integrateddynamics:integrateddynamics-${project.minecraft_version}-neoforge:${secrets.integrateddynamics_version_local}:deobf"
} else {
implementation "org.cyclops.integrateddynamics:integrateddynamics:${project.integrateddynamics_version}:deobf"
implementation "org.cyclops.integrateddynamics:integrateddynamics-${project.minecraft_version}-neoforge:${project.integrateddynamics_version}:deobf"
}

if(secrets.commoncapabilities_version_local) {
implementation "org.cyclops.commoncapabilities:commoncapabilities:${secrets.commoncapabilities_version_local}:deobf"
implementation "org.cyclops.commoncapabilities:commoncapabilities-${project.minecraft_version}-neoforge:${secrets.commoncapabilities_version_local}:deobf"
} else {
implementation fg.deobf("org.cyclops.commoncapabilities:commoncapabilities:${project.commoncapabilities_version}") { // https://dl.bintray.com/cyclopsmc/dev/org/cyclops/commoncapabilities/CommonCapabilities/
implementation("org.cyclops.commoncapabilities:commoncapabilities-${project.minecraft_version}-neoforge:${project.commoncapabilities_version}") { // https://dl.bintray.com/cyclopsmc/dev/org/cyclops/commoncapabilities/CommonCapabilities/
transitive = false
}
}
Expand Down Expand Up @@ -123,60 +126,40 @@ dependencies {
testImplementation "org.mockito:mockito-core:1.+"
}

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

runs {
client {
workingDirectory project.file('run')
//property 'forge.logging.markers', 'REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
mods {
integratedscripting {
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

lazyToken('minecraft_classpath') {
configurations.modLib.copyRecursive().resolve().collect { it.absolutePath }.join(File.pathSeparator)
}
dependencies {
runtime project.configurations.modLib
}
}

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

server {
workingDirectory project.file('run')
property 'forge.logging.console.level', 'debug'
mods {
integratedscripting {
source sourceSets.main
}
}

lazyToken('minecraft_classpath') {
configurations.modLib.copyRecursive().resolve().collect { it.absolutePath }.join(File.pathSeparator)
}
}
server {
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
programArgument '--nogui'
}

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

lazyToken('minecraft_classpath') {
configurations.modLib.copyRecursive().resolve().collect { it.absolutePath }.join(File.pathSeparator)
}
}
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 @@ -193,7 +176,9 @@ jar {
}
}

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

onlyIf {
System.getenv().SIGN_KEYSTORE
}
Expand All @@ -202,10 +187,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 @@ -243,12 +227,10 @@ shadowJar {
relocate 'org.graalvm', 'org.cyclops.integratedscripting.vendors.org.graalvm'
relocate 'com.oracle', 'org.cyclops.integratedscripting.vendors.com.oracle'
relocate 'com.ibm', 'org.cyclops.integratedscripting.vendors.com.ibm'
finalizedBy 'reobfShadowJar'
}

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

artifacts {
Expand All @@ -258,33 +240,29 @@ artifacts {
archives javadocJar
}

curseforge {
if(project.hasProperty("curseforge_key")) {
apiKey = project.curseforge_key
} else if((System.getenv().TRAVIS || System.getenv().GITHUB_ACTIONS) && System.getenv().CURSEFORGE_KEY_SECRET) {
apiKey = System.getenv().CURSEFORGE_KEY_SECRET
}
task publishCurseForge(type: net.darkhax.curseforgegradle.TaskPublishCurseForge) {
dependsOn(tasks.jar)

project {
id = "889785" // my project url is http://minecraft.curseforge.com/mc-mods/889785/
releaseType = project.project.release_type
addGameVersion project.minecraft_version
mainArtifact(shadowJar) {
relations {
requiredDependency 'cyclops-core'
requiredDependency 'integrated-dynamics'
}
}
if(secrets.hasProperty("curseforge_key") && secrets.hasProperty("changelog")) {
apiToken = secrets.curseforge_key
} else if(System.getenv().GITHUB_ACTIONS && System.getenv().CURSEFORGE_KEY_SECRET) {
apiToken = System.getenv().CURSEFORGE_KEY_SECRET
} else {
apiToken = "DUMMY"
}

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

addArtifact deobfJar
addArtifact sourcesJar
addArtifact javadocJar
def mainFile = upload(projectId, jar)
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')
mainFile.addRequirement('integrated-dynamics')
}

modrinth {
Expand Down Expand Up @@ -375,3 +353,7 @@ tasks.register('updateGitHooks', Copy) {
into './.git/hooks'
}
compileJava.dependsOn updateGitHooks

tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}
11 changes: 6 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
mod_id=integratedscripting
mod_version=1.0.1
minecraft_version=1.20.1
forge_version=47.0.1
cyclopscore_version=1.19.0-405
integrateddynamics_version=1.20.1-1.21.0-699
minecraft_version=1.20.4
neoforge_version=20.4.160-beta
cyclopscore_version=1.19.0-423
integrateddynamics_version=1.21.2-740
release_type=release
fingerprint=bd0353b3e8a2810d60dd584e256e364bc3bedd44

commoncapabilities_version=1.20.1-2.9.0-98
commoncapabilities_version=2.9.1-116

# Workaround for Spotless bug
# https://github.com/diffplug/spotless/issues/834
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
14 changes: 14 additions & 0 deletions src/main/java/org/cyclops/integratedscripting/Capabilities.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.cyclops.integratedscripting;

import net.minecraft.resources.ResourceLocation;
import org.cyclops.integrateddynamics.api.network.NetworkCapability;
import org.cyclops.integratedscripting.api.network.IScriptingNetwork;

/**
* @author rubensworks
*/
public class Capabilities {
public static final class ScriptingNetwork {
public static final NetworkCapability<IScriptingNetwork> NETWORK = NetworkCapability.create(new ResourceLocation(Reference.MOD_ID, "scripting_network"), IScriptingNetwork.class);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.cyclops.integratedscripting;

import net.minecraftforge.fml.config.ModConfig;
import net.neoforged.fml.config.ModConfig;
import org.cyclops.cyclopscore.config.ConfigurableProperty;
import org.cyclops.cyclopscore.config.extendedconfig.DummyConfig;
import org.cyclops.cyclopscore.tracking.Versions;
Expand Down
Loading

0 comments on commit b149c0f

Please sign in to comment.