mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-21 15:03:30 +01:00
feat: publishing CI
This commit is contained in:
parent
19d0eb3aea
commit
c0b0111060
14 changed files with 240 additions and 278 deletions
29
.github/workflows/release.yml
vendored
Normal file
29
.github/workflows/release.yml
vendored
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
name: "Release"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Clone project
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Set up JDK
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
distribution: "microsoft"
|
||||||
|
java-version: 21
|
||||||
|
- name: Fix borked permissions
|
||||||
|
run: chmod +x ./gradlew
|
||||||
|
- name: Run gradle tasks
|
||||||
|
uses: gradle/gradle-build-action@v2
|
||||||
|
env:
|
||||||
|
MR_TOKEN: ${{ secrets.MR_TOKEN }}
|
||||||
|
CF_TOKEN: ${{ secrets.CF_TOKEN }}
|
||||||
|
MAVEN_TOKEN: ${{ secrets.MAVEN_TOKEN }}
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
arguments: clean build publish publishMods
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -20,3 +20,4 @@
|
||||||
*.launch
|
*.launch
|
||||||
.settings/org.eclipse.jdt.core.prefs
|
.settings/org.eclipse.jdt.core.prefs
|
||||||
*.prefs
|
*.prefs
|
||||||
|
.DS_Store
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# 1.3.6+mc1.21.1
|
# 1.3.7+mc1.21.1
|
||||||
* Added recipes for AA crops in the IE cloche.
|
* Added recipes for AA crops in the IE cloche.
|
||||||
|
|
||||||
# 1.3.6+mc1.21.1
|
# 1.3.6+mc1.21.1
|
35
Jenkinsfile
vendored
35
Jenkinsfile
vendored
|
@ -1,35 +0,0 @@
|
||||||
pipeline {
|
|
||||||
agent any
|
|
||||||
stages {
|
|
||||||
stage('Clean') {
|
|
||||||
steps {
|
|
||||||
sh './gradlew clean --no-daemon'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Build') {
|
|
||||||
steps {
|
|
||||||
sh './gradlew build --no-daemon'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Upload Artifacts') {
|
|
||||||
steps {
|
|
||||||
archiveArtifacts 'build/libs/**.jar'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Publish') {
|
|
||||||
when {
|
|
||||||
branch '1.12.2'
|
|
||||||
}
|
|
||||||
steps {
|
|
||||||
sh './gradlew publish --no-daemon'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
environment {
|
|
||||||
local_maven = '/var/www/maven'
|
|
||||||
}
|
|
||||||
}
|
|
243
build.gradle
243
build.gradle
|
@ -1,76 +1,92 @@
|
||||||
plugins {
|
plugins {
|
||||||
id 'java-library'
|
id 'java-library'
|
||||||
id 'eclipse'
|
|
||||||
id 'idea'
|
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
id 'net.neoforged.gradle.userdev' version '7.0.165'
|
id 'net.neoforged.moddev' version '1.0.21'
|
||||||
|
id "me.modmuss50.mod-publish-plugin" version "0.7.4"
|
||||||
}
|
}
|
||||||
|
|
||||||
def buildSuffix = System.getenv('BUILD_NUMBER') ? "-b${System.getenv('BUILD_NUMBER')}" : ""
|
tasks.named('wrapper', Wrapper).configure {
|
||||||
|
distributionType = Wrapper.DistributionType.BIN
|
||||||
|
}
|
||||||
|
|
||||||
|
version = "$mod_version+mc${game_version}"
|
||||||
|
group = "de.ellpeck"
|
||||||
|
|
||||||
version = "$mod_version+mc${game_version}${buildSuffix}"
|
|
||||||
group = "de.ellpeck.actuallyadditions"
|
|
||||||
base {
|
base {
|
||||||
archivesName = "ActuallyAdditions"
|
archivesName = "actuallyadditions"
|
||||||
}
|
}
|
||||||
|
|
||||||
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
|
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
|
||||||
|
|
||||||
if (rootProject.file('src/main/resources/META-INF/accesstransformer.cfg').exists()) {
|
neoForge {
|
||||||
minecraft.accessTransformers.file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg')
|
version = project.neo_version
|
||||||
}
|
|
||||||
|
|
||||||
runs {
|
parchment {
|
||||||
// applies to all the run configs below
|
mappingsVersion = project.parchment_mappings_version
|
||||||
configureEach { net.neoforged.gradle.dsl.common.runs.run.Run run ->
|
minecraftVersion = project.hasProperty("parchment_minecraft_version") ? project.parchment_minecraft_version : project.game_version
|
||||||
//Limit ram usage for the dev environment to 4GB
|
}
|
||||||
jvmArgument '-Xmx4G'
|
|
||||||
|
|
||||||
if (run.project.javaToolchains.launcherFor(java.toolchain).map { it.metadata.vendor }.getOrElse("").contains("JetBrains")) {
|
runs {
|
||||||
run.jvmArgument("-XX:+AllowEnhancedClassRedefinition")
|
client {
|
||||||
|
client()
|
||||||
|
systemProperty 'neoforge.enabledGameTestNamespaces', "actuallyadditions"
|
||||||
|
programArguments.addAll '--width=1920', '--height=1080'
|
||||||
}
|
}
|
||||||
|
|
||||||
modSource project.sourceSets.main
|
client2 {
|
||||||
|
client()
|
||||||
|
|
||||||
|
programArguments.addAll '--username', 'Dev2'
|
||||||
|
|
||||||
|
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
|
||||||
|
systemProperty 'neoforge.enabledGameTestNamespaces', "actuallyadditions"
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
server()
|
||||||
|
programArgument '--nogui'
|
||||||
|
systemProperty 'neoforge.enabledGameTestNamespaces', "actuallyadditions"
|
||||||
|
}
|
||||||
|
|
||||||
|
gameTestServer {
|
||||||
|
type = "gameTestServer"
|
||||||
|
systemProperty 'neoforge.enabledGameTestNamespaces', "actuallyadditions"
|
||||||
|
}
|
||||||
|
|
||||||
|
data {
|
||||||
|
data()
|
||||||
|
programArguments.addAll '--mod', "actuallyadditions", '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
|
||||||
|
}
|
||||||
|
|
||||||
|
configureEach { run ->
|
||||||
|
systemProperty 'forge.logging.markers', 'REGISTRIES'
|
||||||
|
logLevel = org.slf4j.event.Level.DEBUG
|
||||||
|
|
||||||
|
jvmArgument '-Xmx4G'
|
||||||
|
|
||||||
|
if (run.project.javaToolchains.launcherFor(java.toolchain).map { it.metadata.vendor }.getOrElse("").contains("JetBrains")) {
|
||||||
|
run.jvmArgument("-XX:+AllowEnhancedClassRedefinition")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
client {
|
mods {
|
||||||
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
|
"actuallyadditions" {
|
||||||
systemProperty 'neoforge.enabledGameTestNamespaces', "actuallyadditions"
|
sourceSet(sourceSets.main)
|
||||||
}
|
}
|
||||||
client2 {
|
|
||||||
configure ("client")
|
|
||||||
|
|
||||||
programArguments.addAll '--username', 'Dev2'
|
|
||||||
|
|
||||||
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
|
|
||||||
systemProperty 'neoforge.enabledGameTestNamespaces', "actuallyadditions"
|
|
||||||
}
|
|
||||||
|
|
||||||
server {
|
|
||||||
systemProperty 'neoforge.enabledGameTestNamespaces', "actuallyadditions"
|
|
||||||
programArgument '--nogui'
|
|
||||||
}
|
|
||||||
|
|
||||||
data {
|
|
||||||
// example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it
|
|
||||||
// workingDirectory project.file('run-data')
|
|
||||||
|
|
||||||
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
|
|
||||||
programArguments.addAll '--mod', "actuallyadditions", '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets.main.resources { srcDir 'src/generated/resources' }
|
sourceSets.main.resources { srcDir 'src/generated/resources' }
|
||||||
|
|
||||||
// Sets up a dependency configuration called 'localRuntime'.
|
|
||||||
// This configuration should be used instead of 'runtimeOnly' to declare
|
|
||||||
// a dependency that will be present for runtime testing but that is
|
|
||||||
// "optional", meaning it will not be pulled by dependents of this mod.
|
|
||||||
configurations {
|
configurations {
|
||||||
runtimeClasspath.extendsFrom localRuntime
|
runtimeClasspath.extendsFrom localRuntime
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
maven {
|
||||||
|
url = "https://maven.neoforged.net/releases"
|
||||||
|
}
|
||||||
maven {
|
maven {
|
||||||
url = "https://maven.blamejared.com"
|
url = "https://maven.blamejared.com"
|
||||||
}
|
}
|
||||||
|
@ -84,8 +100,6 @@ repositories {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation "net.neoforged:neoforge:${neo_version}"
|
|
||||||
|
|
||||||
compileOnly "mezz.jei:jei-${jei_minecraft}-common-api:${jei_version}"
|
compileOnly "mezz.jei:jei-${jei_minecraft}-common-api:${jei_version}"
|
||||||
compileOnly "mezz.jei:jei-${jei_minecraft}-neoforge-api:${jei_version}"
|
compileOnly "mezz.jei:jei-${jei_minecraft}-neoforge-api:${jei_version}"
|
||||||
|
|
||||||
|
@ -126,7 +140,28 @@ jar {
|
||||||
from sourceSets.main.output
|
from sourceSets.main.output
|
||||||
}
|
}
|
||||||
|
|
||||||
task apiJar(type: Jar) {
|
var generateModMetadata = tasks.register("generateModMetadata", ProcessResources) {
|
||||||
|
var replaceProperties = [
|
||||||
|
minecraft_version : game_version,
|
||||||
|
minecraft_version_range: game_version_range,
|
||||||
|
neo_version : neo_version,
|
||||||
|
neo_version_range : neo_version_range,
|
||||||
|
loader_version_range : loader_version_range,
|
||||||
|
mod_id : "actuallyadditions",
|
||||||
|
mod_name : "Actually Additions",
|
||||||
|
mod_version : mod_version,
|
||||||
|
]
|
||||||
|
|
||||||
|
inputs.properties replaceProperties
|
||||||
|
expand replaceProperties
|
||||||
|
from "src/main/templates"
|
||||||
|
into "build/generated/sources/modMetadata"
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets.main.resources.srcDir generateModMetadata
|
||||||
|
neoForge.ideSyncTask generateModMetadata
|
||||||
|
|
||||||
|
tasks.register('apiJar', Jar) {
|
||||||
from sourceSets.main.output
|
from sourceSets.main.output
|
||||||
from sourceSets.main.java
|
from sourceSets.main.java
|
||||||
archiveClassifier.set('api')
|
archiveClassifier.set('api')
|
||||||
|
@ -137,12 +172,13 @@ javadoc {
|
||||||
include 'de/ellpeck/actuallyadditions/api/**'
|
include 'de/ellpeck/actuallyadditions/api/**'
|
||||||
}
|
}
|
||||||
|
|
||||||
task javadocJar(type: Jar, dependsOn: javadoc) {
|
tasks.register('javadocJar', Jar) {
|
||||||
|
dependsOn javadoc
|
||||||
from 'build/docs/javadoc'
|
from 'build/docs/javadoc'
|
||||||
archiveClassifier.set('javadoc')
|
archiveClassifier.set('javadoc')
|
||||||
}
|
}
|
||||||
|
|
||||||
task sourcesJar(type: Jar) {
|
tasks.register('sourcesJar', Jar) {
|
||||||
from sourceSets.main.java
|
from sourceSets.main.java
|
||||||
archiveClassifier.set('sources')
|
archiveClassifier.set('sources')
|
||||||
}
|
}
|
||||||
|
@ -151,38 +187,111 @@ artifacts {
|
||||||
archives sourcesJar, apiJar, javadocJar
|
archives sourcesJar, apiJar, javadocJar
|
||||||
}
|
}
|
||||||
|
|
||||||
publishing {
|
|
||||||
tasks.publish.dependsOn build
|
|
||||||
publications {
|
|
||||||
mavenJava(MavenPublication) {
|
|
||||||
groupId = group
|
|
||||||
artifactId = base.archivesName.get()
|
|
||||||
version = version
|
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
register('mavenJava', MavenPublication) {
|
||||||
from components.java
|
from components.java
|
||||||
|
|
||||||
|
// Add sources and javadoc to the publication
|
||||||
artifact sourcesJar
|
artifact sourcesJar
|
||||||
artifact apiJar
|
artifact apiJar
|
||||||
artifact javadocJar
|
artifact javadocJar
|
||||||
|
|
||||||
pom.withXml {
|
|
||||||
def node = asNode()
|
|
||||||
if (node.dependencies.size() > 0)
|
|
||||||
node.remove(node.dependencies)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
def token = providers.environmentVariable("MAVEN_TOKEN")
|
||||||
url "file://" + System.getenv("local_maven")
|
if (token.isPresent()) {
|
||||||
|
maven {
|
||||||
|
url "https://maven.saps.dev/releases"
|
||||||
|
credentials {
|
||||||
|
username = "ell"
|
||||||
|
password = token.get()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior.
|
|
||||||
|
tasks.withType(JavaCompile).configureEach {
|
||||||
|
options.encoding = 'UTF-8'
|
||||||
|
}
|
||||||
|
|
||||||
idea {
|
idea {
|
||||||
module {
|
module {
|
||||||
downloadSources = true
|
downloadSources = true
|
||||||
downloadJavadoc = true
|
downloadJavadoc = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Seek out the changelog for the current version and return it as a string.
|
||||||
|
*/
|
||||||
|
def createChangelog = () -> {
|
||||||
|
def changelogText = new File("CHANGELOG.md").text
|
||||||
|
def changelog = ""
|
||||||
|
|
||||||
|
def lines = changelogText.split("\n")
|
||||||
|
def inChangelog = false
|
||||||
|
for (int i = 0; i < lines.size(); i++) {
|
||||||
|
def line = lines[i]
|
||||||
|
if (line.startsWith("# ")) {
|
||||||
|
if (inChangelog) {
|
||||||
|
break
|
||||||
|
} else {
|
||||||
|
if (line.contains(mod_version)) {
|
||||||
|
inChangelog = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inChangelog) {
|
||||||
|
changelog += line + "\n"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def output = changelog.trim()
|
||||||
|
return output.empty ? "No changelog found" : output
|
||||||
|
}
|
||||||
|
|
||||||
|
def cfToken = providers.environmentVariable("CF_TOKEN")
|
||||||
|
def mrToken = providers.environmentVariable("MR_TOKEN")
|
||||||
|
def ghToken = providers.environmentVariable("GITHUB_TOKEN")
|
||||||
|
|
||||||
|
publishMods {
|
||||||
|
dryRun = !cfToken.isPresent() || !mrToken.isPresent() || !ghToken.isPresent()
|
||||||
|
changelog = createChangelog().trim()
|
||||||
|
version = mod_version
|
||||||
|
displayName = "Actually Additions ${mod_version}"
|
||||||
|
type = STABLE
|
||||||
|
|
||||||
|
file = jar.archiveFile
|
||||||
|
|
||||||
|
additionalFiles.from apiJar.archiveFile
|
||||||
|
additionalFiles.from javadocJar.archiveFile
|
||||||
|
additionalFiles.from sourcesJar.archiveFile
|
||||||
|
|
||||||
|
modLoaders.add("neoforge")
|
||||||
|
|
||||||
|
curseforge {
|
||||||
|
accessToken = cfToken
|
||||||
|
projectId = "228404"
|
||||||
|
minecraftVersions.add(game_version)
|
||||||
|
javaVersions.add(JavaVersion.VERSION_21)
|
||||||
|
}
|
||||||
|
|
||||||
|
modrinth {
|
||||||
|
accessToken = mrToken
|
||||||
|
projectId = "4K7Q3nqd"
|
||||||
|
minecraftVersions.add(game_version)
|
||||||
|
}
|
||||||
|
|
||||||
|
github {
|
||||||
|
repository = "Ellpeck/ActuallyAdditions"
|
||||||
|
accessToken = ghToken
|
||||||
|
commitish = providers.environmentVariable("GITHUB_SHA").orElse("dryRun")
|
||||||
|
tagName = providers.environmentVariable("GITHUB_REF_NAME").orElse("dryRun")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,17 +1,23 @@
|
||||||
org.gradle.jvmargs=-Xmx3G
|
org.gradle.jvmargs=-Xmx3G
|
||||||
org.gradle.daemon=false
|
org.gradle.daemon=true
|
||||||
# Actually Additions
|
org.gradle.parallel=true
|
||||||
|
org.gradle.caching=true
|
||||||
|
org.gradle.configuration-cache=false
|
||||||
|
|
||||||
mod_version=1.3.7
|
mod_version=1.3.7
|
||||||
|
|
||||||
# Forge
|
# Forge
|
||||||
game_version=1.21.1
|
game_version=1.21.1
|
||||||
|
game_version_range=[1.21.1,1.22)
|
||||||
|
|
||||||
neo_version=21.1.71
|
neo_version=21.1.71
|
||||||
|
neo_version_range=[21.1,21.2)
|
||||||
|
loader_version_range=4
|
||||||
|
|
||||||
# Parchment (Mappings)
|
# Parchment (Mappings)
|
||||||
neogradle.subsystems.parchment.minecraftVersion=1.21
|
# Uncomment to apply a different mc version for parchment
|
||||||
neogradle.subsystems.parchment.mappingsVersion=2024.07.28
|
parchment_minecraft_version=1.21
|
||||||
neogradle.subsystems.conventions.runs.create-default-run-per-type=false
|
parchment_mappings_version=2024.07.28
|
||||||
|
|
||||||
# Other mods
|
# Other mods
|
||||||
jei_minecraft=1.21.1
|
jei_minecraft=1.21.1
|
||||||
|
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,6 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|
Binary file not shown.
|
@ -11,4 +11,5 @@ pluginManagement {
|
||||||
plugins {
|
plugins {
|
||||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0'
|
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
rootProject.name = "actuallyadditions"
|
rootProject.name = "actuallyadditions"
|
||||||
|
|
|
@ -1,85 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("ThreadUpdateChecker.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.update;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
|
||||||
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
public class ThreadUpdateChecker extends Thread {
|
|
||||||
|
|
||||||
public ThreadUpdateChecker() {
|
|
||||||
this.setName(ActuallyAdditions.NAME + " Update Checker");
|
|
||||||
this.setDaemon(true);
|
|
||||||
this.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
ActuallyAdditions.LOGGER.info("Starting Update Check...");
|
|
||||||
try {
|
|
||||||
URL newestURL = new URL("https://raw.githubusercontent.com/Ellpeck/ActuallyAdditions/main/update/updateVersions.properties");
|
|
||||||
Properties updateProperties = new Properties();
|
|
||||||
updateProperties.load(new InputStreamReader(newestURL.openStream()));
|
|
||||||
|
|
||||||
String currentMcVersion = Util.getMcVersion();
|
|
||||||
if (CommonConfig.Other.UPDATE_CHECK_VERSION_SPECIFIC.get()) {
|
|
||||||
String newestVersionProp = updateProperties.getProperty(currentMcVersion);
|
|
||||||
|
|
||||||
UpdateChecker.updateVersionInt = Integer.parseInt(newestVersionProp);
|
|
||||||
UpdateChecker.updateVersionString = currentMcVersion + "-r" + newestVersionProp;
|
|
||||||
} else {
|
|
||||||
int highest = 0;
|
|
||||||
String highestString = "";
|
|
||||||
|
|
||||||
for (String updateMC : updateProperties.stringPropertyNames()) {
|
|
||||||
String updateVersion = updateProperties.getProperty(updateMC);
|
|
||||||
int update = Integer.parseInt(updateVersion);
|
|
||||||
if (highest < update) {
|
|
||||||
highest = update;
|
|
||||||
highestString = updateMC + "-r" + updateVersion;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
UpdateChecker.updateVersionInt = highest;
|
|
||||||
UpdateChecker.updateVersionString = highestString;
|
|
||||||
}
|
|
||||||
|
|
||||||
String clientVersionString = Util.getMajorModVersion();
|
|
||||||
int clientVersion = Integer.parseInt(clientVersionString.contains("_") ? clientVersionString.substring(0, clientVersionString.indexOf("_")) : clientVersionString);
|
|
||||||
if (UpdateChecker.updateVersionInt > clientVersion) {
|
|
||||||
UpdateChecker.needsUpdateNotify = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
ActuallyAdditions.LOGGER.info("Update Check done!");
|
|
||||||
} catch (Exception e) {
|
|
||||||
ActuallyAdditions.LOGGER.error("Update Check failed!", e);
|
|
||||||
UpdateChecker.checkFailed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!UpdateChecker.checkFailed) {
|
|
||||||
if (UpdateChecker.needsUpdateNotify) {
|
|
||||||
ActuallyAdditions.LOGGER.info("There is an Update for " + ActuallyAdditions.NAME + " available!");
|
|
||||||
ActuallyAdditions.LOGGER.info("Current Version: " + ActuallyAdditions.VERSION + ", newest Version: " + UpdateChecker.updateVersionString + "!");
|
|
||||||
ActuallyAdditions.LOGGER.info("View the Changelog at " + UpdateChecker.CHANGELOG_LINK);
|
|
||||||
ActuallyAdditions.LOGGER.info("Download at " + UpdateChecker.DOWNLOAD_LINK);
|
|
||||||
} else {
|
|
||||||
ActuallyAdditions.LOGGER.info(ActuallyAdditions.NAME + " is up to date!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
UpdateChecker.threadFinished = true;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,56 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("UpdateChecker.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.update;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.network.chat.Component;
|
|
||||||
import net.minecraft.world.entity.player.Player;
|
|
||||||
import net.neoforged.bus.api.SubscribeEvent;
|
|
||||||
import net.neoforged.neoforge.client.event.ClientTickEvent;
|
|
||||||
import net.neoforged.neoforge.common.NeoForge;
|
|
||||||
|
|
||||||
public class UpdateChecker {
|
|
||||||
|
|
||||||
public static final String DOWNLOAD_LINK = "http://ellpeck.de/actadddownload";
|
|
||||||
public static final String CHANGELOG_LINK = "http://ellpeck.de/actaddchangelog";
|
|
||||||
public static boolean checkFailed;
|
|
||||||
public static boolean needsUpdateNotify;
|
|
||||||
public static int updateVersionInt;
|
|
||||||
public static String updateVersionString;
|
|
||||||
public static boolean threadFinished = false;
|
|
||||||
|
|
||||||
public UpdateChecker() {
|
|
||||||
// if (CommonConfig.OTHER.DO_UPDATE_CHECK.get() && !Util.isDevVersion()) {
|
|
||||||
// ActuallyAdditions.LOGGER.info("Initializing Update Checker...");
|
|
||||||
// new ThreadUpdateChecker();
|
|
||||||
// MinecraftForge.EVENT_BUS.register(this);
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@SubscribeEvent(receiveCanceled = true)
|
|
||||||
public void onTick(ClientTickEvent.Pre event) {
|
|
||||||
if (Minecraft.getInstance().player != null) {
|
|
||||||
Player player = Minecraft.getInstance().player;
|
|
||||||
if (UpdateChecker.checkFailed) {
|
|
||||||
player.displayClientMessage(Component.translatable("info.actuallyadditions.update.failed"), false);
|
|
||||||
} else if (UpdateChecker.needsUpdateNotify) {
|
|
||||||
player.displayClientMessage(Component.translatable("info.actuallyadditions.update.generic"), false);
|
|
||||||
player.displayClientMessage(Component.translatable("info.actuallyadditions.update.versionCompare", ActuallyAdditions.VERSION, UpdateChecker.updateVersionString), false);
|
|
||||||
player.displayClientMessage(Component.translatable("info.actuallyadditions.update.buttons", UpdateChecker.CHANGELOG_LINK, UpdateChecker.DOWNLOAD_LINK), false);
|
|
||||||
}
|
|
||||||
if (threadFinished) {
|
|
||||||
NeoForge.EVENT_BUS.unregister(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,30 +1,33 @@
|
||||||
|
|
||||||
modLoader="javafml"
|
modLoader="javafml"
|
||||||
loaderVersion="[4,)"
|
loaderVersion="${loader_version_range}"
|
||||||
license="MIT"
|
license="MIT"
|
||||||
|
issueTrackerURL="https://github.com/Ellpeck/ActuallyAdditions/issues"
|
||||||
|
|
||||||
[[mods]]
|
[[mods]]
|
||||||
modId="actuallyadditions"
|
modId="actuallyadditions"
|
||||||
version="${file.jarVersion}"
|
version="${mod_version}"
|
||||||
displayName="Actually Additions"
|
displayName="${mod_name}"
|
||||||
#logoFile="logo.png"
|
displayURL="https://github.com/Ellpeck/ActuallyAdditions"
|
||||||
credits="Author: Ellpeck; Textures and Models: BootyToast, GlenthorLP, canitzp; Porters: Flanks, MrBysco, ErrorMikey; 1.20+ Textures: Ridanisaurus"
|
credits="Author: Ellpeck; Textures and Models: BootyToast, GlenthorLP, canitzp; Porters: Flanks, MrBysco, ErrorMikey; 1.20+ Textures: Ridanisaurus"
|
||||||
authors="Ellpeck"
|
authors="Ellpeck"
|
||||||
description='''
|
description='''
|
||||||
Do you want Automation? Wireless Transport? Better Machines? A cup o\' Coffee? Chests? Better Hoppers? Leaf Blowers? Faster Growth? Plants? Well, Actually Additions has all that and a lot more!
|
Do you want Automation? Wireless Transport? Better Machines? A cup o\' Coffee? Chests? Better Hoppers? Leaf Blowers? Faster Growth? Plants? Well, Actually Additions has all that and a lot more!
|
||||||
'''
|
'''
|
||||||
|
|
||||||
[[mixins]]
|
[[mixins]]
|
||||||
config = "actuallyadditions.mixins.json"
|
config = "actuallyadditions.mixins.json"
|
||||||
|
|
||||||
[[dependencies.actuallyadditions]]
|
[[dependencies.actuallyadditions]]
|
||||||
modId="neoforge"
|
modId="neoforge"
|
||||||
type="required"
|
type="required"
|
||||||
versionRange="[21.1.1,)"
|
versionRange="${neo_version_range}"
|
||||||
ordering="NONE"
|
ordering="NONE"
|
||||||
side="BOTH"
|
side="BOTH"
|
||||||
|
|
||||||
|
# Here's another dependency
|
||||||
[[dependencies.actuallyadditions]]
|
[[dependencies.actuallyadditions]]
|
||||||
modId="minecraft"
|
modId="minecraft"
|
||||||
type="required"
|
type="required"
|
||||||
versionRange="[1.21.1,1.22)"
|
versionRange="${minecraft_version_range}"
|
||||||
ordering="NONE"
|
ordering="NONE"
|
||||||
side="BOTH"
|
side="BOTH"
|
|
@ -1,11 +0,0 @@
|
||||||
1.7.10=21
|
|
||||||
1.8.9=26
|
|
||||||
1.9=33
|
|
||||||
1.9.4=45
|
|
||||||
1.10=46
|
|
||||||
1.10.2=105
|
|
||||||
1.11=92
|
|
||||||
1.11.2=110
|
|
||||||
1.12=118
|
|
||||||
1.12.1=121
|
|
||||||
1.12.2=151
|
|
Loading…
Reference in a new issue