Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,10 @@ local.properties
run/

logs/

# macOS
.DS_Store
**/.DS_Store

# Local documentation / notes
docs/
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -21,8 +22,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) {
Expand Down Expand Up @@ -118,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;
Expand Down