From 123bc861062fe28a41d2abd8f5cea50866b8374c Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Tue, 21 May 2024 21:51:02 +0200 Subject: Re-add 1.14 support --- build.gradle.kts | 2 +- .../moe/nea/ultranotifier/init/NeaMixinConfig.java | 2 +- .../ultranotifier/mixin/ChatHudMessageAdded.java | 4 +++ src/main/kotlin/UltraNotifier.kt | 2 +- src/main/kotlin/UltraNotifierEntryPoint.kt | 30 ++++++++++++---------- src/main/kotlin/UltraNotifierEvents.kt | 2 +- .../src/main/resources/META-INF/mods.toml | 21 +++++++++++++++ versions/mapping-1.14.4-forge-1.8.9.txt | 3 ++- 8 files changed, 48 insertions(+), 18 deletions(-) create mode 100644 versions/1.14.4-forge/src/main/resources/META-INF/mods.toml diff --git a/build.gradle.kts b/build.gradle.kts index 5e92d93..78efa65 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -137,7 +137,7 @@ tasks.named("runClient", RunGameTask::class) { this.languageVersion.set(mcJavaVersion) }) } -if (version.isBridge) { +if (version.isBridge && false) { tasks.withType { onlyIf { false } } diff --git a/src/main/java/moe/nea/ultranotifier/init/NeaMixinConfig.java b/src/main/java/moe/nea/ultranotifier/init/NeaMixinConfig.java index a3fc4fc..e543703 100644 --- a/src/main/java/moe/nea/ultranotifier/init/NeaMixinConfig.java +++ b/src/main/java/moe/nea/ultranotifier/init/NeaMixinConfig.java @@ -1,6 +1,6 @@ package moe.nea.ultranotifier.init; -//#if MC < 11404 +//#if FORGE //$$import org.spongepowered.asm.lib.tree.ClassNode; //#else import org.objectweb.asm.tree.ClassNode; diff --git a/src/main/java/moe/nea/ultranotifier/mixin/ChatHudMessageAdded.java b/src/main/java/moe/nea/ultranotifier/mixin/ChatHudMessageAdded.java index b8239d3..a9323d7 100644 --- a/src/main/java/moe/nea/ultranotifier/mixin/ChatHudMessageAdded.java +++ b/src/main/java/moe/nea/ultranotifier/mixin/ChatHudMessageAdded.java @@ -19,7 +19,11 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; public class ChatHudMessageAdded { @Inject( //#if MC <= 11404 +//#if FORGE //$$ method = "printChatMessageWithOptionalDeletion", +//#else +//$$ method = "addMessage(Lnet/minecraft/text/Text;I)V", +//#endif //#else method = "addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignatureData;Lnet/minecraft/client/gui/hud/MessageIndicator;)V", //#endif diff --git a/src/main/kotlin/UltraNotifier.kt b/src/main/kotlin/UltraNotifier.kt index e6ce590..17798cc 100644 --- a/src/main/kotlin/UltraNotifier.kt +++ b/src/main/kotlin/UltraNotifier.kt @@ -5,7 +5,7 @@ import java.io.File object UltraNotifier { val logger = -//#if MC == 10809 +//#if MC <= 11404 //$$ org.apache.logging.log4j.LogManager.getLogger("UltraNotifier")!! //#else org.slf4j.LoggerFactory.getLogger("UltraNotifier")!! diff --git a/src/main/kotlin/UltraNotifierEntryPoint.kt b/src/main/kotlin/UltraNotifierEntryPoint.kt index 34525ea..67dd566 100644 --- a/src/main/kotlin/UltraNotifierEntryPoint.kt +++ b/src/main/kotlin/UltraNotifierEntryPoint.kt @@ -1,25 +1,29 @@ package moe.nea.ultranotifier //#if FORGE -//$$ import net.minecraftforge.fml.common.Mod +//$$import net.minecraftforge.fml.common.Mod //$$ //#if MC == 10809 -//$$ import net.minecraftforge.fml.common.event.FMLInitializationEvent -//$$ @Mod(modid = Constants.MOD_ID, version = Constants.VERSION, useMetadata = true) +//$$import net.minecraftforge.fml.common.event.FMLInitializationEvent +//$$@Mod(modid = Constants.MOD_ID, version = Constants.VERSION, useMetadata = true) //#else -//$$ @Mod(Constants.MOD_ID) +//$$@Mod(Constants.MOD_ID) //#endif -//$$ class UltraNotifierEntryPoint { -//$$ @Mod.EventHandler -//$$ fun onInit(@Suppress("UNUSED_PARAMETER") event: FMLInitializationEvent) { -//$$ UltraNotifier.onStartup() -//$$ } -//$$ } +//$$class UltraNotifierEntryPoint { +//#if MC == 10809 +//$$ @Mod.EventHandler +//$$ fun onInit(@Suppress("UNUSED_PARAMETER") event: FMLInitializationEvent) { +//#else +//$$ init { +//#endif +//$$ UltraNotifier.onStartup() +//$$ } +//$$} //#else import net.fabricmc.api.ModInitializer object UltraNotifierEntryPoint : ModInitializer { - override fun onInitialize() { - UltraNotifier.onStartup() - } + override fun onInitialize() { + UltraNotifier.onStartup() + } } //#endif diff --git a/src/main/kotlin/UltraNotifierEvents.kt b/src/main/kotlin/UltraNotifierEvents.kt index eb0d71f..d47a0be 100644 --- a/src/main/kotlin/UltraNotifierEvents.kt +++ b/src/main/kotlin/UltraNotifierEvents.kt @@ -17,7 +17,7 @@ object UltraNotifierEvents { abstract class UltraEvent : //#if FORGE -//$$ net.minecraftforge.fml.common.eventhandler.Event() +//$$ net.minecraftforge.eventbus.api.Event() //#else me.bush.eventbus.event.Event() //#endif diff --git a/versions/1.14.4-forge/src/main/resources/META-INF/mods.toml b/versions/1.14.4-forge/src/main/resources/META-INF/mods.toml new file mode 100644 index 0000000..faf1456 --- /dev/null +++ b/versions/1.14.4-forge/src/main/resources/META-INF/mods.toml @@ -0,0 +1,21 @@ +modLoader = "javafml" +loaderVersion = "[28,)" +[[mods]] +modId = "ultranotifier" +version = "${version}" +displayName = "${modName}" +description = "${description}" + +[[dependencies.ultranotifier]] +modId="forge" +mandatory=true +versionRange="[28,)" +ordering="NONE" +side="BOTH" + +[[dependencies.ultranotifier]] +modId="minecraft" +mandatory=true +versionRange="[1.14.4]" +ordering="NONE" +side="BOTH" \ No newline at end of file diff --git a/versions/mapping-1.14.4-forge-1.8.9.txt b/versions/mapping-1.14.4-forge-1.8.9.txt index 0cce902..f25eb1e 100644 --- a/versions/mapping-1.14.4-forge-1.8.9.txt +++ b/versions/mapping-1.14.4-forge-1.8.9.txt @@ -1,2 +1,3 @@ net.minecraft.client.gui.NewChatGui net.minecraft.client.gui.GuiNewChat -net.minecraft.util.text.ITextComponent net.minecraft.util.IChatComponent \ No newline at end of file +net.minecraft.util.text.ITextComponent net.minecraft.util.IChatComponent +net.minecraftforge.eventbus.api.Event net.minecraftforge.fml.common.eventhandler.Event -- cgit