Skip to content

Commit

Permalink
fix: attempt profile crash solution
Browse files Browse the repository at this point in the history
  • Loading branch information
bconlon1 committed Dec 22, 2024
1 parent 07b441f commit b66f439
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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);
}

0 comments on commit b66f439

Please sign in to comment.