Skip to content

Commit

Permalink
update Forge & MaFgLib version
Browse files Browse the repository at this point in the history
  • Loading branch information
TexBlock committed May 3, 2024
1 parent 36a10fa commit 9875eb3
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 74 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 17
- name: Cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
Expand All @@ -26,7 +26,7 @@ jobs:
chmod +x gradlew
./gradlew build
- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Artifacts-forge
path: ${{ github.workspace }}/build/libs
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,24 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up JDK 20
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 20
- name: Cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
.gradle
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', 'build.gradle') }}
- uses: gradle/wrapper-validation-action@v1
- uses: gradle/actions/wrapper-validation@v3
- run: |
chmod +x gradlew
./gradlew build publishCurseForge publish modrinth --stacktrace -Porg.gradle.parallel.threads=4
./gradlew build publishMod --stacktrace -Porg.gradle.parallel.threads=4
env:
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
## Change
- update mafglib to `0.1.9`
- update Forge & MaFgLib version
63 changes: 22 additions & 41 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
plugins {
id "dev.architectury.loom" version "1.4-SNAPSHOT"
id "dev.architectury.loom" version "1.5-SNAPSHOT"
id "maven-publish"
id 'com.modrinth.minotaur' version '2.+'
id 'net.darkhax.curseforgegradle' version '1.+'
id "com.hypherionmc.modutils.modpublisher" version "2.+"
}

sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17

archivesBaseName = project.archives_base_name
base.archivesName = project.archives_base_name
version = "${project.mod_version}-mc${project.minecraft_version}"
group = project.maven_group

Expand Down Expand Up @@ -65,41 +62,6 @@ jar {
}
}

modrinth {
token = System.getenv("MODRINTH_TOKEN")

projectId = "${project.modrinth_id}"
versionNumber = "${project.version}"
versionType = "beta"
changelog = file("CHANGELOG.md").getText('UTF-8')
uploadFile = remapJar
additionalFiles = [sourcesJar]
gameVersions = ["1.18", "1.18.1", "1.18.2"]
loaders = ["forge"]
dependencies {
required.project("mafglib")
}
}

task publishCurseForge(type: net.darkhax.curseforgegradle.TaskPublishCurseForge) {
apiToken = System.getenv("CURSEFORGE_TOKEN")
disableVersionDetection()

def mainFile = upload(project.curseforge_id, remapJar)
mainFile.displayName = "${project.version}"
mainFile.releaseType = "beta"
mainFile.changelog = file("CHANGELOG.md")
mainFile.changelogType = "markdown"
mainFile.addModLoader("Forge")
mainFile.addJavaVersion("Java 17", "Java 18")
mainFile.addGameVersion("1.18", "1.18.1", "1.18.2")
mainFile.addRequirement("mafglib")

def sourcesFile = mainFile.withAdditionalFile(sourcesJar)
sourcesFile.changelog = file("CHANGELOG.md")
sourcesFile.changelogType = "markdown"
}

// configure the maven publication
publishing {
publications {
Expand All @@ -116,3 +78,22 @@ publishing {
// retrieving dependencies.
}
}

publisher {
apiKeys {
modrinth System.getenv("MODRINTH_TOKEN")
curseforge System.getenv("CURSEFORGE_TOKEN")
}

setCurseID("${project.curseforge_id}")
setModrinthID("${project.modrinth_id}")
setVersionType("release")
setChangelog(file("CHANGELOG.md").getText("UTF-8"))
setVersion("${project.version}")
setDisplayName("${project.version}")
setGameVersions("1.18", "1.18.1", "1.18.2")
setLoaders("forge")
setCurseEnvironment("client")
setArtifact(remapJar)
addAdditionalFile(sourcesJar)
}
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ loom.platform=forge
# minecraft version
minecraft_version=1.18.2
# forge version, latest version can be found on https://files.minecraftforge.net/
forge_version=1.18.2-40.1.73
forge_version=1.18.2-40.2.21
# yarn, latest version can be found on https://fabricmc.net/develop/
yarn_mappings=1.18.2+build.1
yarn_mappings=1.18.2+build.4

# Mod Properties
mod_version=0.1.3
mod_version=0.1.4
maven_group=org.thinkingstudio.tweakerge
archives_base_name=Tweakerge
mod_id=tweakerge
Expand All @@ -21,4 +21,4 @@ loom.platform=forge
curseforge_id=915857

# Dependencies
malilib_version=0.1.9-mc1.18.2
malilib_version=0.1.10-mc1.18.2
3 changes: 1 addition & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
pluginManagement {
// when using additional gradle plugins like shadow,
// add their repositories to this list!
repositories {
maven { url "https://maven.fabricmc.net/" }
maven { url "https://maven.architectury.dev/" }
maven { url "https://files.minecraftforge.net/maven/" }
maven { url "https://maven.firstdark.dev/releases" }
gradlePluginPortal()
}
}
27 changes: 10 additions & 17 deletions src/main/java/fi/dy/masa/tweakeroo/Tweakeroo.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@

import fi.dy.masa.malilib.compat.forge.ForgePlatformUtils;
import fi.dy.masa.tweakeroo.gui.GuiConfigs;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.fml.loading.FMLLoader;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import fi.dy.masa.malilib.event.InitializationHandler;
Expand All @@ -18,19 +16,14 @@ public class Tweakeroo {
public static int renderCountXPOrbs;

public Tweakeroo() {
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();

modEventBus.addListener(this::onInitializeClient);
}

public void onInitializeClient(FMLClientSetupEvent event) {
ForgePlatformUtils.getInstance().getClientModIgnoredServerOnly();
InitializationHandler.getInstance().registerInitializationHandler(new InitHandler());

ForgePlatformUtils.getInstance().getMod(Reference.MOD_ID).registerModConfigScreen((screen) -> {
GuiConfigs gui = new GuiConfigs();
gui.setParent(screen);
return gui;
});
if (FMLLoader.getDist().isClient()) {
ForgePlatformUtils.getInstance().getClientModIgnoredServerOnly();
InitializationHandler.getInstance().registerInitializationHandler(new InitHandler());
ForgePlatformUtils.getInstance().getMod(Reference.MOD_ID).registerModConfigScreen((screen) -> {
GuiConfigs gui = new GuiConfigs();
gui.setParent(screen);
return gui;
});
}
}
}

0 comments on commit 9875eb3

Please sign in to comment.