From 030e507e6673fcca7ec3e97022436d63162b0011 Mon Sep 17 00:00:00 2001 From: Layue13 Date: Wed, 18 Nov 2026 17:21:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=BF=AB=E6=8D=B7=E9=94=AE=E5=9C=A8=20N?= =?UTF-8?q?EI=20=E6=97=A0=E9=85=8D=E6=96=B9=E7=95=8C=E9=9D=A2=E6=97=B6?= =?UTF-8?q?=E4=B8=8D=E5=86=8D=20NPE=20(#5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 5.5 --- ...nothing-when-NEI-has-no-recipe-GUI-t.patch | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 patches/0006-fix-hotkey-does-nothing-when-NEI-has-no-recipe-GUI-t.patch diff --git a/patches/0006-fix-hotkey-does-nothing-when-NEI-has-no-recipe-GUI-t.patch b/patches/0006-fix-hotkey-does-nothing-when-NEI-has-no-recipe-GUI-t.patch new file mode 100644 index 0000000..cb55db2 --- /dev/null +++ b/patches/0006-fix-hotkey-does-nothing-when-NEI-has-no-recipe-GUI-t.patch @@ -0,0 +1,29 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Stratum +Date: Wed, 18 Nov 2026 17:20:43 +0800 +Subject: [PATCH] fix: hotkey does nothing when NEI has no recipe GUI to open + (#5) + +--- + src/main/java/com/kuba6000/mobsinfo/KeyBindingHandler.java | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/main/java/com/kuba6000/mobsinfo/KeyBindingHandler.java b/src/main/java/com/kuba6000/mobsinfo/KeyBindingHandler.java +index 6944524..4725637 100644 +--- a/src/main/java/com/kuba6000/mobsinfo/KeyBindingHandler.java ++++ b/src/main/java/com/kuba6000/mobsinfo/KeyBindingHandler.java +@@ -31,10 +31,13 @@ public class KeyBindingHandler { + @SubscribeEvent + public void onKey(InputEvent.KeyInputEvent evt) { + if (mc.thePlayer != null && mc.theWorld != null && openGui.isPressed()) { +- GuiCraftingRecipe gui = (GuiCraftingRecipe) GuiCraftingRecipe.createRecipeGui( ++ Object created = GuiCraftingRecipe.createRecipeGui( + MobHandler.getInstance() + .getOverlayIdentifier(), + false); ++ // NEI returns null when no handler has any recipe (config not received yet, or Mob Handler disabled). ++ if (!(created instanceof GuiCraftingRecipe)) return; ++ GuiCraftingRecipe gui = (GuiCraftingRecipe) created; + if (LoaderReference.InfernalMobs.isLoaded) + gui.currenthandlers.add(new MobHandlerInfernal().addAllRecipes()); + gui.currenthandlers.add(new VillagerTradesHandler().addAllRecipes()); -- 2.47.3