From f0107ea646f4ca3e12558b3b816d979e09f2c232 Mon Sep 17 00:00:00 2001 From: Kuina20 Date: Sat, 20 Jun 2026 17:52:19 +0800 Subject: [PATCH 1/2] fix: Creative Tab Animation --- .gitignore | 7 +++++++ build.gradle | 2 +- .../animations/OpeningAnimation.java | 11 ++++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index fdbc708..c0b3e99 100644 --- a/.gitignore +++ b/.gitignore @@ -83,3 +83,10 @@ local.properties run/ logs/ + +# macOS +.DS_Store +**/.DS_Store + +# Local documentation / notes +docs/ diff --git a/build.gradle b/build.gradle index 9ab4ccb..efa64a5 100644 --- a/build.gradle +++ b/build.gradle @@ -34,7 +34,7 @@ plugins { id 'eclipse' id 'maven-publish' id 'org.jetbrains.gradle.plugin.idea-ext' version '1.1.8' - id 'com.gtnewhorizons.retrofuturagradle' version '1.4.0' + id 'com.gtnewhorizons.retrofuturagradle' version '1.4.1' id 'net.darkhax.curseforgegradle' version '1.1.24' apply false id 'com.modrinth.minotaur' version '2.8.7' apply false id 'com.diffplug.spotless' version '6.13.0' apply false diff --git a/src/main/java/com/cleanroommc/neverenoughanimations/animations/OpeningAnimation.java b/src/main/java/com/cleanroommc/neverenoughanimations/animations/OpeningAnimation.java index 58722aa..78aa097 100644 --- a/src/main/java/com/cleanroommc/neverenoughanimations/animations/OpeningAnimation.java +++ b/src/main/java/com/cleanroommc/neverenoughanimations/animations/OpeningAnimation.java @@ -21,8 +21,17 @@ public static boolean onGuiOpen(GuiOpenEvent event) { public static boolean onGuiOpen(GuiScreen screen) { if (screen instanceof IAnimatedScreen animatedScreen) { - if (Minecraft.getMinecraft().currentScreen == null) { + GuiScreen current = Minecraft.getMinecraft().currentScreen; + if (current == null) { animate(animatedScreen, true); + } else if (current == animatedGui && startTime > 0) { + // The currently displayed animated screen is being instantly replaced by another + // animated screen while its opening animation is still running. This happens e.g. in + // creative mode where vanilla first opens GuiInventory and its initGui immediately + // swaps to GuiContainerCreative. Transfer the running opening animation to the new + // screen so neither the opening nor the later closing animation gets lost. + animatedGui = animatedScreen; + lastGui = animatedScreen; } } else if (Minecraft.getMinecraft().currentScreen == lastGui && screen == null && !shouldCloseLast) { if (animatedGui == null || getValue(animatedGui) >= 1f || startTime > 0) { From d07ea952d7d0ced6108a5fe3f79e214bb5e6e112 Mon Sep 17 00:00:00 2001 From: Kuina20 Date: Sun, 28 Jun 2026 10:02:18 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E5=85=B3=E9=97=AD=E7=89=A9=E5=93=81?= =?UTF-8?q?=E6=A0=8F=E6=97=B6=E9=94=81=E6=8C=89=E9=94=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/cleanroommc/neverenoughanimations/NEA.java | 1 + .../animations/OpeningAnimation.java | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/src/main/java/com/cleanroommc/neverenoughanimations/NEA.java b/src/main/java/com/cleanroommc/neverenoughanimations/NEA.java index eb279e3..cb15938 100644 --- a/src/main/java/com/cleanroommc/neverenoughanimations/NEA.java +++ b/src/main/java/com/cleanroommc/neverenoughanimations/NEA.java @@ -74,6 +74,7 @@ public static void onFrameTick() { public void onGuiTick(TickEvent.ClientTickEvent event) { //OpeningAnimation.checkGuiToClose(); if (event.phase == TickEvent.Phase.END) return; + OpeningAnimation.syncKeyBindsWhileClosing(); ItemHoverAnimation.onGuiTick(); } diff --git a/src/main/java/com/cleanroommc/neverenoughanimations/animations/OpeningAnimation.java b/src/main/java/com/cleanroommc/neverenoughanimations/animations/OpeningAnimation.java index 78aa097..93f0eb1 100644 --- a/src/main/java/com/cleanroommc/neverenoughanimations/animations/OpeningAnimation.java +++ b/src/main/java/com/cleanroommc/neverenoughanimations/animations/OpeningAnimation.java @@ -7,6 +7,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.settings.KeyBinding; import net.minecraftforge.client.event.GuiOpenEvent; public class OpeningAnimation { @@ -127,10 +128,17 @@ public static boolean isAnimatingClose(IAnimatedScreen screen) { return isAnimating(screen) && startTime < 0; } + public static void syncKeyBindsWhileClosing() { + if ((lastGui != null && animatedGui == lastGui && startTime < 0) || shouldCloseLast) { + KeyBinding.updateKeyBindState(); + } + } + public static void checkGuiToClose() { if (shouldCloseLast && lastGui != null) { //((GuiScreen) lastGui).allowUserInput = oldAllowAllInteractions; //oldAllowAllInteractions = false; + KeyBinding.updateKeyBindState(); Minecraft.getMinecraft().displayGuiScreen(null); shouldCloseLast = false; lastGui = null;