[Feature] Keybinding Refactoring (#957)

Co-authored-by: Martin Robertz <dream-master@gmx.net>
This commit is contained in:
slprimeandMartin Robertz authored and GitHub committed 2026-07-04 14:38:02 +03:00
1 parent 841b73c6fe
commit 26beb079f0
37 files changed
+353 -478

No files matched your search

@@ -799,15 +799,15 @@ public class BookmarkPanel extends PanelWidget<BookmarkGrid> {
NEIMouseUtils.getKeyName(NEIMouseUtils.MOUSE_BTN_RMB),
NEIClientUtils.translate("bookmark.group.toggle_crafting_chain"));
hotkeys.put(
NEIClientConfig.getKeyName("gui.remove_recipe"),
KeyManager.getKeyName("bookmark.remove_recipe", NEIClientUtils.SHIFT_HASH),
NEIClientUtils.translate("bookmark.group.remove_recipe"));
if (BookmarkContainerInfo.getBookmarkContainerHandler(NEIClientUtils.getGuiContainer()) != null) {
hotkeys.put(
NEIClientConfig.getKeyName("gui.bookmark_pull_items"),
KeyManager.getKeyName("bookmark.pull_items"),
NEIClientUtils.translate("bookmark.group.pull_items"));
hotkeys.put(
NEIClientConfig.getKeyName("gui.bookmark_pull_items", NEIClientUtils.SHIFT_HASH),
KeyManager.getKeyName("bookmark.pull_items", NEIClientUtils.SHIFT_HASH),
NEIClientUtils.translate("bookmark.group.pull_items_shift"));
}
@@ -28,7 +28,7 @@ public class HUDRenderer implements IKeyStateTracker {
@Override
public void tickKeyStates() {
if (KeyManager.keyStates.get("world.highlight_tips").down) {
if (KeyManager.isPressed("world.highlight_tips")) {
ConfigTag tag = NEIClientConfig.getSetting("world.highlight_tips");
tag.setBooleanValue(!tag.getBooleanValue());
}
+6 -6
View File
@@ -42,7 +42,7 @@ public class ItemZoom extends Widget implements IContainerInputHandler {
if (this.stack != null && this.availableAreaWidth >= SLOT_SIZE * 2
&& (NEIClientConfig.getBooleanSetting("inventory.itemzoom.enabled")
|| NEIClientConfig.isKeyHashDown("gui.itemzoom_hold"))
|| KeyManager.isHashDown("itemzoom.hold"))
&& GuiContainerManager.shouldShowTooltip(NEIClientUtils.getGuiContainer())) {
final float inverseScaleFactor = 1.0f / this.scale;
final float screenScale = getScreenScale();
@@ -74,7 +74,7 @@ public class ItemZoom extends Widget implements IContainerInputHandler {
if (NEIClientConfig.getBooleanSetting("inventory.itemzoom.enabled")
&& NEIClientConfig.getBooleanSetting("inventory.itemzoom.helpText")) {
String keyName = NEIClientConfig.getKeyName("gui.itemzoom_toggle");
String keyName = KeyManager.getKeyName("itemzoom.toggle", NEIClientUtils.SHIFT_HASH);
if (keyName != null) {
String helpText = NEIClientUtils.translate("itemzoom.toggle", keyName);
@@ -198,24 +198,24 @@ public class ItemZoom extends Widget implements IContainerInputHandler {
@Override
public boolean lastKeyTyped(GuiContainer gui, char keyChar, int keyID) {
if (NEIClientConfig.isKeyHashDown("gui.itemzoom_toggle")) {
if (KeyManager.isHashDown("itemzoom.toggle", NEIClientUtils.SHIFT_HASH)) {
NEIClientConfig.getSetting("inventory.itemzoom.enabled")
.setBooleanValue(!NEIClientConfig.getBooleanSetting("inventory.itemzoom.enabled"));
return true;
}
if (this.stack != null && NEIClientConfig.isKeyHashDown("gui.itemzoom_hold")) {
if (this.stack != null && KeyManager.isHashDown("itemzoom.hold")) {
return true;
}
if (this.stack != null && NEIClientConfig.isKeyHashDown("gui.itemzoom_zoom_in")) {
if (this.stack != null && KeyManager.isHashDown("itemzoom.zoom_in")) {
increaseZoom(gui);
previousKeyboardRepeatEnabled = Keyboard.areRepeatEventsEnabled();
Keyboard.enableRepeatEvents(true);
return true;
}
if (this.stack != null && NEIClientConfig.isKeyHashDown("gui.itemzoom_zoom_out")) {
if (this.stack != null && KeyManager.isHashDown("itemzoom.zoom_out")) {
decreaseZoom(gui);
previousKeyboardRepeatEnabled = Keyboard.areRepeatEventsEnabled();
Keyboard.enableRepeatEvents(true);
+87 -23
View File
@@ -2,14 +2,19 @@ package codechicken.nei;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map.Entry;
import java.util.Map;
import java.util.StringJoiner;
import net.minecraft.client.settings.KeyBinding;
import org.lwjgl.input.Keyboard;
import codechicken.nei.util.NEIKeyboardUtils;
import codechicken.nei.util.NEIMouseUtils;
import cpw.mods.fml.client.registry.ClientRegistry;
/**
* Good old down/held/up keystate tracker
* Registers NEI key bindings as vanilla {@link KeyBinding}s and exposes their state to the rest of NEI.
*/
public class KeyManager {
@@ -18,33 +23,92 @@ public class KeyManager {
public void tickKeyStates();
}
public static class KeyState {
public boolean down;
public boolean held;
public boolean up;
}
public static HashMap<String, KeyState> keyStates = new HashMap<>();
public static LinkedList<IKeyStateTracker> trackers = new LinkedList<>();
public static void tickKeyStates() {
for (Entry<String, KeyState> entry : keyStates.entrySet()) {
final int keyCode = NEIKeyboardUtils.unhash(NEIClientConfig.getKeyBinding(entry.getKey()));
final boolean down = keyCode > 0 && keyCode < Keyboard.KEYBOARD_SIZE && Keyboard.isKeyDown(keyCode);
final KeyState state = entry.getValue();
private static final Map<String, KeyBinding> keyBindings = new HashMap<>();
if (down) {
state.down = !state.held;
state.up = false;
} else {
state.up = state.held;
state.down = false;
}
public static KeyBinding registerKeyBinding(String ident, int defaultKey) {
return keyBindings.computeIfAbsent(ident, id -> {
final KeyBinding binding = new KeyBinding(
"nei.options.keys." + id,
NEIKeyboardUtils.unhash(defaultKey),
categoryFor(id));
ClientRegistry.registerKeyBinding(binding);
return binding;
});
}
state.held = down;
public static KeyBinding getKeyBinding(String ident) {
return keyBindings.get(ident);
}
public static int getKeyCode(String ident) {
final KeyBinding binding = keyBindings.get(ident);
return binding == null ? Keyboard.KEY_NONE : binding.getKeyCode();
}
public static boolean isKeyDown(String ident) {
final KeyBinding binding = keyBindings.get(ident);
final int keyCode = binding == null ? Keyboard.KEY_NONE : binding.getKeyCode();
return keyCode > Keyboard.KEY_NONE && keyCode < Keyboard.KEYBOARD_SIZE && Keyboard.isKeyDown(keyCode);
}
public static boolean isHashDown(String ident) {
return isHashDown(ident, 0);
}
public static boolean isHashDown(String ident, int modifierMask) {
if (isKeyDown(ident)) {
return ((modifierMask & NEIKeyboardUtils.CTRL_HASH) != 0) == NEIClientUtils.controlKey()
&& ((modifierMask & NEIKeyboardUtils.SHIFT_HASH) != 0) == NEIClientUtils.shiftKey()
&& ((modifierMask & NEIKeyboardUtils.ALT_HASH) != 0) == NEIClientUtils.altKey();
}
return false;
}
public static String getKeyName(String ident) {
return getKeyName(ident, 0);
}
public static String getKeyName(String ident, int meta) {
final int keyCode = getKeyCode(ident);
return keyCode == Keyboard.KEY_NONE ? null : NEIKeyboardUtils.getKeyName(keyCode + meta);
}
public static String getKeyName(String ident, int meta, int mouseBind) {
final int keyCode = getKeyCode(ident);
return keyCode == Keyboard.KEY_NONE && mouseBind == NEIMouseUtils.MOUSE_BTN_NONE ? null
: getKeyName(keyCode + meta, mouseBind);
}
public static String getKeyName(int keyBind, int mouseBind) {
StringJoiner keyText = new StringJoiner(" + ");
String keyHash = keyBind == Keyboard.KEY_NONE ? "" : NEIKeyboardUtils.getKeyName(keyBind);
String mouseHash = mouseBind == NEIMouseUtils.MOUSE_BTN_NONE ? "" : NEIMouseUtils.getKeyName(mouseBind);
if (!keyHash.isEmpty()) {
keyText.add(keyHash);
}
if (!mouseHash.isEmpty()) {
keyText.add(mouseHash);
}
return keyText.toString();
}
public static boolean isPressed(String ident) {
final KeyBinding binding = keyBindings.get(ident);
return binding != null && binding.isPressed();
}
private static String categoryFor(String ident) {
final int dot = ident.indexOf('.');
return dot < 0 ? "nei.options.keys" : "nei.options.keys." + ident.substring(0, dot);
}
public static void tickKeyStates() {
for (IKeyStateTracker tracker : trackers) tracker.tickKeyStates();
}
}
@@ -224,17 +224,17 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
@Override
public boolean lastKeyTyped(GuiContainer gui, char keyChar, int keyID) {
if (NEIClientConfig.isKeyHashDown("gui.hide")) {
if (KeyManager.isHashDown("gui.hide")) {
toggleBooleanSetting("inventory.hidden");
return true;
}
if (NEIClientConfig.isKeyHashDown("gui.hide_bookmarks")) {
if (KeyManager.isHashDown("bookmark.hide")) {
toggleBooleanSetting("inventory.bookmarks.enabled");
return true;
}
if (NEIClientConfig.isKeyHashDown("gui.next_tooltip") && GuiContainerManager.incrementTooltipPage()) {
if (KeyManager.isKeyDown("gui.next_tooltip") && GuiContainerManager.incrementTooltipPage()) {
return true;
}
@@ -941,12 +941,12 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
public void tickKeyStates() {
if (Minecraft.getMinecraft().currentScreen != null) return;
if (KeyManager.keyStates.get("world.dawn").down) timeButtons[0].onButtonPress(false);
if (KeyManager.keyStates.get("world.noon").down) timeButtons[1].onButtonPress(false);
if (KeyManager.keyStates.get("world.dusk").down) timeButtons[2].onButtonPress(false);
if (KeyManager.keyStates.get("world.midnight").down) timeButtons[3].onButtonPress(false);
if (KeyManager.keyStates.get("world.rain").down) rain.onButtonPress(false);
if (KeyManager.keyStates.get("world.heal").down) heal.onButtonPress(false);
if (KeyManager.keyStates.get("world.creative").down) gamemode.onButtonPress(false);
if (KeyManager.isPressed("world.dawn")) timeButtons[0].onButtonPress(false);
if (KeyManager.isPressed("world.noon")) timeButtons[1].onButtonPress(false);
if (KeyManager.isPressed("world.dusk")) timeButtons[2].onButtonPress(false);
if (KeyManager.isPressed("world.midnight")) timeButtons[3].onButtonPress(false);
if (KeyManager.isPressed("world.rain")) rain.onButtonPress(false);
if (KeyManager.isPressed("world.heal")) heal.onButtonPress(false);
if (KeyManager.isPressed("world.creative")) gamemode.onButtonPress(false);
}
}
@@ -61,7 +61,6 @@ import codechicken.nei.recipe.IRecipeHandler;
import codechicken.nei.recipe.InformationHandler;
import codechicken.nei.recipe.RecipeCatalysts;
import codechicken.nei.util.ItemUntranslator;
import codechicken.nei.util.NEIKeyboardUtils;
import codechicken.obfuscator.ObfuscationRun;
public class NEIClientConfig {
@@ -815,35 +814,37 @@ public class NEIClientConfig {
}
private static void setDefaultKeyBindings() {
API.addHashBind("gui.recipe", Keyboard.KEY_R);
API.addHashBind("gui.usage", Keyboard.KEY_U);
API.addKeyBind("gui.back", Keyboard.KEY_BACK);
API.addHashBind("gui.enchant", Keyboard.KEY_X);
API.addHashBind("gui.potion", Keyboard.KEY_P);
API.addKeyBind("gui.enchant", Keyboard.KEY_X);
API.addKeyBind("gui.potion", Keyboard.KEY_P);
API.addKeyBind("gui.prev", Keyboard.KEY_PRIOR);
API.addKeyBind("gui.next", Keyboard.KEY_NEXT);
API.addKeyBind("gui.prev_machine", Keyboard.KEY_UP);
API.addKeyBind("gui.next_machine", Keyboard.KEY_DOWN);
API.addKeyBind("gui.prev_recipe", Keyboard.KEY_LEFT);
API.addKeyBind("gui.next_recipe", Keyboard.KEY_RIGHT);
API.addHashBind("gui.hide", Keyboard.KEY_O);
API.addHashBind("gui.search", Keyboard.KEY_F);
API.addKeyBind("gui.bookmark", Keyboard.KEY_A);
API.addHashBind("gui.favorite", Keyboard.KEY_F + NEIClientUtils.SHIFT_HASH);
API.addKeyBind("gui.favorite_item", Keyboard.KEY_F);
API.addHashBind("gui.remove_recipe", Keyboard.KEY_A + NEIClientUtils.SHIFT_HASH);
API.addKeyBind("gui.bookmark_pull_items", Keyboard.KEY_V);
API.addKeyBind("gui.hide", Keyboard.KEY_O);
API.addKeyBind("gui.search", Keyboard.KEY_F);
API.addKeyBind("gui.overlay", Keyboard.KEY_S);
API.addKeyBind("gui.craft_items", Keyboard.KEY_C);
API.addHashBind("gui.hide_bookmarks", Keyboard.KEY_B);
API.addKeyBind("gui.getprevioussearch", Keyboard.KEY_UP);
API.addKeyBind("gui.getnextsearch", Keyboard.KEY_DOWN);
API.addKeyBind("gui.next_tooltip", Keyboard.KEY_Z);
API.addHashBind("gui.itemzoom_toggle", Keyboard.KEY_Z + NEIClientUtils.SHIFT_HASH);
API.addHashBind("gui.itemzoom_hold", 0);
API.addHashBind("gui.itemzoom_zoom_in", 0);
API.addHashBind("gui.itemzoom_zoom_out", 0);
API.addKeyBind("recipe.recipe", Keyboard.KEY_R);
API.addKeyBind("recipe.usage", Keyboard.KEY_U);
API.addKeyBind("recipe.back", Keyboard.KEY_BACK);
API.addKeyBind("recipe.prev_machine", Keyboard.KEY_UP);
API.addKeyBind("recipe.next_machine", Keyboard.KEY_DOWN);
API.addKeyBind("recipe.prev_recipe", Keyboard.KEY_LEFT);
API.addKeyBind("recipe.next_recipe", Keyboard.KEY_RIGHT);
API.addKeyBind("bookmark.add", Keyboard.KEY_A);
API.addKeyBind("bookmark.favorite", Keyboard.KEY_F);
API.addKeyBind("bookmark.favorite_item", Keyboard.KEY_F);
API.addKeyBind("bookmark.remove_recipe", Keyboard.KEY_A);
API.addKeyBind("bookmark.pull_items", Keyboard.KEY_V);
API.addKeyBind("bookmark.hide", Keyboard.KEY_B);
API.addKeyBind("itemzoom.toggle", Keyboard.KEY_Z);
API.addKeyBind("itemzoom.hold", 0);
API.addKeyBind("itemzoom.zoom_in", 0);
API.addKeyBind("itemzoom.zoom_out", 0);
API.addKeyBind("world.chunkoverlay", Keyboard.KEY_F9);
API.addKeyBind("world.moboverlay", Keyboard.KEY_F7);
@@ -855,10 +856,11 @@ public class NEIClientConfig {
API.addKeyBind("world.rain", 0);
API.addKeyBind("world.heal", 0);
API.addKeyBind("world.creative", 0);
API.addHashBind("gui.copy_name", Keyboard.KEY_C + NEIClientUtils.CTRL_HASH);
API.addHashBind("gui.copy_oredict", Keyboard.KEY_D + NEIClientUtils.CTRL_HASH);
API.addHashBind("gui.copy_id", Keyboard.KEY_X + NEIClientUtils.CTRL_HASH);
API.addHashBind("gui.chat_link_item", Keyboard.KEY_L + NEIClientUtils.CTRL_HASH);
API.addKeyBind("copy.name", Keyboard.KEY_C);
API.addKeyBind("copy.oredict", Keyboard.KEY_D);
API.addKeyBind("copy.identifier", Keyboard.KEY_X);
API.addKeyBind("copy.chat_link_item", Keyboard.KEY_L);
}
public static OptionList getOptionList() {
@@ -929,50 +931,28 @@ public class NEIClientConfig {
world.saveNBT();
}
private static final Map<String, String> keySettings = new HashMap<>();
public static int getKeyBinding(String string) {
final String key = keySettings.computeIfAbsent(string, s -> "keys." + s);
return getSetting(key).getIntValue(Keyboard.KEY_NONE);
return KeyManager.getKeyCode(string);
}
public static void setDefaultKeyBinding(String string, int key) {
getSetting("keys." + string).getIntValue(key);
KeyManager.registerKeyBinding(string, key);
}
public static boolean isKeyHashDown(String string) {
final int hash = getKeyBinding(string);
if (hash != Keyboard.CHAR_NONE && Keyboard.getEventKeyState()) {
return KeyManager.keyStates.containsKey(string) ? Keyboard.isKeyDown(NEIKeyboardUtils.unhash(hash))
: hash == NEIClientUtils.getKeyHash();
}
return false;
return KeyManager.isHashDown(string);
}
public static String getKeyName(String keyBind) {
return getKeyName(keyBind, 0);
return KeyManager.getKeyName(keyBind);
}
public static String getKeyName(String keyBind, int meta, int mouseBind) {
final int hash = getKeyBinding(keyBind);
if (hash == Keyboard.CHAR_NONE) {
return null;
}
return NEIClientUtils.getKeyName(hash + meta, mouseBind);
return KeyManager.getKeyName(keyBind, meta, mouseBind);
}
public static String getKeyName(String keyBind, int meta) {
final int hash = getKeyBinding(keyBind);
if (hash == Keyboard.CHAR_NONE) {
return null;
}
return NEIKeyboardUtils.getKeyName(hash + meta);
return KeyManager.getKeyName(keyBind, meta);
}
public static void bootNEI() {
@@ -25,7 +25,6 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.StringJoiner;
import java.util.stream.Collectors;
import net.minecraft.client.Minecraft;
@@ -57,7 +56,6 @@ import codechicken.nei.api.GuiInfo;
import codechicken.nei.api.IInfiniteItemHandler;
import codechicken.nei.api.ItemInfo;
import codechicken.nei.util.NEIKeyboardUtils;
import codechicken.nei.util.NEIMouseUtils;
public class NEIClientUtils extends NEIServerUtils {
@@ -456,55 +454,8 @@ public class NEIClientUtils extends NEIServerUtils {
return Keyboard.isKeyDown(Keyboard.KEY_LMENU) || Keyboard.isKeyDown(Keyboard.KEY_RMENU);
}
public static int getMetaHash() {
if (Keyboard.getEventKeyState()) {
int hash = 0;
if (altKey()) {
hash = hash | ALT_HASH;
}
if (shiftKey()) {
hash = hash | SHIFT_HASH;
}
if (controlKey()) {
hash = hash | CTRL_HASH;
}
return hash;
}
return 0;
}
public static int getKeyHash() {
if (Keyboard.getEventKeyState()) {
final int keycode = Keyboard.getEventKey();
if (!NEIKeyboardUtils.isHashKey(keycode)) {
return getMetaHash() + keycode;
}
}
return Keyboard.CHAR_NONE;
}
public static String getKeyName(int keyBind, int mouseBind) {
StringJoiner keyText = new StringJoiner(" + ");
String keyHash = keyBind == Keyboard.KEY_NONE ? "" : NEIKeyboardUtils.getKeyName(keyBind);
String mouseHash = mouseBind == NEIMouseUtils.MOUSE_BTN_NONE ? "" : NEIMouseUtils.getKeyName(mouseBind);
if (!keyHash.isEmpty()) {
keyText.add(keyHash);
}
if (!mouseHash.isEmpty()) {
keyText.add(mouseHash);
}
return keyText.toString();
return KeyManager.getKeyName(keyBind, mouseBind);
}
public static void playClickSound() {
@@ -309,12 +309,12 @@ public abstract class PanelWidget<T extends ItemsGrid<? extends ItemsGridSlot, ?
final Point mouse = GuiDraw.getMousePosition();
if (!contains(mouse.x, mouse.y)) return false;
if (NEIClientConfig.isKeyHashDown("gui.next")) {
if (KeyManager.isKeyDown("gui.next")) {
this.grid.shiftPage(1);
return true;
}
if (NEIClientConfig.isKeyHashDown("gui.prev")) {
if (KeyManager.isKeyDown("gui.prev")) {
this.grid.shiftPage(-1);
return true;
}
@@ -24,12 +24,12 @@ public class PopupInputHandler implements IContainerInputHandler {
@Override
public boolean lastKeyTyped(GuiContainer gui, char keyChar, int keyID) {
if (NEIClientConfig.isKeyHashDown("gui.enchant") && canPerformAction("enchant")) {
if (KeyManager.isHashDown("gui.enchant") && canPerformAction("enchant")) {
NEICPH.sendOpenEnchantmentWindow();
return true;
}
if (NEIClientConfig.isKeyHashDown("gui.potion") && canPerformAction("potion")) {
if (KeyManager.isHashDown("gui.potion") && canPerformAction("potion")) {
NEICPH.sendOpenPotionWindow();
return true;
}
@@ -50,11 +50,11 @@ public abstract class RecipeSearchField extends TextField implements ItemFilterP
@Override
public void lastKeyTyped(int keyID, char keyChar) {
if (focused() && NEIClientConfig.isKeyHashDown("gui.getprevioussearch")) {
if (focused() && KeyManager.isKeyDown("gui.getprevioussearch")) {
handleNavigateHistory(TextHistory.Direction.PREVIOUS);
}
if (focused() && NEIClientConfig.isKeyHashDown("gui.getnextsearch")) {
if (focused() && KeyManager.isKeyDown("gui.getnextsearch")) {
handleNavigateHistory(TextHistory.Direction.NEXT);
}
}
@@ -230,14 +230,14 @@ public class SearchField extends TextField implements ItemFilterProvider {
@Override
public void lastKeyTyped(int keyID, char keyChar) {
if (isVisible() && NEIClientConfig.isKeyHashDown("gui.search")) {
if (isVisible() && KeyManager.isHashDown("gui.search")) {
setFocus(true);
}
if (focused() && NEIClientConfig.isKeyHashDown("gui.getprevioussearch")) {
if (focused() && KeyManager.isKeyDown("gui.getprevioussearch")) {
handleNavigateHistory(TextHistory.Direction.PREVIOUS);
}
if (focused() && NEIClientConfig.isKeyHashDown("gui.getnextsearch")) {
if (focused() && KeyManager.isKeyDown("gui.getnextsearch")) {
handleNavigateHistory(TextHistory.Direction.NEXT);
}
}
@@ -40,12 +40,13 @@ public class WorldOverlayRenderer implements IKeyStateTracker {
public void tickKeyStates() {
if (Minecraft.getMinecraft().currentScreen != null) return;
if (KeyManager.keyStates.get("world.moboverlay").down) {
if (KeyManager.isPressed("world.moboverlay")) {
mobOverlay = (mobOverlay + 1) % 2;
NEIClientUtils
.printChatMessage(new ChatComponentText(NEIClientUtils.translate("chat.moboverlay." + mobOverlay)));
}
if (KeyManager.keyStates.get("world.chunkoverlay").down) {
if (KeyManager.isPressed("world.chunkoverlay")) {
chunkOverlay = (chunkOverlay + 1) % (NEIModContainer.isGT5Loaded() ? 4 : 3);
// 0-2 (or 3 with gt)
NEIClientUtils.printChatMessage(
+2 -13
View File
@@ -22,7 +22,6 @@ import codechicken.nei.ItemList;
import codechicken.nei.ItemSorter;
import codechicken.nei.ItemStackSet;
import codechicken.nei.KeyManager;
import codechicken.nei.KeyManager.KeyState;
import codechicken.nei.LayoutManager;
import codechicken.nei.NEIClientConfig;
import codechicken.nei.OffsetPositioner;
@@ -34,7 +33,6 @@ import codechicken.nei.SubsetWidget.SubsetTag;
import codechicken.nei.api.IRecipeFilter.IRecipeFilterProvider;
import codechicken.nei.api.ItemFilter.ItemFilterProvider;
import codechicken.nei.config.Option;
import codechicken.nei.config.OptionKeyBind;
import codechicken.nei.recipe.CatalystInfo;
import codechicken.nei.recipe.GuiCraftingRecipe;
import codechicken.nei.recipe.GuiRecipe;
@@ -223,20 +221,11 @@ public class API {
* @param defaultKey The default value, commonly obtained from {@link Keyboard}
*/
public static void addKeyBind(String ident, int defaultKey) {
NEIClientConfig.setDefaultKeyBinding(ident, defaultKey);
KeyManager.keyStates.put(ident, new KeyState());
addOption(new OptionKeyBind(ident));
KeyManager.registerKeyBinding(ident, defaultKey);
}
/**
* Add a custom KeyBinding to be configured in the Controls menu.
*
* @param ident An identifier for your key, eg "shoot"
* @param defaultKey The default value, commonly obtained from {@link Keyboard}
*/
public static void addHashBind(String ident, int defaultKey) {
NEIClientConfig.setDefaultKeyBinding(ident, defaultKey);
addOption(new OptionKeyBind(ident, true));
KeyManager.registerKeyBinding(ident, defaultKey);
}
public static void addOption(Option option) {
@@ -20,6 +20,7 @@ import codechicken.nei.FavoriteRecipes;
import codechicken.nei.ItemPanels;
import codechicken.nei.ItemQuantityField;
import codechicken.nei.ItemsGrid.ItemsGridSlot;
import codechicken.nei.KeyManager;
import codechicken.nei.LayoutManager;
import codechicken.nei.NEIClientConfig;
import codechicken.nei.NEIClientUtils;
@@ -75,8 +76,7 @@ public abstract class ShortcutInputHandler {
return false;
}
if (NEIClientConfig.isKeyHashDown("gui.overlay") && stackover == null
&& LayoutManager.overlayRenderer != null) {
if (KeyManager.isKeyDown("gui.overlay") && stackover == null && LayoutManager.overlayRenderer != null) {
LayoutManager.overlayRenderer = null;
return true;
}
@@ -86,16 +86,16 @@ public abstract class ShortcutInputHandler {
if (groupId != -1) {
if (NEIClientConfig.isKeyHashDown("gui.remove_recipe")) {
if (KeyManager.isHashDown("bookmark.remove_recipe", NEIClientUtils.SHIFT_HASH)) {
ItemPanels.bookmarkPanel.removeGroup(groupId);
return true;
}
if (NEIClientConfig.isKeyHashDown("gui.bookmark_pull_items")) {
if (KeyManager.isKeyDown("bookmark.pull_items")) {
return ItemPanels.bookmarkPanel.pullBookmarkItems(groupId, NEIClientUtils.shiftKey());
}
if (NEIClientConfig.autocraftingEnabled() && NEIClientConfig.isKeyHashDown("gui.craft_items")
if (NEIClientConfig.autocraftingEnabled() && KeyManager.isKeyDown("gui.craft_items")
&& NEIClientUtils.shiftKey()
&& ItemPanels.bookmarkPanel.getGrid().isCraftingMode(groupId)) {
final RecipeChainMath math = ItemPanels.bookmarkPanel.getGrid().createRecipeChainMath(groupId);
@@ -118,46 +118,47 @@ public abstract class ShortcutInputHandler {
stackover = stackover.copy();
if (NEIClientConfig.isKeyHashDown("gui.overlay")) {
if (KeyManager.isKeyDown("gui.overlay")) {
return openOverlayRecipe(stackover);
}
if (NEIClientConfig.isKeyHashDown("gui.copy_name")) {
if (KeyManager.isHashDown("copy.name", NEIClientUtils.CTRL_HASH)) {
return copyItemStackName(stackover);
}
if (NEIClientConfig.isKeyHashDown("gui.copy_id")) {
if (KeyManager.isHashDown("copy.identifier", NEIClientUtils.CTRL_HASH)) {
return copyItemStackID(stackover);
}
if (NEIClientConfig.isKeyHashDown("gui.copy_oredict")) {
if (KeyManager.isHashDown("copy.oredict", NEIClientUtils.CTRL_HASH)) {
return copyItemStackOreDictionary(stackover);
}
if (NEIClientConfig.isKeyHashDown("gui.chat_link_item")) {
if (KeyManager.isHashDown("copy.chat_link_item", NEIClientUtils.CTRL_HASH)) {
return sendItemStackChatLink(stackover);
}
if (NEIClientConfig.isKeyHashDown("gui.recipe")) {
if (KeyManager.isHashDown("recipe.recipe")) {
return GuiCraftingRecipe.openRecipeGui("item", stackover);
}
if (NEIClientConfig.isKeyHashDown("gui.usage")) {
if (KeyManager.isHashDown("recipe.usage")) {
return GuiUsageRecipe.openRecipeGui("item", stackover);
}
if (NEIClientConfig.isKeyHashDown("gui.favorite")) {
if (KeyManager.isHashDown("bookmark.favorite", NEIClientUtils.SHIFT_HASH)) {
return saveFavoriteTree(stackover);
}
if (NEIClientConfig.isKeyHashDown("gui.bookmark")) {
if (KeyManager.isKeyDown("bookmark.add")) {
return saveRecipeInBookmark(stackover, NEIClientUtils.shiftKey(), NEIClientUtils.controlKey());
}
if (NEIClientConfig.isKeyHashDown("gui.bookmark_pull_items")) {
if (KeyManager.isKeyDown("bookmark.pull_items")) {
return pullRecipeItems(stackover, NEIClientUtils.shiftKey());
}
if (NEIClientConfig.autocraftingEnabled() && NEIClientConfig.isKeyHashDown("gui.craft_items")
if (NEIClientConfig.autocraftingEnabled() && KeyManager.isKeyDown("gui.craft_items")
&& NEIClientUtils.shiftKey()) {
return runAutoCrafting(stackover, !NEIClientUtils.controlKey());
}
@@ -445,15 +446,15 @@ public abstract class ShortcutInputHandler {
if (groupId != -1) {
hotkeys.put(
NEIClientConfig.getKeyName("gui.remove_recipe"),
KeyManager.getKeyName("bookmark.remove_recipe", NEIClientUtils.SHIFT_HASH),
NEIClientUtils.translate("bookmark.group.remove_recipe"));
if (BookmarkContainerInfo.getBookmarkContainerHandler(gui) != null) {
hotkeys.put(
NEIClientConfig.getKeyName("gui.bookmark_pull_items"),
KeyManager.getKeyName("bookmark.pull_items"),
NEIClientUtils.translate("bookmark.group.pull_items"));
hotkeys.put(
NEIClientConfig.getKeyName("gui.bookmark_pull_items", NEIClientUtils.SHIFT_HASH),
KeyManager.getKeyName("bookmark.pull_items", NEIClientUtils.SHIFT_HASH),
NEIClientUtils.translate("bookmark.group.pull_items_shift"));
}
@@ -463,7 +464,7 @@ public abstract class ShortcutInputHandler {
.getKeyName("gui.craft_items", NEIClientUtils.SHIFT_HASH + NEIClientUtils.CTRL_HASH),
NEIClientUtils.translate("bookmark.group.craft_missing"));
hotkeys.put(
NEIClientConfig.getKeyName("gui.craft_items", NEIClientUtils.SHIFT_HASH),
KeyManager.getKeyName("gui.craft_items", NEIClientUtils.SHIFT_HASH),
NEIClientUtils.translate("bookmark.group.craft_all"));
}
@@ -484,30 +485,28 @@ public abstract class ShortcutInputHandler {
if (group.crafting != null && group.collapsed) {
hotkeys.put(
NEIClientConfig.getKeyName("gui.bookmark", NEIClientUtils.SHIFT_HASH),
KeyManager.getKeyName("bookmark.add", NEIClientUtils.SHIFT_HASH),
NEIClientUtils.translate("bookmark.group.remove_recipe"));
} else if (slot.getRecipeId() == null || slot.getType() == BookmarkItemType.ITEM) {
hotkeys.put(
NEIClientConfig.getKeyName("gui.bookmark"),
NEIClientUtils.translate("bookmark.remove_item"));
hotkeys.put(KeyManager.getKeyName("bookmark.add"), NEIClientUtils.translate("bookmark.remove_item"));
} else if (group.crafting != null && group.crafting.recipeRelations.entrySet().stream().anyMatch(
entry -> entry.getKey().equals(slot.getRecipeId())
|| entry.getValue().contains(slot.getRecipeId()))) {
hotkeys.put(
NEIClientConfig.getKeyName("gui.bookmark", NEIClientUtils.SHIFT_HASH),
KeyManager.getKeyName("bookmark.add", NEIClientUtils.SHIFT_HASH),
NEIClientUtils.translate("bookmark.remove_recipe"));
} else {
hotkeys.put(
NEIClientConfig.getKeyName("gui.bookmark", NEIClientUtils.SHIFT_HASH),
KeyManager.getKeyName("bookmark.add", NEIClientUtils.SHIFT_HASH),
NEIClientUtils.translate("bookmark.remove_recipe"));
if (slot.getType() == BookmarkItemType.INGREDIENT) {
hotkeys.put(
NEIClientConfig.getKeyName("gui.bookmark"),
KeyManager.getKeyName("bookmark.add"),
NEIClientUtils.translate("bookmark.remove_item"));
hotkeys.put(
NEIClientConfig.getKeyName("gui.bookmark", NEIClientUtils.SHIFT_HASH),
KeyManager.getKeyName("bookmark.add", NEIClientUtils.SHIFT_HASH),
NEIClientUtils.translate("bookmark.remove_recipe"));
} else {
final BookmarkItem item = slot.getBookmarkItem();
@@ -517,14 +516,14 @@ public abstract class ShortcutInputHandler {
m -> m.type == BookmarkItemType.RESULT && !m.equals(item)
&& item.equalsRecipe(m))) {
hotkeys.put(
NEIClientConfig.getKeyName("gui.bookmark"),
KeyManager.getKeyName("bookmark.add"),
NEIClientUtils.translate("bookmark.remove_recipe"));
} else {
hotkeys.put(
NEIClientConfig.getKeyName("gui.bookmark"),
KeyManager.getKeyName("bookmark.add"),
NEIClientUtils.translate("bookmark.remove_item"));
hotkeys.put(
NEIClientConfig.getKeyName("gui.bookmark", NEIClientUtils.SHIFT_HASH),
KeyManager.getKeyName("bookmark.add", NEIClientUtils.SHIFT_HASH),
NEIClientUtils.translate("bookmark.remove_recipe"));
}
@@ -534,60 +533,65 @@ public abstract class ShortcutInputHandler {
if (BookmarkContainerInfo.getBookmarkContainerHandler(gui) != null) {
hotkeys.put(
NEIClientConfig.getKeyName("gui.bookmark_pull_items"),
KeyManager.getKeyName("bookmark.pull_items"),
NEIClientUtils.translate("bookmark.group.pull_items"));
hotkeys.put(
NEIClientConfig.getKeyName("gui.bookmark_pull_items", NEIClientUtils.SHIFT_HASH),
KeyManager.getKeyName("bookmark.pull_items", NEIClientUtils.SHIFT_HASH),
NEIClientUtils.translate("bookmark.group.pull_items_shift"));
}
} else {
hotkeys.put(NEIClientConfig.getKeyName("gui.bookmark"), NEIClientUtils.translate("bookmark.add_item"));
hotkeys.put(KeyManager.getKeyName("bookmark.add"), NEIClientUtils.translate("bookmark.add_item"));
if (StackInfo.getAmount(stack) > 0) {
hotkeys.put(
NEIClientConfig.getKeyName("gui.bookmark", NEIClientUtils.CTRL_HASH),
KeyManager.getKeyName("bookmark.add", NEIClientUtils.CTRL_HASH),
NEIClientUtils.translate("bookmark.add_item_with_count"));
}
if (recipeId != null) {
hotkeys.put(
NEIClientConfig
.getKeyName("gui.bookmark", NEIClientUtils.SHIFT_HASH + NEIClientUtils.CTRL_HASH),
KeyManager.getKeyName("bookmark.add", NEIClientUtils.SHIFT_HASH + NEIClientUtils.CTRL_HASH),
NEIClientUtils.translate("bookmark.add_item_with_recipe_and_count"));
hotkeys.put(
NEIClientConfig.getKeyName("gui.bookmark", NEIClientUtils.SHIFT_HASH),
KeyManager.getKeyName("bookmark.add", NEIClientUtils.SHIFT_HASH),
NEIClientUtils.translate("bookmark.add_item_with_recipe"));
}
if ((ItemPanels.itemPanel.contains(mousex, mousey)
|| ItemPanels.itemPanel.historyPanel.contains(mousex, mousey)) && FavoriteRecipes.contains(stack)) {
hotkeys.put(
NEIClientConfig.getKeyName("gui.favorite"),
KeyManager.getKeyName("bookmark.favorite", NEIClientUtils.SHIFT_HASH),
NEIClientUtils.translate("recipe.favorite.bookmark_recipe"));
}
}
hotkeys.put(NEIClientConfig.getKeyName("gui.recipe"), NEIClientUtils.translate("itempanel.open_crafting"));
hotkeys.put(NEIClientConfig.getKeyName("gui.usage"), NEIClientUtils.translate("itempanel.open_usage"));
hotkeys.put(KeyManager.getKeyName("recipe.recipe"), NEIClientUtils.translate("itempanel.open_crafting"));
hotkeys.put(KeyManager.getKeyName("recipe.usage"), NEIClientUtils.translate("itempanel.open_usage"));
hotkeys.put(NEIClientConfig.getKeyName("gui.copy_name"), NEIClientUtils.translate("itempanel.copy_name"));
hotkeys.put(NEIClientConfig.getKeyName("gui.copy_oredict"), NEIClientUtils.translate("itempanel.copy_oredict"));
hotkeys.put(NEIClientConfig.getKeyName("gui.copy_id"), NEIClientUtils.translate("itempanel.copy_id"));
hotkeys.put(
NEIClientConfig.getKeyName("gui.chat_link_item"),
KeyManager.getKeyName("copy.name", NEIClientUtils.CTRL_HASH),
NEIClientUtils.translate("itempanel.copy_name"));
hotkeys.put(
KeyManager.getKeyName("copy.oredict", NEIClientUtils.CTRL_HASH),
NEIClientUtils.translate("itempanel.copy_oredict"));
hotkeys.put(
KeyManager.getKeyName("copy.identifier", NEIClientUtils.CTRL_HASH),
NEIClientUtils.translate("itempanel.copy_id"));
hotkeys.put(
KeyManager.getKeyName("copy.chat_link_item", NEIClientUtils.CTRL_HASH),
NEIClientUtils.translate("itempanel.chat_link_item"));
if (!(gui instanceof GuiRecipe) && NEIClientConfig.canCheatItem(stack)) {
hotkeys.put(
NEIClientUtils.getKeyName(NEIClientUtils.SHIFT_HASH, NEIMouseUtils.MOUSE_BTN_LMB),
KeyManager.getKeyName(NEIClientUtils.SHIFT_HASH, NEIMouseUtils.MOUSE_BTN_LMB),
NEIClientUtils.translate("itempanel.open_crafting"));
hotkeys.put(
NEIClientUtils.getKeyName(NEIClientUtils.SHIFT_HASH, NEIMouseUtils.MOUSE_BTN_RMB),
KeyManager.getKeyName(NEIClientUtils.SHIFT_HASH, NEIMouseUtils.MOUSE_BTN_RMB),
NEIClientUtils.translate("itempanel.open_usage"));
hotkeys.put(
NEIClientUtils.getKeyName(NEIClientUtils.CTRL_HASH, NEIMouseUtils.MOUSE_BTN_LMB),
KeyManager.getKeyName(NEIClientUtils.CTRL_HASH, NEIMouseUtils.MOUSE_BTN_LMB),
NEIClientUtils.translate("itempanel.infinite_item"));
} else {
hotkeys.put(
@@ -605,18 +609,18 @@ public abstract class ShortcutInputHandler {
if (handlerRef.canUseOverlayRenderer(gui)) {
hotkeys.put(
NEIClientConfig.getKeyName("gui.overlay"),
KeyManager.getKeyName("gui.overlay"),
NEIClientUtils.translate("itempanel.overlay_recipe"));
}
if (handlerRef.canFillCraftingGrid(gui)) {
hotkeys.put(
NEIClientConfig.getKeyName("gui.overlay", NEIClientUtils.SHIFT_HASH),
KeyManager.getKeyName("gui.overlay", NEIClientUtils.SHIFT_HASH),
NEIClientUtils.translate("itempanel.fill_crafting_grid"));
if (handlerRef.allowedTransferAlghoritm(gui)) {
hotkeys.put(
NEIClientConfig.getKeyName(
KeyManager.getKeyName(
"gui.overlay",
NEIClientUtils.SHIFT_HASH + NEIClientUtils.CTRL_HASH),
NEIClientUtils.translate("itempanel.fill_crafting_grid_quantity"));
@@ -625,12 +629,12 @@ public abstract class ShortcutInputHandler {
if (NEIClientConfig.autocraftingEnabled()) {
hotkeys.put(
NEIClientConfig.getKeyName(
KeyManager.getKeyName(
"gui.craft_items",
NEIClientUtils.SHIFT_HASH + NEIClientUtils.CTRL_HASH),
NEIClientUtils.translate("itempanel.craft_missing"));
hotkeys.put(
NEIClientConfig.getKeyName("gui.craft_items", NEIClientUtils.SHIFT_HASH),
KeyManager.getKeyName("gui.craft_items", NEIClientUtils.SHIFT_HASH),
NEIClientUtils.translate("itempanel.craft_all"));
}
}
@@ -1,137 +0,0 @@
package codechicken.nei.config;
import static codechicken.lib.gui.GuiDraw.drawRect;
import static codechicken.lib.gui.GuiDraw.drawStringC;
import java.awt.Rectangle;
import org.lwjgl.input.Keyboard;
import codechicken.nei.NEIClientUtils;
import codechicken.nei.util.NEIKeyboardUtils;
public class OptionKeyBind extends OptionButton {
private boolean editing = false;
private boolean useHash = false;
private int keyboard = Keyboard.CHAR_NONE;
public OptionKeyBind(String name) {
this(name, false);
}
public OptionKeyBind(final String name, final boolean useHash) {
super("keys." + name);
this.useHash = useHash;
}
@Override
public void onMouseClicked(int mousex, int mousey, int button) {
if (editing) {
resetChanges();
}
}
@Override
public void keyTyped(char c, int keycode) {
if (!editing) {
return;
}
if (keycode == Keyboard.KEY_RETURN) {
applyChanges();
return;
}
keyboard = useHash ? NEIClientUtils.getKeyHash() : keycode;
if (keyboard != Keyboard.CHAR_NONE) {
applyChanges();
}
}
@Override
public boolean onClick(int btn) {
if (editing) {
return true;
} else if (btn == 0) {
editing = true;
return true;
} else if (btn == 1) {
keyboard = Keyboard.CHAR_NONE;
applyChanges();
return true;
}
return false;
}
protected void applyChanges() {
setValue(keyboard);
resetChanges();
}
protected void resetChanges() {
editing = false;
keyboard = Keyboard.CHAR_NONE;
}
public boolean conflicted() {
final int keyboard = getValue();
if (keyboard <= 0) {
return false;
}
for (Option o : getSlot().options) {
if (o instanceof OptionKeyBind && o != this && ((OptionKeyBind) o).getValue() == keyboard) {
return true;
}
}
return false;
}
public void setValue(int keycode) {
getTag().setIntValue(keycode);
}
public int getValue() {
return renderTag().getIntValue();
}
@Override
public String getPrefix() {
return translateN(name);
}
@Override
public void drawButton(int mx, int my) {
if (editing) {
Rectangle b = buttonSize();
drawRect(b.x, b.y, b.width, b.height, -6250336);
drawRect(b.x + 1, b.y + 1, b.width - 2, b.height - 2, -16777216);
drawStringC(getButtonText(), b.x, b.y, b.width, b.height, getTextColour(mx, my));
} else {
super.drawButton(mx, my);
}
}
@Override
public String getButtonText() {
if (editing) {
return NEIKeyboardUtils.getHashName(NEIClientUtils.getMetaHash());
}
return NEIKeyboardUtils.getKeyName(Math.max(getValue(), 0));
}
@Override
public int getTextColour(int mousex, int mousey) {
return !editing && conflicted() ? 0xFFFF6666 : -1;
}
}
@@ -21,7 +21,7 @@ import codechicken.nei.ItemList.AnyMultiItemFilter;
import codechicken.nei.ItemList.NegatedItemFilter;
import codechicken.nei.ItemsGrid;
import codechicken.nei.ItemsGrid.ItemsGridSlot;
import codechicken.nei.NEIClientConfig;
import codechicken.nei.KeyManager;
import codechicken.nei.NEIClientUtils;
import codechicken.nei.PresetsList;
import codechicken.nei.PresetsList.Preset;
@@ -81,15 +81,15 @@ public class RightPanel extends GuiWidget {
@Override
public void lastKeyTyped(int keyID, char keyChar) {
if (!focused() && NEIClientConfig.isKeyHashDown("gui.search")) {
if (!focused() && KeyManager.isHashDown("gui.search")) {
setFocus(true);
}
if (focused() && NEIClientConfig.isKeyHashDown("gui.getprevioussearch")) {
if (focused() && KeyManager.isHashDown("gui.getprevioussearch")) {
handleNavigateHistory(TextHistory.Direction.PREVIOUS);
}
if (focused() && NEIClientConfig.isKeyHashDown("gui.getnextsearch")) {
if (focused() && KeyManager.isHashDown("gui.getnextsearch")) {
handleNavigateHistory(TextHistory.Direction.NEXT);
}
}
@@ -46,6 +46,7 @@ import org.lwjgl.opengl.GL12;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.ItemList;
import codechicken.nei.ItemStackSet;
import codechicken.nei.KeyManager;
import codechicken.nei.NEIClientConfig;
import codechicken.nei.NEIClientUtils;
import codechicken.nei.NEIModContainer;
@@ -762,7 +763,7 @@ public class GuiContainerManager {
"inventory.tooltip.page",
tooltipPage + 1,
maxTooltipPage,
NEIClientConfig.getKeyName("gui.next_tooltip"));
KeyManager.getKeyName("gui.next_tooltip"));
if (lastLine.startsWith(GuiDraw.TOOLTIP_HANDLER)) {
currentTooltip.add(lastLine);
@@ -19,6 +19,7 @@ import codechicken.nei.FavoriteRecipes;
import codechicken.nei.Image;
import codechicken.nei.ItemPanels;
import codechicken.nei.ItemStackSet;
import codechicken.nei.KeyManager;
import codechicken.nei.LayoutManager;
import codechicken.nei.NEIClientConfig;
import codechicken.nei.NEIClientUtils;
@@ -122,7 +123,7 @@ public class GuiFavoriteButton extends GuiRecipeButton {
public void lastKeyTyped(char keyChar, int keyID) {
if (NEIClientConfig.isKeyHashDown("gui.bookmark") && NEIClientUtils.shiftKey()) {
if (KeyManager.isKeyDown("bookmark.add") && NEIClientUtils.shiftKey()) {
saveRecipeInBookmark();
}
@@ -131,7 +132,7 @@ public class GuiFavoriteButton extends GuiRecipeButton {
@Override
public Map<String, String> handleHotkeys(int mousex, int mousey, Map<String, String> hotkeys) {
hotkeys.put(
NEIClientConfig.getKeyName("gui.bookmark", NEIClientUtils.SHIFT_HASH),
KeyManager.getKeyName("bookmark.add", NEIClientUtils.SHIFT_HASH),
translate("recipe.favorite.bookmark_recipe"));
if (this.recipe.getResults().size() > 1) {
@@ -15,6 +15,7 @@ import org.lwjgl.opengl.GL11;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.ItemPanels;
import codechicken.nei.ItemsTooltipLineHandler;
import codechicken.nei.KeyManager;
import codechicken.nei.LayoutManager;
import codechicken.nei.NEIClientConfig;
import codechicken.nei.NEIClientUtils;
@@ -163,11 +164,11 @@ public class GuiOverlayButton extends GuiRecipeButton {
}
hotkeys.put(
NEIClientConfig.getKeyName("gui.bookmark", NEIClientUtils.SHIFT_HASH),
KeyManager.getKeyName("bookmark.add", NEIClientUtils.SHIFT_HASH),
NEIClientUtils.translate("recipe.overlay.bookmarkRecipe"));
hotkeys.put(
NEIClientConfig.getKeyName("gui.bookmark", NEIClientUtils.SHIFT_HASH + NEIClientUtils.CTRL_HASH),
KeyManager.getKeyName("bookmark.add", NEIClientUtils.SHIFT_HASH + NEIClientUtils.CTRL_HASH),
NEIClientUtils.translate("recipe.overlay.bookmarkRecipeAndCount"));
return hotkeys;
@@ -325,7 +326,7 @@ public class GuiOverlayButton extends GuiRecipeButton {
@Override
public void lastKeyTyped(char keyChar, int keyID) {
if (NEIClientConfig.isKeyHashDown("gui.bookmark") && NEIClientUtils.shiftKey()) {
if (KeyManager.isKeyDown("bookmark.add") && NEIClientUtils.shiftKey()) {
saveRecipeInBookmark();
}
}
@@ -26,6 +26,7 @@ import codechicken.lib.vec.Rectangle4i;
import codechicken.nei.Button;
import codechicken.nei.ColorUtils;
import codechicken.nei.GuiNEIButton;
import codechicken.nei.KeyManager;
import codechicken.nei.NEICPH;
import codechicken.nei.NEIClientConfig;
import codechicken.nei.NEIClientUtils;
@@ -599,15 +600,15 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
if (i == mc.gameSettings.keyBindInventory.getKeyCode()) {
this.mc.displayGuiScreen(getFirstScreenGeneral());
NEICPH.sendRequestContainer();
} else if (NEIClientConfig.isKeyHashDown("gui.back")) {
} else if (KeyManager.isKeyDown("recipe.back")) {
this.mc.displayGuiScreen(this.prevGui);
} else if (NEIClientConfig.isKeyHashDown("gui.prev_machine")) {
} else if (KeyManager.isKeyDown("recipe.prev_machine")) {
prevType();
} else if (NEIClientConfig.isKeyHashDown("gui.next_machine")) {
} else if (KeyManager.isKeyDown("recipe.next_machine")) {
nextType();
} else if (NEIClientConfig.isKeyHashDown("gui.prev_recipe")) {
} else if (KeyManager.isKeyDown("recipe.prev_recipe")) {
prevPage();
} else if (NEIClientConfig.isKeyHashDown("gui.next_recipe")) {
} else if (KeyManager.isKeyDown("recipe.next_recipe")) {
nextPage();
}
}
@@ -23,6 +23,7 @@ import org.lwjgl.opengl.GL12;
import codechicken.lib.gui.GuiDraw;
import codechicken.lib.vec.Rectangle4i;
import codechicken.nei.FavoriteRecipes;
import codechicken.nei.KeyManager;
import codechicken.nei.NEIClientConfig;
import codechicken.nei.NEIClientUtils;
import codechicken.nei.NEIServerUtils;
@@ -297,8 +298,8 @@ public class NEIRecipeWidget extends Widget {
@Override
public boolean handleKeyPress(int keyID, char keyChar) {
if (NEIClientConfig.favoritesEnabled() && NEIClientUtils.shiftKey()
&& NEIClientConfig.isKeyHashDown("gui.favorite_item")) {
if (NEIClientConfig.favoritesEnabled()
&& KeyManager.isHashDown("bookmark.favorite_item", NEIClientUtils.SHIFT_HASH)) {
final Point mouse = GuiDraw.getMousePosition();
final int yShift = this.handlerInfo.getYShift();
PositionedStack pStackOver = null;
@@ -457,7 +458,7 @@ public class NEIRecipeWidget extends Widget {
pStack -> this.permutations.getOrDefault(pStack, Collections.emptyList()).size() > 1
&& pStack.contains(mouseX - this.x, mouseY - this.y - yShift))) {
hotkeys.put(
NEIClientConfig.getKeyName("gui.favorite_item", NEIClientUtils.SHIFT_HASH),
KeyManager.getKeyName("bookmark.favorite_item", NEIClientUtils.SHIFT_HASH),
NEIClientUtils.translate("recipe.favorite.toggle"));
}
@@ -30,6 +30,7 @@ import com.google.common.base.Stopwatch;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.ItemList;
import codechicken.nei.KeyManager;
import codechicken.nei.NEIClientConfig;
import codechicken.nei.NEIClientUtils;
import codechicken.nei.NEIServerUtils;
@@ -288,9 +289,9 @@ public abstract class TemplateRecipeHandler implements ICraftingHandler, IUsageH
public boolean lastKeyTyped(GuiContainer gui, char keyChar, int keyCode) {
if (!canHandle(gui)) return false;
if (NEIClientConfig.isKeyHashDown("gui.recipe")) {
if (KeyManager.isHashDown("recipe.recipe")) {
return transferRect(gui, false);
} else if (NEIClientConfig.isKeyHashDown("gui.usage")) {
} else if (KeyManager.isHashDown("recipe.usage")) {
return transferRect(gui, true);
}
@@ -672,9 +673,9 @@ public abstract class TemplateRecipeHandler implements ICraftingHandler, IUsageH
@Override
public boolean keyTyped(GuiRecipe<?> gui, char keyChar, int keyCode, int recipe) {
if (NEIClientConfig.isKeyHashDown("gui.recipe")) {
if (KeyManager.isHashDown("recipe.recipe")) {
return transferRect(gui, recipe, false);
} else if (NEIClientConfig.isKeyHashDown("gui.usage")) {
} else if (KeyManager.isHashDown("recipe.usage")) {
return transferRect(gui, recipe, true);
}
@@ -60,11 +60,11 @@ nei.options.wbutton.tip.1=Přepisuji globální nastavení
nei.options.keys=Nastavení kláves
nei.options.keys.gui=Inventář
nei.options.keys.gui.recipe=Recept
nei.options.keys.gui.usage=Použití
nei.options.keys.recipe.recipe=Recept
nei.options.keys.recipe.usage=Použití
nei.options.keys.gui.enchant=Očarování
nei.options.keys.gui.potion=Lektvary
nei.options.keys.gui.back=Předchozí recept
nei.options.keys.recipe.back=Předchozí recept
nei.options.keys.gui.prev=Předchozí stránka
nei.options.keys.gui.next=Další stránka
nei.options.keys.gui.hide=Přepnout viditelnost NEI
@@ -64,11 +64,11 @@ nei.options.wbutton.tip.1=Übergeht globale Einstellungen
nei.options.keys=Tastenbelegung
nei.options.keys.gui=Inventar
nei.options.keys.gui.recipe=Rezept
nei.options.keys.gui.usage=Nutzung
nei.options.keys.recipe.recipe=Rezept
nei.options.keys.recipe.usage=Nutzung
nei.options.keys.gui.enchant=Verzauberungen
nei.options.keys.gui.potion=Tränke
nei.options.keys.gui.back=Vorheriges Rezept
nei.options.keys.recipe.back=Vorheriges Rezept
nei.options.keys.gui.prev=Vorherige Seite
nei.options.keys.gui.next=Nächste Seite
nei.options.keys.gui.hide=Verstelle NEI-Sichtbarkeit
+30 -25
View File
@@ -169,41 +169,46 @@ nei.options.wbutton.tip.0=Using global settings
nei.options.wbutton.tip.1=Overriding global setting
nei.options.keys=KeyBindings
nei.options.keys.tip=Configure NEI key bindings in the Minecraft controls screen
nei.options.keys.gui=NEI Inventory
nei.options.keys.world=NEI World
nei.options.keys.recipe=NEI Recipe
nei.options.keys.bookmark=NEI Bookmarks
nei.options.keys.copy=NEI Copy
nei.options.keys.itemzoom=NEI Item Zoom
nei.options.keys.showenchant=Show Enchant
nei.options.keys.gui=Inventory
nei.options.keys.gui.recipe=Recipe
nei.options.keys.gui.usage=Usage
nei.options.keys.recipe.recipe=Recipe
nei.options.keys.recipe.usage=Usage
nei.options.keys.gui.enchant=Enchantments
nei.options.keys.gui.potion=Potions
nei.options.keys.gui.back=Back to last Recipe
nei.options.keys.recipe.back=Back to last Recipe
nei.options.keys.gui.prev=Prev Item Panel Page
nei.options.keys.gui.next=Next Item Panel Page
nei.options.keys.gui.hide=Toggle NEI Visibility
nei.options.keys.gui.next_recipe=Next Recipe
nei.options.keys.gui.prev_recipe=Prev Recipe
nei.options.keys.gui.next_machine=Next Machine
nei.options.keys.gui.prev_machine=Prev Machine
nei.options.keys.gui.hide=Toggle Visibility
nei.options.keys.recipe.next_recipe=Next Recipe
nei.options.keys.recipe.prev_recipe=Prev Recipe
nei.options.keys.recipe.next_machine=Next Machine
nei.options.keys.recipe.prev_machine=Prev Machine
nei.options.keys.gui.search=Focus Search Bar
nei.options.keys.gui.bookmark=Add Bookmark
nei.options.keys.gui.remove_recipe=Remove Group from Bookmarks
nei.options.keys.gui.bookmark_pull_items=Pull all Bookmarked Items
nei.options.keys.gui.hide_bookmarks=Toggle Bookmark Panel Visibility
nei.options.keys.bookmark.add=Add Bookmark
nei.options.keys.bookmark.remove_recipe=Remove Group from Bookmarks (Shift +)
nei.options.keys.bookmark.pull_items=Pull all Bookmarked Items
nei.options.keys.bookmark.hide=Toggle Bookmark Panel Visibility
nei.options.keys.gui.overlay=Fill/Overlay Crafting Grid
nei.options.keys.gui.getprevioussearch=Previous Search
nei.options.keys.gui.getnextsearch=Next Search
nei.options.keys.gui.next_tooltip=Next Tooltip
nei.options.keys.gui.copy_name=Copy Item Name
nei.options.keys.gui.craft_items=Craft Items
nei.options.keys.gui.copy_oredict=Copy Item OreDictionary
nei.options.keys.gui.copy_id=Copy Item ID
nei.options.keys.gui.chat_link_item=Send item link to chat
nei.options.keys.gui.itemzoom_toggle=Toggle Item Zoom
nei.options.keys.gui.itemzoom_hold=Hold to Display Item Zoom
nei.options.keys.gui.itemzoom_zoom_in=Item Zoom In
nei.options.keys.gui.itemzoom_zoom_out=Item Zoom Out
nei.options.keys.gui.favorite=Add Favorite
nei.options.keys.gui.favorite_item=Toggle Favorite
nei.options.keys.world=World
nei.options.keys.copy.name=Copy Item Name (Ctrl +)
nei.options.keys.gui.craft_items=Craft Items (Shift +)
nei.options.keys.copy.oredict=Copy Item OreDictionary (Ctrl +)
nei.options.keys.copy.identifier=Copy Item ID (Ctrl +)
nei.options.keys.copy.chat_link_item=Send item link to chat (Ctrl +)
nei.options.keys.itemzoom.toggle=Toggle Item Zoom (Shift +)
nei.options.keys.itemzoom.hold=Hold to Display Item Zoom
nei.options.keys.itemzoom.zoom_in=Item Zoom In
nei.options.keys.itemzoom.zoom_out=Item Zoom Out
nei.options.keys.bookmark.favorite=Add Favorite (Shift +)
nei.options.keys.bookmark.favorite_item=Toggle Favorite (Shift +)
nei.options.keys.world.chunkoverlay=Chunk Boundary Overlay
nei.options.keys.world.moboverlay=Mob Spawn Overlay
nei.options.keys.world.highlight_tips=Highlight Tooltips
@@ -63,11 +63,11 @@ nei.options.wbutton.tip.1=Globaalsete seadmete ületegemine
nei.options.keys=Klahviseosed
nei.options.keys.gui=Seljakott
nei.options.keys.gui.recipe=Retsept
nei.options.keys.gui.usage=Kasutus
nei.options.keys.recipe.recipe=Retsept
nei.options.keys.recipe.usage=Kasutus
nei.options.keys.gui.enchant=Loitsud
nei.options.keys.gui.potion=Joogid
nei.options.keys.gui.back=Eel. Retsept
nei.options.keys.recipe.back=Eel. Retsept
nei.options.keys.gui.prev=Eel. Leht
nei.options.keys.gui.next=Järg. Leht
nei.options.keys.gui.hide=Lülita NEI nähtavust
@@ -61,11 +61,11 @@ nei.options.wbutton.tip.1=Annuler l'utilisation des paramètres globaux
nei.options.keys=Raccourcis clavier
nei.options.keys.gui=Inventaire
nei.options.keys.gui.recipe=Recette
nei.options.keys.gui.usage=Usage
nei.options.keys.recipe.recipe=Recette
nei.options.keys.recipe.usage=Usage
nei.options.keys.gui.enchant=Enchantements
nei.options.keys.gui.potion=Potions
nei.options.keys.gui.back=Recette précédente
nei.options.keys.recipe.back=Recette précédente
nei.options.keys.gui.prev=Recette suivante
nei.options.keys.gui.next=Page suivante
nei.options.keys.gui.hide=Afficher ou cacher NEI
@@ -64,11 +64,11 @@ nei.options.wbutton.tip.1=Sovrascrivendo le opzioni globali
nei.options.keys=Controlli
nei.options.keys.gui=Inventario
nei.options.keys.gui.recipe=Ricetta
nei.options.keys.gui.usage=Usi
nei.options.keys.recipe.recipe=Ricetta
nei.options.keys.recipe.usage=Usi
nei.options.keys.gui.enchant=Incantare
nei.options.keys.gui.potion=Pozioni
nei.options.keys.gui.back=Ricetta precedente
nei.options.keys.recipe.back=Ricetta precedente
nei.options.keys.gui.prev=Pagina precedente
nei.options.keys.gui.next=Pagina successiva
nei.options.keys.gui.hide=Modifica visibilità NEI
@@ -59,11 +59,11 @@ nei.options.wbutton.tip.1=전역 설정
nei.options.keys=키 바인딩
nei.options.keys.gui=인벤토리
nei.options.keys.gui.recipe=레시피
nei.options.keys.gui.usage=사용법
nei.options.keys.gui.nei.enchant=인첸트
nei.options.keys.recipe.recipe=레시피
nei.options.keys.recipe.usage=사용법
nei.options.keys.gui.enchant=인첸트
nei.options.keys.gui.potion=포션
nei.options.keys.gui.back=이전 레시피
nei.options.keys.recipe.back=이전 레시피
nei.options.keys.gui.prev=이전 페이지
nei.options.keys.gui.next=다음 페이지
nei.options.keys.gui.hide=NEI 활성/비활성화
@@ -60,11 +60,11 @@ nei.options.wbutton.tip.1=Nadpisywanie ustawienia globalnego
nei.options.keys=Ustawienia klawiszy
nei.options.keys.gui=Ekwipunek
nei.options.keys.gui.recipe=Recepta
nei.options.keys.gui.usage=Użytek
nei.options.keys.recipe.recipe=Recepta
nei.options.keys.recipe.usage=Użytek
nei.options.keys.gui.enchant=Zaklęcia
nei.options.keys.gui.potion=Eleksiry
nei.options.keys.gui.back=Poprzednia recepta
nei.options.keys.recipe.back=Poprzednia recepta
nei.options.keys.gui.prev=Poprzednia strona
nei.options.keys.gui.next=Następna strona
nei.options.keys.gui.hide=Przełącz widzialność NEI
@@ -60,11 +60,11 @@ nei.options.wbutton.tip.1=Substituindo configurações globais
nei.options.keys=Atalhos de Teclado
nei.options.keys.gui=Inventário
nei.options.keys.gui.recipe=Receita
nei.options.keys.gui.usage=Uso
nei.options.keys.recipe.recipe=Receita
nei.options.keys.recipe.usage=Uso
nei.options.keys.gui.enchant=Encantamentos
nei.options.keys.gui.potion=Poções
nei.options.keys.gui.back=Receita Ant.
nei.options.keys.recipe.back=Receita Ant.
nei.options.keys.gui.prev=Pág. Anterior
nei.options.keys.gui.next=Próxima Pág.
nei.options.keys.gui.hide=Trocar Visibilidade do NEI
+29 -22
View File
@@ -116,39 +116,46 @@ nei.options.wbutton.tip.0=Используются глобальные наст
nei.options.wbutton.tip.1=Переопределение глобальной настройки
nei.options.keys=Привязки клавиш
nei.options.keys.tip=Настройте привязки клавиш NEI на экране управления Minecraft
nei.options.keys.gui=NEI Инвентарь
nei.options.keys.world=NEI Мир
nei.options.keys.recipe=NEI Рецепт
nei.options.keys.bookmark=NEI Закладки
nei.options.keys.copy=NEI Копирование
nei.options.keys.itemzoom=NEI Увеличение предмета
nei.options.keys.showenchant=Показать зачарование
nei.options.keys.gui=Инвентарь
nei.options.keys.gui.recipe=Рецепт
nei.options.keys.gui.usage=Использование
nei.options.keys.recipe.recipe=Рецепт
nei.options.keys.recipe.usage=Использование
nei.options.keys.gui.enchant=Зачарования
nei.options.keys.gui.potion=Зелья
nei.options.keys.gui.back=Назад к последнему рецепту
nei.options.keys.recipe.back=Назад к последнему рецепту
nei.options.keys.gui.prev=Предыдущая страница панели предметов
nei.options.keys.gui.next=Следующая страница панели предметов
nei.options.keys.gui.hide=Переключить видимость NEI
nei.options.keys.gui.next_recipe=Следующий рецепт
nei.options.keys.gui.prev_recipe=Предыдущий рецепт
nei.options.keys.gui.next_machine=Следующая машина
nei.options.keys.gui.prev_machine=Предыдущая машина
nei.options.keys.recipe.next_recipe=Следующий рецепт
nei.options.keys.recipe.prev_recipe=Предыдущий рецепт
nei.options.keys.recipe.next_machine=Следующая машина
nei.options.keys.recipe.prev_machine=Предыдущая машина
nei.options.keys.gui.search=Сфокусироваться на строке поиска
nei.options.keys.gui.bookmark=Добавить закладку
nei.options.keys.gui.remove_recipe=Удалить группу из закладок
nei.options.keys.gui.bookmark_recipe=Добавить закладку с рецептом
nei.options.keys.gui.bookmark_count=Добавить закладку с учётом количества
nei.options.keys.gui.bookmark_pull_items=Переместить все отмеченные предметы
nei.options.keys.gui.hide_bookmarks=Переключить видимость панели закладок
nei.options.keys.bookmark.add=Добавить закладку
nei.options.keys.bookmark.remove_recipe=Удалить группу из закладок (Shift +)
nei.options.keys.bookmark.pull_items=Переместить все отмеченные предметы
nei.options.keys.bookmark.hide=Переключить видимость панели закладок
nei.options.keys.gui.overlay=Заполнить сетку крафта
nei.options.keys.gui.getprevioussearch=Предыдущий поиск
nei.options.keys.gui.getnextsearch=Следующий поиск
nei.options.keys.gui.next_tooltip=Следующая подсказка
nei.options.keys.gui.copy_name=Скопировать название предмета
nei.options.keys.gui.copy_oredict=Скопировать OreDictionary предмета
nei.options.keys.gui.chat_link_item=Отправить ссылку на предмет в чат
nei.options.keys.gui.itemzoom_toggle=Переключить увеличение предмета
nei.options.keys.gui.itemzoom_hold=Удерживать для отображения увеличения предмета
nei.options.keys.gui.itemzoom_zoom_in=Увеличить предмет
nei.options.keys.gui.itemzoom_zoom_out=Уменьшить предмет
nei.options.keys.world=Мир
nei.options.keys.copy.name=Скопировать название предмета (Ctrl +)
nei.options.keys.gui.craft_items=Создать предметы (Shift +)
nei.options.keys.copy.oredict=Скопировать OreDictionary предмета (Ctrl +)
nei.options.keys.copy.identifier=Скопировать ID предмета (Ctrl +)
nei.options.keys.copy.chat_link_item=Отправить ссылку на предмет в чат (Ctrl +)
nei.options.keys.itemzoom.toggle=Переключить увеличение предмета (Shift +)
nei.options.keys.itemzoom.hold=Удерживать для отображения увеличения предмета
nei.options.keys.itemzoom.zoom_in=Увеличить предмет
nei.options.keys.itemzoom.zoom_out=Уменьшить предмет
nei.options.keys.bookmark.favorite=Добавить в избранное (Shift +)
nei.options.keys.bookmark.favorite_item=Переключить избранное (Shift +)
nei.options.keys.world.chunkoverlay=Отображение границ чанков
nei.options.keys.world.moboverlay=Отображение спавна мобов
nei.options.keys.world.highlight_tips=Подсветка подсказок
@@ -60,11 +60,11 @@ nei.options.wbutton.tip.1=Globálne nastavenia sú nahradené
nei.options.keys=Klávesové skratky
nei.options.keys.gui=Inventár
nei.options.keys.gui.recipe=Recept
nei.options.keys.gui.usage=Použitie
nei.options.keys.recipe.recipe=Recept
nei.options.keys.recipe.usage=Použitie
nei.options.keys.gui.enchant=Očarovania
nei.options.keys.gui.potion=Elixíry
nei.options.keys.gui.back=Predchádzajúci recept
nei.options.keys.recipe.back=Predchádzajúci recept
nei.options.keys.gui.prev=Predchádzajúca strana
nei.options.keys.gui.next=Nasledujúca strana
nei.options.keys.gui.hide=Prepni viditeľnosť NEI
@@ -60,11 +60,11 @@ nei.options.wbutton.tip.1=Genel ayarların üstüne yazılıyor
nei.options.keys=Tuşlar
nei.options.keys.gui=Envanter
nei.options.keys.gui.recipe=Tarifler
nei.options.keys.gui.usage=Kullanım yeri
nei.options.keys.recipe.recipe=Tarifler
nei.options.keys.recipe.usage=Kullanım yeri
nei.options.keys.gui.enchant=Büylüler
nei.options.keys.gui.potion=İksirler
nei.options.keys.gui.back=Önceki tarif
nei.options.keys.recipe.back=Önceki tarif
nei.options.keys.gui.prev=Önceki sayfa
nei.options.keys.gui.next=Sonraki sayfa
nei.options.keys.gui.hide=Nei görünürlük ayarı
+12 -14
View File
@@ -89,29 +89,27 @@ nei.options.wbutton.tip.1=覆写全局设置
nei.options.keys=按键绑定
nei.options.keys.showenchant=显示附魔值
nei.options.keys.gui=物品栏
nei.options.keys.gui.recipe=查看合成
nei.options.keys.gui.usage=查看用途
nei.options.keys.recipe.recipe=查看合成
nei.options.keys.recipe.usage=查看用途
nei.options.keys.gui.enchant=附魔
nei.options.keys.gui.potion=药水
nei.options.keys.gui.back=返回上一合成表
nei.options.keys.recipe.back=返回上一合成表
nei.options.keys.gui.prev=上一页
nei.options.keys.gui.next=下一页
nei.options.keys.gui.hide=隐藏/显示NEI界面
nei.options.keys.gui.next_recipe=下一合成表
nei.options.keys.gui.prev_recipe=上一合成表
nei.options.keys.gui.next_machine=下一机器
nei.options.keys.gui.prev_machine=上一机器
nei.options.keys.recipe.next_recipe=下一合成表
nei.options.keys.recipe.prev_recipe=上一合成表
nei.options.keys.recipe.next_machine=下一机器
nei.options.keys.recipe.prev_machine=上一机器
nei.options.keys.gui.search=跳转到搜索框
nei.options.keys.gui.bookmark=添加书签
nei.options.keys.gui.bookmark_recipe=添加带有合成表的书签
nei.options.keys.gui.bookmark_count=添加带有数量的书签
nei.options.keys.gui.hide_bookmarks=显示/隐藏书签页
nei.options.keys.bookmark.add=添加书签
nei.options.keys.bookmark.hide=显示/隐藏书签页
nei.options.keys.gui.overlay=使用覆盖合成表
nei.options.keys.gui.getprevioussearch=上一个搜索
nei.options.keys.gui.getnextsearch=下一个搜索
nei.options.keys.gui.copy_name=复制物品名称
nei.options.keys.gui.copy_oredict=复制物品矿词词典
nei.options.keys.gui.copy_id=复制物品ID
nei.options.keys.copy.name=复制物品名称 (Ctrl +)
nei.options.keys.copy.oredict=复制物品矿词词典 (Ctrl +)
nei.options.keys.copy.identifier=复制物品ID (Ctrl +)
nei.options.keys.world=世界
nei.options.keys.world.chunkoverlay=区块(chunks)边界显示
nei.options.keys.world.moboverlay=刷怪区域显示
@@ -59,11 +59,11 @@ nei.options.wbutton.tip.1=覆蓋全局設定
nei.options.keys=按鍵設定
nei.options.keys.gui=物品欄
nei.options.keys.gui.recipe=合成表
nei.options.keys.gui.usage=用途
nei.options.keys.recipe.recipe=合成表
nei.options.keys.recipe.usage=用途
nei.options.keys.gui.enchant=附魔
nei.options.keys.gui.potion=藥水
nei.options.keys.gui.back=上一個合成表
nei.options.keys.recipe.back=上一個合成表
nei.options.keys.gui.prev=上一頁
nei.options.keys.gui.next=下一頁
nei.options.keys.gui.hide=隱藏/顯示NEI界面
@@ -15,6 +15,8 @@ import java.util.stream.Stream;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.Language;
import net.minecraft.client.resources.LanguageManager;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
@@ -160,6 +162,11 @@ public class SearchTokenParserTest {
language = mock(Language.class);
when(languageManager.getCurrentLanguage()).thenReturn(language);
when(language.getLanguageCode()).thenReturn("en");
GameSettings gameSettings = mock(GameSettings.class);
gameSettings.keyBindings = new KeyBinding[0];
minecraft.gameSettings = gameSettings;
config = mockStatic(NEIClientConfig.class);
config.when(() -> NEIClientConfig.getBooleanSetting(eq("inventory.search.logSearchExceptions")))
.thenReturn(false);