diff --git a/common/src/main/java/com/aetherteam/cumulus/client/WorldDisplayHelper.java b/common/src/main/java/com/aetherteam/cumulus/client/WorldDisplayHelper.java index babba6e..3c6a366 100644 --- a/common/src/main/java/com/aetherteam/cumulus/client/WorldDisplayHelper.java +++ b/common/src/main/java/com/aetherteam/cumulus/client/WorldDisplayHelper.java @@ -4,6 +4,7 @@ import com.aetherteam.cumulus.CumulusConfig; import com.aetherteam.cumulus.mixin.mixins.client.accessor.MinecraftAccessor; import com.aetherteam.cumulus.mixin.mixins.common.accessor.MinecraftServerAccessor; +import com.mojang.blaze3d.systems.TimerQuery; import net.minecraft.client.CameraType; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.components.toasts.SystemToast; @@ -137,9 +138,13 @@ public static void stopLevel(@Nullable Screen screen) { * Sets up a menu through Cumulus and forces it as the current screen. */ public static void setMenu() { + MinecraftAccessor minecraftAccessor = (MinecraftAccessor) Minecraft.getInstance(); CumulusClient.MENU_HELPER.setShouldFade(false); Screen screen = CumulusClient.MENU_HELPER.applyMenu(CumulusClient.MENU_HELPER.getActiveMenu()); if (screen != null) { + if (minecraftAccessor.cumulus$getCurrentFrameProfile() != null && !minecraftAccessor.cumulus$getCurrentFrameProfile().isDone()) { + TimerQuery.getInstance().ifPresent((timer) -> minecraftAccessor.cumulus$setCurrentFrameProfile(timer.endProfile())); + } Minecraft.getInstance().forceSetScreen(screen); } } diff --git a/common/src/main/java/com/aetherteam/cumulus/mixin/mixins/client/accessor/MinecraftAccessor.java b/common/src/main/java/com/aetherteam/cumulus/mixin/mixins/client/accessor/MinecraftAccessor.java index fdff0a7..bf5ba4f 100644 --- a/common/src/main/java/com/aetherteam/cumulus/mixin/mixins/client/accessor/MinecraftAccessor.java +++ b/common/src/main/java/com/aetherteam/cumulus/mixin/mixins/client/accessor/MinecraftAccessor.java @@ -1,5 +1,6 @@ package com.aetherteam.cumulus.mixin.mixins.client.accessor; +import com.mojang.blaze3d.systems.TimerQuery; import net.minecraft.client.Minecraft; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; @@ -8,4 +9,10 @@ public interface MinecraftAccessor { @Accessor("isLocalServer") void cumulus$setIsLocalServer(boolean isLocalServer); + + @Accessor("currentFrameProfile") + TimerQuery.FrameProfile cumulus$getCurrentFrameProfile(); + + @Accessor("currentFrameProfile") + void cumulus$setCurrentFrameProfile(TimerQuery.FrameProfile currentFrameProfile); } diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 1772d74..decef44 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,3 +1,7 @@ +# Cumulus - 1.21.3-2.0.1 + +- Fix a crash from the timer frame profiler not having ended yet when loading a menu. + # Cumulus - 1.21.3-2.0.0 - Port to 1.21.3 diff --git a/gradle.properties b/gradle.properties index 2036e1e..d0fd75d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,7 +15,7 @@ parchment_version=2024.11.10 mod_id=cumulus_menus mod_group=com.aetherteam.cumulus mod_name=Cumulus -mod_version=2.0.0 +mod_version=2.0.1 mod_license=LGPL-3.0 mod_url=https://modrinth.com/mod/cumulus mod_update=https://github.com/The-Aether-Team/Cumulus/raw/1.21.3-develop/update.json diff --git a/update.json b/update.json index 4e8cb6c..f496b16 100644 --- a/update.json +++ b/update.json @@ -6,7 +6,7 @@ "1.20.1-recommended": "1.20.1-1.0.0-neoforge", "1.20.2-recommended": "1.20.2-1.0.1-neoforge", "1.20.4-recommended": "1.20.4-1.0.1-neoforge", - "1.21.1-recommended": "2.0.0", - "1.21.3-recommended": "2.0.0" + "1.21.1-recommended": "2.0.1", + "1.21.3-recommended": "2.0.1" } }