From 227935644f22dac4f2c628ad941908268cb11d39 Mon Sep 17 00:00:00 2001 From: The_Fireplace Date: Thu, 18 Jul 2024 20:07:21 -0500 Subject: [PATCH] Port to 1.20.4 --- .../lib/api/command/interfaces/FeedbackSender.java | 4 ++-- .../lib/command/helpers/SendFeedback.java | 10 +++++++--- common/src/main/resources/pack.mcmeta | 2 +- fabric/build.gradle | 2 +- fabric/src/main/resources/fabric.mod.json | 2 +- forge/build.gradle | 2 +- forge/src/main/resources/META-INF/mods.toml | 2 +- gradle.properties | 12 ++++++------ 8 files changed, 20 insertions(+), 16 deletions(-) diff --git a/api/src/main/java/dev/the_fireplace/lib/api/command/interfaces/FeedbackSender.java b/api/src/main/java/dev/the_fireplace/lib/api/command/interfaces/FeedbackSender.java index 303fedf7..9ed8d340 100644 --- a/api/src/main/java/dev/the_fireplace/lib/api/command/interfaces/FeedbackSender.java +++ b/api/src/main/java/dev/the_fireplace/lib/api/command/interfaces/FeedbackSender.java @@ -1,14 +1,14 @@ package dev.the_fireplace.lib.api.command.interfaces; import com.mojang.brigadier.context.CommandContext; -import net.minecraft.commands.CommandRuntimeException; +import com.mojang.brigadier.exceptions.CommandSyntaxException; import net.minecraft.commands.CommandSourceStack; import net.minecraft.network.chat.Style; import net.minecraft.server.level.ServerPlayer; public interface FeedbackSender { - int throwFailure(CommandContext command, String translationKey, Object... args) throws CommandRuntimeException; + int throwFailure(CommandContext command, String translationKey, Object... args) throws CommandSyntaxException; void basic(CommandContext command, String translationKey, Object... args); diff --git a/common/src/main/java/dev/the_fireplace/lib/command/helpers/SendFeedback.java b/common/src/main/java/dev/the_fireplace/lib/command/helpers/SendFeedback.java index 5785b337..204c4cc5 100644 --- a/common/src/main/java/dev/the_fireplace/lib/command/helpers/SendFeedback.java +++ b/common/src/main/java/dev/the_fireplace/lib/command/helpers/SendFeedback.java @@ -1,13 +1,16 @@ package dev.the_fireplace.lib.command.helpers; import com.mojang.brigadier.context.CommandContext; +import com.mojang.brigadier.exceptions.CommandExceptionType; +import com.mojang.brigadier.exceptions.CommandSyntaxException; +import com.mojang.brigadier.exceptions.SimpleCommandExceptionType; import dev.the_fireplace.lib.api.chat.injectables.MessageQueue; import dev.the_fireplace.lib.api.chat.injectables.TextStyles; import dev.the_fireplace.lib.api.chat.interfaces.Translator; import dev.the_fireplace.lib.api.command.interfaces.FeedbackSender; import dev.the_fireplace.lib.mixin.CommandSourceStackAccessor; -import net.minecraft.commands.CommandRuntimeException; import net.minecraft.commands.CommandSourceStack; +import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.chat.Style; import net.minecraft.server.level.ServerPlayer; @@ -24,8 +27,9 @@ public final class SendFeedback implements FeedbackSender } @Override - public int throwFailure(CommandContext command, String translationKey, Object... args) throws CommandRuntimeException { - throw new CommandRuntimeException(translator.getTextForTarget(command.getSource(), translationKey, args).setStyle(textStyles.red())); + public int throwFailure(CommandContext command, String translationKey, Object... args) throws CommandSyntaxException { + MutableComponent message = translator.getTextForTarget(command.getSource(), translationKey, args).setStyle(textStyles.red()); + throw new SimpleCommandExceptionType(message).create(); } @Override diff --git a/common/src/main/resources/pack.mcmeta b/common/src/main/resources/pack.mcmeta index abb0b6ef..c445c824 100644 --- a/common/src/main/resources/pack.mcmeta +++ b/common/src/main/resources/pack.mcmeta @@ -1,6 +1,6 @@ { "pack": { "description": "${readable_name}", - "pack_format": 18 + "pack_format": 22 } } \ No newline at end of file diff --git a/fabric/build.gradle b/fabric/build.gradle index c89a60eb..1215ef50 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -9,7 +9,7 @@ plugins { archivesBaseName = "${archives_base_name}-Fabric" def mainArtifactFile = layout.buildDirectory.file("libs/${archivesBaseName}-${version}.jar").get().asFile def changelogFile = file('../changelog.txt') -def supportedMinecraftVersions = [project.minecraft_version] +def supportedMinecraftVersions = [project.minecraft_version, '1.20.3'] sourceSets { api { diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index 03f1262e..1f58bbf0 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -39,7 +39,7 @@ "depends": { "fabricloader": ">=0.12.0", "fabric": "*", - "minecraft": ">=1.20.2", + "minecraft": ">=1.20.3 <1.20.5", "annotateddi": ">=4 <5" }, diff --git a/forge/build.gradle b/forge/build.gradle index 0b88e38e..6313f24d 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -24,7 +24,7 @@ apply plugin: 'org.spongepowered.mixin' archivesBaseName = "${archives_base_name}-Forge" def mainArtifactFile = layout.buildDirectory.file("libs/${archivesBaseName}-${version}.jar").get().asFile def changelogFile = file('../changelog.txt') -def supportedMinecraftVersions = [project.minecraft_version] +def supportedMinecraftVersions = [project.minecraft_version, '1.20.3'] jarJar.enable() sourceSets { diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml index 7d69dbf8..3fc60256 100644 --- a/forge/src/main/resources/META-INF/mods.toml +++ b/forge/src/main/resources/META-INF/mods.toml @@ -25,7 +25,7 @@ side = "BOTH" [[dependencies.fireplacelib]] modId = "minecraft" mandatory = true -versionRange = "[1.20.2,)" +versionRange = "[1.20.3,1.20.5)" ordering = "NONE" side = "BOTH" diff --git a/gradle.properties b/gradle.properties index d37c6fdd..d052f168 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,23 +3,23 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false # Common -minecraft_version=1.20.2 +minecraft_version=1.20.4 # Common Dependencies annotateddi_version=4.0.4+1.20.4 # Fabric fabric_loader_version=0.15.11 fabric_curseforge_url=https://www.curseforge.com/minecraft/mc-mods/fireplace-lib # Fabric Dependencies -fabric_api_version=0.91.6+1.20.2 -fabric_clothconfig_version=12.0.119 -modmenu_version=8.0.1 +fabric_api_version=0.97.1+1.20.4 +fabric_clothconfig_version=13.0.121 +modmenu_version=9.0.0 # Forge -forge_version=48.1.0 +forge_version=49.1.4 forge_mixin_version=0.8.5 forge_curseforge_url=https://www.curseforge.com/minecraft/mc-mods/fireplace-lib-forge forge_update_json_url=https://api.modrinth.com/updates/fireplace-lib/forge_updates.json # Forge Dependencies -forge_clothconfig_version=12.0.119 +forge_clothconfig_version=13.0.121 # Mod Properties maven_group=dev.the-fireplace archives_base_name=Fireplace-Lib