From aeef00f24df134271218c5d99fabb406b5a8e198 Mon Sep 17 00:00:00 2001 From: MrSphay Date: Thu, 7 May 2026 15:15:33 +0200 Subject: [PATCH] Migrate client tick subscribers --- docs/agent-handoff.md | 3 +++ .../explosionoverhaul/ClientSoundHandler.java | 14 ++++++-------- .../client/FirstTimeSetupHandler.java | 4 ++-- .../client/IntroMusicTickHandler.java | 7 ++----- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/docs/agent-handoff.md b/docs/agent-handoff.md index a5cb831..1b3a69b 100644 --- a/docs/agent-handoff.md +++ b/docs/agent-handoff.md @@ -24,6 +24,7 @@ The Gitea runner has been used for: - `BlockIndexManager` - Updated the `ExplosionMixin` complex constructor injection descriptor for Minecraft `1.21.1` after a client bootstrap crash showed the old Forge `1.20.1` constructor target no longer exists. - Updated `GameRendererBlurMixin` render callback and invoke descriptors for Minecraft `1.21.1` after the next client crash showed `GameRenderer#render` now receives `DeltaTracker, boolean`. +- Replaced client tick subscriber parameters that used the temporary `compat.TickEvent.ClientTickEvent` placeholder with NeoForge `ClientTickEvent.Post` after mod loading rejected non-Event subscriber parameters. - Fixed runner setup issues: - executable `gradlew` - tracked `gradle-wrapper.jar` @@ -36,6 +37,7 @@ The Gitea runner has been used for: | `git diff --check` | PASS before last committed source fixes | | `git diff --check` | PASS after NeoForge `21.1.225` metadata change and `ExplosionMixin` runtime crash fix | | `git diff --check` | PASS after `GameRendererBlurMixin` runtime crash fix | +| `git diff --check` | PASS after client tick subscriber event migration | | Gitea decompile workflow | PASS | | Gitea build workflow | FAIL, now reaches Java API migration errors | @@ -66,6 +68,7 @@ The remaining failures are real Forge-to-NeoForge/API-porting work, not runner s 4. Re-run the Gitea build after each API family rather than attempting all files at once. 5. Retest the client jar after the `ExplosionMixin` descriptor fix; the next crash, if any, should be a later runtime/API issue rather than the bootstrap constructor mismatch. 6. Retest the client jar after the `GameRendererBlurMixin` descriptor fix; the next crash, if any, should be the next stale mixin/API target. +7. Retest the client jar after the client tick event migration; the next crash, if any, should be a later mod-loading/runtime issue. ## Risks diff --git a/src/main/java/com/vinlanx/explosionoverhaul/ClientSoundHandler.java b/src/main/java/com/vinlanx/explosionoverhaul/ClientSoundHandler.java index 78ab190..deba2d7 100644 --- a/src/main/java/com/vinlanx/explosionoverhaul/ClientSoundHandler.java +++ b/src/main/java/com/vinlanx/explosionoverhaul/ClientSoundHandler.java @@ -4,7 +4,7 @@ package com.vinlanx.explosionoverhaul; import net.neoforged.neoforge.client.event.sound.PlaySoundEvent; -import com.vinlanx.explosionoverhaul.compat.TickEvent; +import net.neoforged.neoforge.client.event.ClientTickEvent; import net.neoforged.bus.api.EventPriority; import net.neoforged.bus.api.SubscribeEvent; @@ -18,13 +18,11 @@ public class ClientSoundHandler { } @SubscribeEvent - public void onClientTick(TickEvent.ClientTickEvent event) { - if (event.phase == TickEvent.Phase.END) { - if (suppressionTicksRemaining > 0) { - --suppressionTicksRemaining; - } else if (suppressionTicksRemaining == 0 && suppressVanillaExplosionSound) { - suppressVanillaExplosionSound = false; - } + public void onClientTick(ClientTickEvent.Post event) { + if (suppressionTicksRemaining > 0) { + --suppressionTicksRemaining; + } else if (suppressionTicksRemaining == 0 && suppressVanillaExplosionSound) { + suppressVanillaExplosionSound = false; } } diff --git a/src/main/java/com/vinlanx/explosionoverhaul/client/FirstTimeSetupHandler.java b/src/main/java/com/vinlanx/explosionoverhaul/client/FirstTimeSetupHandler.java index 54eb54a..bf1c9b3 100644 --- a/src/main/java/com/vinlanx/explosionoverhaul/client/FirstTimeSetupHandler.java +++ b/src/main/java/com/vinlanx/explosionoverhaul/client/FirstTimeSetupHandler.java @@ -10,7 +10,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.TitleScreen; import net.neoforged.api.distmarker.Dist; -import com.vinlanx.explosionoverhaul.compat.TickEvent; +import net.neoforged.neoforge.client.event.ClientTickEvent; import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.fml.common.Mod; import net.neoforged.fml.common.EventBusSubscriber; @@ -21,7 +21,7 @@ public class FirstTimeSetupHandler { private static boolean pendingShowIntro = false; @SubscribeEvent - public static void onClientTick(TickEvent.ClientTickEvent event) { + public static void onClientTick(ClientTickEvent.Post event) { } static { diff --git a/src/main/java/com/vinlanx/explosionoverhaul/client/IntroMusicTickHandler.java b/src/main/java/com/vinlanx/explosionoverhaul/client/IntroMusicTickHandler.java index de9240f..6326393 100644 --- a/src/main/java/com/vinlanx/explosionoverhaul/client/IntroMusicTickHandler.java +++ b/src/main/java/com/vinlanx/explosionoverhaul/client/IntroMusicTickHandler.java @@ -5,7 +5,7 @@ package com.vinlanx.explosionoverhaul.client; import com.vinlanx.explosionoverhaul.client.IntroMusicManager; import net.neoforged.api.distmarker.Dist; -import com.vinlanx.explosionoverhaul.compat.TickEvent; +import net.neoforged.neoforge.client.event.ClientTickEvent; import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.fml.common.Mod; import net.neoforged.fml.common.EventBusSubscriber; @@ -15,10 +15,7 @@ public class IntroMusicTickHandler { private static long lastTickTime = System.currentTimeMillis(); @SubscribeEvent - public static void onClientTick(TickEvent.ClientTickEvent event) { - if (event.phase != TickEvent.Phase.END) { - return; - } + public static void onClientTick(ClientTickEvent.Post event) { IntroMusicManager musicManager = IntroMusicManager.getInstance(); if (musicManager.isPlaying() || musicManager.isFadingOut()) { long currentTime = System.currentTimeMillis();