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 2c80fed commit b5c8d72
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 73 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 version to `0.1.9`
- update Forge & MaFgLib version
68 changes: 27 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 @@ -47,6 +44,9 @@ tasks.withType(JavaCompile) {
}

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17

withSourcesJar()
}

Expand All @@ -65,41 +65,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.19", "1.19.1", "1.19.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.19", "1.19.1", "1.19.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 +81,24 @@ 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.19", "1.19.1", "1.19.2")
setLoaders("forge")
setCurseEnvironment("client")
setArtifact(remapJar)
addAdditionalFile(sourcesJar)
curseDepends { required("mafglib") }
modrinthDepends { required("mafglib") }
}
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.19.2
# forge version, latest version can be found on https://files.minecraftforge.net/
forge_version=1.19.2-43.0.8
forge_version=1.19.2-43.3.13
# yarn, latest version can be found on https://fabricmc.net/develop/
yarn_mappings=1.19.2+build.3
yarn_mappings=1.19.2+build.28

# Mod Properties
mod_version=0.1.2
mod_version=0.1.3
maven_group=org.thinkingstudio.rocknroller
archives_base_name=RocknRoller
mod_id=rocknroller
Expand All @@ -21,4 +21,4 @@ loom.platform=forge
curseforge_id=916852

# Dependencies
malilib_version=0.1.9-mc1.19.2
malilib_version=0.1.10-mc1.19.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()
}
}
26 changes: 10 additions & 16 deletions src/main/java/fi/dy/masa/itemscroller/ItemScroller.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@

import fi.dy.masa.itemscroller.gui.GuiConfigs;
import fi.dy.masa.malilib.compat.forge.ForgePlatformUtils;
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 @@ -15,19 +13,15 @@ public class ItemScroller {
public static final Logger logger = LogManager.getLogger(Reference.MOD_ID);

public ItemScroller() {
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
if (FMLLoader.getDist().isClient()) {
ForgePlatformUtils.getInstance().getClientModIgnoredServerOnly();
InitializationHandler.getInstance().registerInitializationHandler(new InitHandler());

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;
});
ForgePlatformUtils.getInstance().getMod(Reference.MOD_ID).registerModConfigScreen((screen) -> {
GuiConfigs gui = new GuiConfigs();
gui.setParent(screen);
return gui;
});
}
}
}

0 comments on commit b5c8d72

Please sign in to comment.