fix: update architectury + add base archive name to build

- [bug] add base archive name to build artifacts
- [deps] update architectury loom from 1.4-SNAPSHOT -> 1.5
- [deps] update architectury plugin to non snapshot build
- [bug] fixes an unchecked cast warning during the build
This commit is contained in:
2024-04-30 12:01:12 +12:00
parent 4c046a3828
commit 604d98ac13
2 changed files with 25 additions and 17 deletions

View File

@@ -1,10 +1,12 @@
import io.github.themrmilchmann.gradle.publish.curseforge.ChangelogFormat
import io.github.themrmilchmann.gradle.publish.curseforge.GameVersion
import io.github.themrmilchmann.gradle.publish.curseforge.ReleaseType
import net.fabricmc.loom.task.RemapJarTask
import net.fabricmc.loom.task.RemapSourcesJarTask
plugins {
id("architectury-plugin") version "3.4-SNAPSHOT"
id ("dev.architectury.loom") version "1.4-SNAPSHOT" apply false
id("architectury-plugin") version "3.4.+"
id ("dev.architectury.loom") version "1.5.+" apply false
id("com.modrinth.minotaur") version "2.+"
id("io.github.themrmilchmann.curseforge-publish") version "0.6.1"
}
@@ -15,18 +17,35 @@ architectury {
}
subprojects {
apply(plugin = "java")
apply(plugin = "architectury-plugin")
apply(plugin = "dev.architectury.loom")
dependencies {
"minecraft"("com.mojang:minecraft:${properties["minecraft_version"]}")
"mappings"("net.fabricmc:yarn:${rootProject.properties["yarn_mappings"]}:v2")
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
options.release.set(17)
}
tasks.withType<Jar> {
archiveBaseName.set(properties["archives_base_name"].toString() + "-${project.name}")
}
tasks.withType<RemapJarTask> {
archiveBaseName.set(properties["archives_base_name"].toString() + "-${project.name}")
}
tasks.withType<RemapSourcesJarTask> {
archiveBaseName.set(properties["archives_base_name"].toString() + "-${project.name}")
}
}
allprojects {
apply(plugin = "java")
apply(plugin = "maven-publish")
apply(plugin = "architectury-plugin")
version = if (System.getenv("CI_DEV_BUILD")?.toBoolean() == true) {
System.getenv("BUILD_NUMBER") ?: properties["mod_version"].toString()
@@ -35,15 +54,6 @@ allprojects {
}
group = properties["maven_group"].toString()
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
options.release.set(17)
}
tasks.withType<Jar> {
archiveBaseName.set(properties["archives_base_name"].toString())
}
}
modrinth {

View File

@@ -2,12 +2,10 @@ package me.lucaslah.weatherchanger.commands;
import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import com.mojang.brigadier.tree.CommandNode;
import com.mojang.brigadier.tree.LiteralCommandNode;
import me.lucaslah.weatherchanger.WeatherChanger;
import me.lucaslah.weatherchanger.command.Command;
import me.lucaslah.weatherchanger.config.WcMode;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
@@ -16,7 +14,7 @@ import static me.lucaslah.weatherchanger.WeatherChanger.sendClientMessage;
public class WeatherChangerCommand extends Command {
@Override
public <T> void register(CommandDispatcher<T> dispatcher) {
LiteralArgumentBuilder<T> command = LiteralArgumentBuilder.<T>literal("clientweather");
LiteralArgumentBuilder<T> command = LiteralArgumentBuilder.literal("clientweather");
command.then(LiteralArgumentBuilder.<T>literal("off")
.executes(context -> {
@@ -51,7 +49,7 @@ public class WeatherChangerCommand extends Command {
);
LiteralCommandNode<T> node = dispatcher.register(command);
dispatcher.register((LiteralArgumentBuilder<T>) LiteralArgumentBuilder.literal("cweather").redirect((CommandNode<Object>) node));
dispatcher.register(LiteralArgumentBuilder.<T>literal("cweather").redirect(node));
}
@Override