From d4f31c8ae127ac4359f5f1ded5ddfed28566e35d Mon Sep 17 00:00:00 2001 From: Ruben Taelman Date: Mon, 28 Oct 2024 16:35:22 +0100 Subject: [PATCH] Fix EMI crash if EmiSearchWidget is not present, Closes CyclopsMC/IntegratedTerminals#133 --- .../modcompat/emi/EmiIntegratedTerminalsConfig.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/cyclops/integratedterminalscompat/modcompat/emi/EmiIntegratedTerminalsConfig.java b/src/main/java/org/cyclops/integratedterminalscompat/modcompat/emi/EmiIntegratedTerminalsConfig.java index 01e0eb4..447ec12 100644 --- a/src/main/java/org/cyclops/integratedterminalscompat/modcompat/emi/EmiIntegratedTerminalsConfig.java +++ b/src/main/java/org/cyclops/integratedterminalscompat/modcompat/emi/EmiIntegratedTerminalsConfig.java @@ -1,5 +1,6 @@ package org.cyclops.integratedterminalscompat.modcompat.emi; +import dev.emi.emi.api.EmiApi; import dev.emi.emi.api.EmiEntrypoint; import dev.emi.emi.api.EmiPlugin; import dev.emi.emi.api.EmiRegistry; @@ -87,7 +88,7 @@ public void onTerminalStorageScreenSize(TerminalStorageScreenSizeEvent event) { public void onSearchFieldUpdated(TerminalStorageTabClientSearchFieldUpdateEvent event) { // Copy the terminal search box contents into the JEI search box. if (!EmiScreenManager.isDisabled() && TerminalButtonItemStackCraftingGridSearchSync.isSearchSynced(event.getClientTab())) { - EmiScreenManager.search.setValue(event.getSearchString() + ""); + EmiApi.setSearchText(event.getSearchString() + ""); } } @@ -96,11 +97,11 @@ public void onKeyTyped(ScreenEvent.KeyReleased.Post event) { // Copy the JEI search box contents into the terminal search box. if (event.getScreen() instanceof ContainerScreenTerminalStorage) { ContainerScreenTerminalStorage gui = ((ContainerScreenTerminalStorage) event.getScreen()); - if (!EmiScreenManager.isDisabled() && EmiScreenManager.search.isFocused()) { + if (!EmiScreenManager.isDisabled() && EmiApi.isSearchFocused()) { gui.getSelectedClientTab().ifPresent(tab -> { if (TerminalButtonItemStackCraftingGridSearchSync.isSearchSynced(tab)) { WidgetTextFieldExtended fieldSearch = gui.getFieldSearch(); - fieldSearch.setValue(EmiScreenManager.search.getValue()); + fieldSearch.setValue(EmiApi.getSearchText()); tab.setInstanceFilter(gui.getMenu().getSelectedChannel(), fieldSearch.getValue() + ""); } });