Skip to content

Commit

Permalink
Fix GT-New-Horizons-Modpack#7789 - Game Over GUI buttons disabled if …
Browse files Browse the repository at this point in the history
…switching fullscreen
  • Loading branch information
ElNounch committed Apr 8, 2021
1 parent 83bc310 commit bf2dd64
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ public enum MixinSets {
() -> config.dropPickedLootOnDespawn,
Collections.singletonList("dropPickedLootOnDespawn.MixinEntityLiving")
),
GAMEOVER_GUI_LOCKED_DISABLED("Game Over GUI buttons disabled if switching fullscreen Fix",
() -> config.fixGuiGameOver,
Collections.singletonList("fixGuiGameOver.MixinGuiGameOver")
),
WAKE_ANCHORS_ON_LOGIN("Wake up personal anchors on owner login",
() -> config.installAnchorAlarm,
"Railcraft_1.7.10",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public class LoadingConfig {
public boolean fixHungerOverhaul;
public boolean removeUpdateChecks;
public boolean preventPickupLoot;
public boolean dropPickedLootOnDespawn;
public boolean dropPickedLootOnDespawn;
public boolean fixGuiGameOver;
public boolean installAnchorAlarm;
// ASM
public boolean pollutionAsm;
Expand All @@ -44,6 +45,7 @@ public LoadingConfig(File file) {
fixThaumcraftUnprotectedGetBlock = config.get("fixes", "fixThaumcraftUnprotectedGetBlock", true, "Various Thaumcraft unchecked getBlock() patches").getBoolean();
fixHungerOverhaul = config.get("fixes", "fixHungerOverhaul", true, "Fix hunger overhaul low stat effects").getBoolean();
removeUpdateChecks = config.get("fixes", "removeUpdateChecks", true, "Remove old/stale/outdated update checks.").getBoolean();
fixGuiGameOver = config.get("fixes", "fixGuiGameOver", true, "Fix Game Over GUI buttons disabled if switching fullscreen").getBoolean();
installAnchorAlarm = config.get("tweaks", "installAnchorAlarm", true, "Wake up passive & personal anchors on player login").getBoolean();

preventPickupLoot = config.get("tweaks", "preventPickupLoot", true, "Prevent monsters from picking up loot.").getBoolean();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.mitchej123.hodgepodge.mixins.fixGuiGameOver;

import net.minecraft.client.gui.GuiGameOver;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(GuiGameOver.class)
public class MixinGuiGameOver {

// Number of ticks screen was open
@Shadow
private int field_146347_a;

/**
* @author ElNounch
* @reason Fix Game Over GUI buttons disabled if switching fullscreen
*/
@Inject(method = "initGui", at = @At("HEAD"))
public void resetedInitGui(CallbackInfo ci) {
if (field_146347_a > 19) {
// Make sure buttons will be re-enabled next tick
field_146347_a = 19;
}
}
}

0 comments on commit bf2dd64

Please sign in to comment.