Skip to content

Commit

Permalink
Fix warp menu not opening with NEU button
Browse files Browse the repository at this point in the history
- Fix debug logging check
- Add gradle task for production debugging
  • Loading branch information
ILikePlayingGames committed Jul 5, 2023
1 parent ef2e088 commit 08a4ab1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
8 changes: 8 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -138,5 +138,13 @@ tasks.shadowJar {
// fun relocate(name: String) = relocate(name, "$baseGroup.deps.$name")
}

/**
* Copy built jar into a Minecraft launcher instance for debugging in a production environment
*/
val copyJarToMinecraftLauncher by tasks.registering(Copy::class) {
from(file(buildDir.resolve("libs")))
into(file(System.getenv("MC_LAUNCHER_DIR")))
}

tasks.assemble.get().dependsOn(tasks.remapJar)

Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
public class LogHelper {
public static final boolean DEBUG_ENABLED = FancyWarpMenu.logger.isDebugEnabled()
|| ((Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment")
&& System.getProperties().containsKey("fancywarpmenu.debug"));
|| Boolean.getBoolean("fancywarpmenu.debug"));

public static void logDebug(String message, Throwable throwable) {
logDebug(message, throwable, new Object[0]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelOutboundHandlerAdapter;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiChat;
import net.minecraft.client.gui.inventory.GuiChest;
import net.minecraft.inventory.ContainerChest;
import net.minecraft.util.ChatComponentTranslation;
Expand Down Expand Up @@ -146,8 +147,8 @@ public void onWarpCommand() {
warpScreen = new GuiFancyWarp();
mc.ingameGUI.getChatGUI().addToSentMessages("/warp");

if (mc.currentScreen != null) {
// Display on next GUI open in case the current screen closes itself after this method returns (e.g. GuiChat)
// GuiChat closes itself after executing the command so wait until after it closes to open the warp menu.
if (mc.currentScreen instanceof GuiChat) {
openMenuRequested = true;
} else {
mc.displayGuiScreen(warpScreen);
Expand Down

0 comments on commit 08a4ab1

Please sign in to comment.