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 Apr 28, 2024
1 parent 061434f commit a93b719
Show file tree
Hide file tree
Showing 56 changed files with 437 additions and 668 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
129 changes: 57 additions & 72 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
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.diffplug.spotless' version '5.14.3'
id 'com.modrinth.minotaur' version '2.+'
}

apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'idea'
apply plugin: 'maven-publish'

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 @@ -26,7 +25,10 @@ logger.lifecycle "BUILDING VERSION: " + build_number
// Set mod details
version = project.mod_version
group = "org.cyclops.everlastingabilities"
archivesBaseName = "EverlastingAbilities"
archivesBaseName = "EverlastingAbilities-${project.minecraft_version}-neoforge"
base {
archivesName = archivesBaseName
}

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

repositories {
mavenCentral()
Expand All @@ -55,20 +58,20 @@ 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"
}

// Project lombok
Expand All @@ -78,50 +81,36 @@ dependencies {
testAnnotationProcessor 'org.projectlombok:lombok:1.18.22'
}

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

accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
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
}

runs {
client {
workingDirectory project.file('run')
//property 'forge.logging.markers', 'REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
mods {
everlastingabilities {
source sourceSets.main
}
}
}
server {
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
programArgument '--nogui'
}

server {
workingDirectory project.file('run')
property 'forge.logging.console.level', 'debug'
mods {
everlastingabilities {
source sourceSets.main
}
}
}
gameTestServer {
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
}

data {
workingDirectory project.file('run')
property 'forge.logging.console.level', 'debug'
args '--mod', 'everlastingabilities', '--all', '--output', file('src/generated/resources/')
mods {
everlastingabilities {
source sourceSets.main
}
}
}
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 @@ -136,15 +125,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 @@ -153,10 +143,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 @@ -200,32 +189,28 @@ artifacts {
archives javadocJar
}

curseforge {
if(secrets.hasProperty("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 = "248353" // my project url is http://minecraft.curseforge.com/mc-mods/248353/
releaseType = project.project.release_type
addGameVersion project.minecraft_version
mainArtifact(jar) {
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 = "248353" // my project url is http://minecraft.curseforge.com/mc-mods/248353/

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')
}

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=everlastingabilities
mod_version=2.0.12
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-419
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
28 changes: 28 additions & 0 deletions src/main/java/org/cyclops/everlastingabilities/Capabilities.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package org.cyclops.everlastingabilities;

import net.minecraft.core.Direction;
import net.minecraft.resources.ResourceLocation;
import net.neoforged.neoforge.capabilities.BlockCapability;
import net.neoforged.neoforge.capabilities.EntityCapability;
import net.neoforged.neoforge.capabilities.ItemCapability;
import org.cyclops.everlastingabilities.api.capability.IAbilityStore;
import org.cyclops.everlastingabilities.api.capability.IMutableAbilityStore;

/**
* @author rubensworks
*/
public class Capabilities {

public static final class AbilityStore {
public static final BlockCapability<IAbilityStore, Direction> BLOCK = BlockCapability.createSided(new ResourceLocation(Reference.MOD_ID, "ability_store"), IAbilityStore.class);
public static final ItemCapability<IAbilityStore, Void> ITEM = ItemCapability.createVoid(new ResourceLocation(Reference.MOD_ID, "ability_store"), IAbilityStore.class);
public static final EntityCapability<IAbilityStore, Void> ENTITY = EntityCapability.createVoid(new ResourceLocation(Reference.MOD_ID, "ability_store"), IAbilityStore.class);
}

public static final class MutableAbilityStore {
public static final BlockCapability<IMutableAbilityStore, Direction> BLOCK = BlockCapability.createSided(new ResourceLocation(Reference.MOD_ID, "mutable_ability_store"), IMutableAbilityStore.class);
public static final ItemCapability<IMutableAbilityStore, Void> ITEM = ItemCapability.createVoid(new ResourceLocation(Reference.MOD_ID, "mutable_ability_store"), IMutableAbilityStore.class);
public static final EntityCapability<IMutableAbilityStore, Void> ENTITY = EntityCapability.createVoid(new ResourceLocation(Reference.MOD_ID, "mutable_ability_store"), IMutableAbilityStore.class);
}

}
Loading

0 comments on commit a93b719

Please sign in to comment.