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 29, 2024
1 parent 05f038a commit 048cead
Show file tree
Hide file tree
Showing 59 changed files with 474 additions and 443 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
132 changes: 67 additions & 65 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.colossalchests"
archivesBaseName = "ColossalChests"
archivesBaseName = "ColossalChests-${project.minecraft_version}-neoforge"
base {
archivesName = archivesBaseName
}

// Set Java details
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
Expand Down Expand Up @@ -56,6 +58,7 @@ sourceSets {
runtimeClasspath += sourceSets.api.output
}
}
sourceSets.main.resources { srcDir 'src/generated/resources' }

configurations {
apiImplementation.extendsFrom(implementation)
Expand All @@ -70,26 +73,26 @@ 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"
}

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/
exclude group: 'org.cyclops.cyclopscore', module: 'cyclopscore'
}
}
Expand All @@ -102,43 +105,41 @@ dependencies {
}

minecraft {
mappings channel: "official", version: "${project.minecraft_version}"
accessTransformers {
file('src/main/resources/META-INF/accesstransformer.cfg')
}
}

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 {
colossalchests.sources((SourceSet[]) [sourceSets.main, sourceSets.api])
}
}
server {
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
programArgument '--nogui'
}

server {
workingDirectory project.file('run')
property 'forge.logging.console.level', 'debug'
mods {
colossalchests.sources((SourceSet[]) [sourceSets.main, sourceSets.api])
}
}
gameTestServer {
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
}

data {
workingDirectory project.file('run')
property 'forge.logging.console.level', 'debug'
args '--mod', 'colossalchests', '--all', '--output', file('src/generated/resources/')
mods {
colossalchests.sources((SourceSet[]) [sourceSets.main, sourceSets.api])
}
}
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 @@ -154,15 +155,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 @@ -171,8 +173,8 @@ 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

Expand Down Expand Up @@ -219,32 +221,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 = "237875" // my project url is http://minecraft.curseforge.com/mc-mods/237875/
releaseType = project.project.release_type
addGameVersion project.minecraft_version
mainArtifact(jar) {
relations {
requiredDependency 'cyclops-core'
}
}
def projectId = "237875" // my project url is http://minecraft.curseforge.com/mc-mods/237875/

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

modrinth {
Expand Down Expand Up @@ -326,3 +324,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
}
9 changes: 5 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
mod_id=colossalchests
mod_version=1.8.4
minecraft_version=1.20.1
forge_version=47.0.1
cyclopscore_version=1.18.4-340
minecraft_version=1.20.4
neoforge_version=20.4.160-beta
cyclopscore_version=1.19.0-408
release_type=release
fingerprint=bd0353b3e8a2810d60dd584e256e364bc3bedd44

commoncapabilities_version=1.20.1-2.9.0-98
commoncapabilities_version=2.9.1-113

# 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
17 changes: 0 additions & 17 deletions src/main/java/org/cyclops/colossalchests/Advancements.java

This file was deleted.

16 changes: 0 additions & 16 deletions src/main/java/org/cyclops/colossalchests/Capabilities.java

This file was deleted.

25 changes: 11 additions & 14 deletions src/main/java/org/cyclops/colossalchests/ColossalChests.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.fml.common.Mod;
import org.apache.logging.log4j.Level;
import org.cyclops.colossalchests.advancement.criterion.ChestFormedTriggerConfig;
import org.cyclops.colossalchests.block.ChestMaterial;
import org.cyclops.colossalchests.block.ChestWallConfig;
import org.cyclops.colossalchests.block.ColossalChestConfig;
Expand All @@ -15,14 +16,14 @@
import org.cyclops.colossalchests.blockentity.BlockEntityColossalChestConfig;
import org.cyclops.colossalchests.blockentity.BlockEntityInterfaceConfig;
import org.cyclops.colossalchests.blockentity.BlockEntityUncolossalChestConfig;
import org.cyclops.colossalchests.condition.ConditionMetalVariantsSettingConfig;
import org.cyclops.colossalchests.inventory.container.ContainerColossalChestConfig;
import org.cyclops.colossalchests.inventory.container.ContainerUncolossalChestConfig;
import org.cyclops.colossalchests.item.ItemUpgradeToolConfig;
import org.cyclops.colossalchests.modcompat.CommonCapabilitiesModCompat;
import org.cyclops.colossalchests.modcompat.IronChestModCompat;
import org.cyclops.colossalchests.proxy.ClientProxy;
import org.cyclops.colossalchests.proxy.CommonProxy;
import org.cyclops.colossalchests.recipe.condition.RecipeConditionMetalVariantsSettingConfig;
import org.cyclops.cyclopscore.config.ConfigHandler;
import org.cyclops.cyclopscore.init.ModBaseVersionable;
import org.cyclops.cyclopscore.modcompat.ModCompatLoader;
Expand All @@ -42,8 +43,8 @@ public class ColossalChests extends ModBaseVersionable<ColossalChests> {
*/
public static ColossalChests _instance;

public ColossalChests() {
super(Reference.MOD_ID, (instance) -> _instance = instance);
public ColossalChests(IEventBus modEventBus) {
super(Reference.MOD_ID, (instance) -> _instance = instance, modEventBus);
}

@Override
Expand All @@ -52,12 +53,6 @@ protected void loadModCompats(ModCompatLoader modCompatLoader) {
modCompatLoader.addModCompat(new CommonCapabilitiesModCompat());
}

@Override
protected void setup(FMLCommonSetupEvent event) {
super.setup(event);
Advancements.load();
}

@Override
@OnlyIn(Dist.CLIENT)
protected IClientProxy constructClientProxy() {
Expand Down Expand Up @@ -98,7 +93,9 @@ protected void onConfigsRegister(ConfigHandler configHandler) {
configHandler.addConfigurable(new ContainerColossalChestConfig());
configHandler.addConfigurable(new ContainerUncolossalChestConfig());

configHandler.addConfigurable(new RecipeConditionMetalVariantsSettingConfig());
configHandler.addConfigurable(new ConditionMetalVariantsSettingConfig());

configHandler.addConfigurable(new ChestFormedTriggerConfig());
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.cyclops.colossalchests;

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

0 comments on commit 048cead

Please sign in to comment.