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 10, 2024
1 parent 4a8ef8c commit d3a87f2
Show file tree
Hide file tree
Showing 31 changed files with 220 additions and 307 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
156 changes: 68 additions & 88 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 '7.1.2'
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.integratedcrafting"
archivesBaseName = "IntegratedCrafting"
archivesBaseName = "IntegratedCrafting-${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,38 +72,41 @@ 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 gradle.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 gradle.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}:deobf") { // https://dl.bintray.com/cyclopsmc/dev/org/cyclops/commoncapabilities/CommonCapabilities/
transitive = false
}
}

modLib "com.google.re2j:re2j:1.1"
modLib ("io.netty:netty-codec-http:4.1.77.Final") {
transitive = false
}

// Project lombok
compileOnly 'org.projectlombok:lombok:1.18.22'
Expand All @@ -111,62 +117,40 @@ dependencies {
testImplementation "junit:junit:4.12"
}

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 {
integratedcrafting {
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 {
integratedcrafting {
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', 'integratedcrafting', '--all', '--output', file('src/generated/resources/')
mods {
integratedcrafting {
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 {
manifest {
Expand All @@ -182,15 +166,16 @@ jar {
])
}
}
jar.finalizedBy('reobfJar')

javadoc {
source = [sourceSets.main.allJava]
// prevent java 8's strict doclint for javadocs from failing builds
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 @@ -199,10 +184,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 @@ -239,34 +223,30 @@ 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 = "287357" // my project url is http://minecraft.curseforge.com/mc-mods/287357/
releaseType = project.project.release_type
addGameVersion project.minecraft_version
mainArtifact(jar) {
relations {
requiredDependency 'cyclops-core'
requiredDependency 'integrated-dynamics'
requiredDependency 'integrated-tunnels'
}
}
def projectId = "287357" // my project url is http://minecraft.curseforge.com/mc-mods/287357/

changelog = ""
if (new File("resources/changelog/${project.version}.txt").exists()) {
changelog = new File("resources/changelog/${project.version}.txt").text
}

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')
mainFile.addRequirement('integrated-tunnels')
}

modrinth {
Expand Down
11 changes: 6 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
mod_id=integratedcrafting
mod_version=1.1.7
minecraft_version=1.20.1
forge_version=47.0.1
cyclopscore_version=1.18.4-340
integrateddynamics_version=1.20.1-1.20.0-661
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
18 changes: 11 additions & 7 deletions src/main/java/org/cyclops/integratedcrafting/Capabilities.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
package org.cyclops.integratedcrafting;

import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.CapabilityManager;
import net.minecraftforge.common.capabilities.CapabilityToken;
import org.cyclops.commoncapabilities.api.capability.recipehandler.IRecipeHandler;
import org.cyclops.integrateddynamics.api.ingredient.capability.IPositionedAddonsNetworkIngredientsHandler;
import net.minecraft.resources.ResourceLocation;
import org.cyclops.integratedcrafting.api.crafting.ICraftingInterface;
import org.cyclops.integratedcrafting.api.network.ICraftingNetwork;
import org.cyclops.integrateddynamics.api.network.NetworkCapability;
import org.cyclops.integrateddynamics.api.part.PartCapability;

/**
* Used capabilities for this mod.
* @author rubensworks
*/
public class Capabilities {
public static Capability<IRecipeHandler> RECIPE_HANDLER = CapabilityManager.get(new CapabilityToken<>(){});
public static Capability<IPositionedAddonsNetworkIngredientsHandler> POSITIONED_ADDONS_NETWORK_INGREDIENTS_HANDLER = CapabilityManager.get(new CapabilityToken<>(){});
public static final class CraftingNetwork {
public static final NetworkCapability<ICraftingNetwork> NETWORK = NetworkCapability.create(new ResourceLocation(Reference.MOD_ID, "crafting_network"), ICraftingNetwork.class);
}
public static final class CraftingInterface {
public static final PartCapability<ICraftingInterface> PART = PartCapability.create(new ResourceLocation(Reference.MOD_ID, "crafting_interface"), ICraftingInterface.class);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.cyclops.integratedcrafting;

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.Analytics;
Expand Down
Loading

0 comments on commit d3a87f2

Please sign in to comment.