Merge branch 'master' into jei_search

This commit is contained in:
Martin Robertz authored and GitHub committed 2024-06-11 20:19:43 +02:00
commit 34734a622b
4 files changed
+40 -1

No files matched your search

@@ -40,6 +40,7 @@ import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.gui.inventory.GuiContainerCreative;
import net.minecraft.client.renderer.InventoryEffectRenderer;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.inventory.Slot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -177,6 +178,8 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
return true;
}
}
// Maybe make this an option to make it easier to figure out what GPU class to add to the configuration?
// NEIClientConfig.logger.info("Checking for autofocus on " + guiClassName + " had no match");
return false;
}
@@ -228,7 +231,14 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
public boolean keyTyped(GuiContainer gui, char keyChar, int keyID) {
if (isEnabled() && !isHidden()) {
searchInitFocusedCancellable = false;
if (searchInitFocusedCancellable) {
searchInitFocusedCancellable = false;
if (NEIClientConfig.isFirstInvCloseClosesInSearch()
&& GameSettings.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindInventory)) {
searchField.setFocus(false);
setInputFocused(null);
}
}
if (inputFocused != null) return inputFocused.handleKeyPress(keyID, keyChar);
for (Widget widget : controlWidgets) if (widget.handleKeyPress(keyID, keyChar)) return true;
@@ -342,6 +342,20 @@ public class NEIClientConfig {
tag.getTag("inventory.showItemQuantityWidget").setComment("Show Item Quantity Widget").getBooleanValue(true);
API.addOption(new OptionToggleButton("inventory.showItemQuantityWidget", true));
tag.getTag("inventory.centerSearchWidget").setComment("Center Search Widget").getBooleanValue(true);
API.addOption(new OptionToggleButton("inventory.centerSearchWidget", true));
tag.getTag("inventory.focusSearchWidgetOnOpen")
.setComment(
"Focus Search Widget on Open, blurs/unfocuses on mouse move unless typing has started first")
.getBooleanValue(false);
API.addOption(new OptionToggleButton("inventory.focusSearchWidgetOnOpen", true));
tag.getTag("inventory.firstInvCloseClosesInSearch").setComment(
"Pressing the open inventory key when the inventory was just opened when the search is focused will close it instead of typing in the search")
.getBooleanValue(true);
API.addOption(new OptionToggleButton("inventory.firstInvCloseClosesInSearch", true));
tag.getTag("inventory.jei_style_tabs").setComment("Enable/disable JEI Style Tabs").getBooleanValue(true);
API.addOption(new OptionToggleButtonBoubs("inventory.jei_style_tabs", true));
@@ -688,6 +702,10 @@ public class NEIClientConfig {
return getBooleanSetting("inventory.search.widgetAutofocus");
}
public static boolean isFirstInvCloseClosesInSearch() {
return getBooleanSetting("inventory.firstInvCloseClosesInSearch");
}
public static boolean areJEIStyleTabsVisible() {
return getBooleanSetting("inventory.jei_style_tabs");
}