mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-10-26 14:24:07 +00:00
Simplify the keybinding (#982)
This commit is contained in:
1 parent
2c204c25aa
commit
2b28068382
6 files changed
+24
-22
No files matched your search
@@ -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")
|
||||
|| KeyManager.isHashDown("itemzoom.hold"))
|
||||
|| KeyManager.isKeyDown("itemzoom.hold"))
|
||||
&& GuiContainerManager.shouldShowTooltip(NEIClientUtils.getGuiContainer())) {
|
||||
final float inverseScaleFactor = 1.0f / this.scale;
|
||||
final float screenScale = getScreenScale();
|
||||
@@ -204,18 +204,18 @@ public class ItemZoom extends Widget implements IContainerInputHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.stack != null && KeyManager.isHashDown("itemzoom.hold")) {
|
||||
if (this.stack != null && KeyManager.isKeyDown("itemzoom.hold")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.stack != null && KeyManager.isHashDown("itemzoom.zoom_in")) {
|
||||
if (this.stack != null && KeyManager.isKeyDown("itemzoom.zoom_in")) {
|
||||
increaseZoom(gui);
|
||||
previousKeyboardRepeatEnabled = Keyboard.areRepeatEventsEnabled();
|
||||
Keyboard.enableRepeatEvents(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.stack != null && KeyManager.isHashDown("itemzoom.zoom_out")) {
|
||||
if (this.stack != null && KeyManager.isKeyDown("itemzoom.zoom_out")) {
|
||||
decreaseZoom(gui);
|
||||
previousKeyboardRepeatEnabled = Keyboard.areRepeatEventsEnabled();
|
||||
Keyboard.enableRepeatEvents(true);
|
||||
|
||||
@@ -67,17 +67,19 @@ public class KeyManager {
|
||||
}
|
||||
|
||||
public static boolean isKeyDown(String ident) {
|
||||
final int keyCode = getKeyCode(ident);
|
||||
final KeyBinding binding = getKeyBinding(ident);
|
||||
|
||||
if (keyCode == Keyboard.KEY_NONE) {
|
||||
return false;
|
||||
if (binding != null) {
|
||||
final int keyCode = binding.getKeyCode();
|
||||
|
||||
if (keyCode < 0) {
|
||||
return Mouse.isButtonDown(keyCode + 100);
|
||||
} else if (keyCode > Keyboard.KEY_NONE && keyCode < Keyboard.KEYBOARD_SIZE) {
|
||||
return Keyboard.isKeyDown(keyCode);
|
||||
}
|
||||
}
|
||||
|
||||
if (keyCode < 0) {
|
||||
return Mouse.isButtonDown(keyCode + 100);
|
||||
}
|
||||
|
||||
return keyCode < Keyboard.KEYBOARD_SIZE && Keyboard.isKeyDown(keyCode);
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isHashDown(String ident) {
|
||||
|
||||
@@ -224,12 +224,12 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
@Override
|
||||
public boolean lastKeyTyped(GuiContainer gui, char keyChar, int keyID) {
|
||||
|
||||
if (KeyManager.isHashDown("gui.hide")) {
|
||||
if (KeyManager.isKeyDown("gui.hide")) {
|
||||
toggleBooleanSetting("inventory.hidden");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (KeyManager.isHashDown("bookmark.hide")) {
|
||||
if (KeyManager.isKeyDown("bookmark.hide")) {
|
||||
toggleBooleanSetting("inventory.bookmarks.enabled");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -144,11 +144,11 @@ public abstract class ShortcutInputHandler {
|
||||
return sendRecipeInChatLink(stackover, NEIClientUtils.shiftKey());
|
||||
}
|
||||
|
||||
if (KeyManager.isHashDown("recipe.recipe")) {
|
||||
if (KeyManager.isKeyDown("recipe.recipe")) {
|
||||
return GuiCraftingRecipe.openRecipeGui("item", stackover);
|
||||
}
|
||||
|
||||
if (KeyManager.isHashDown("recipe.usage")) {
|
||||
if (KeyManager.isKeyDown("recipe.usage")) {
|
||||
return GuiUsageRecipe.openRecipeGui("item", stackover);
|
||||
}
|
||||
|
||||
|
||||
@@ -85,11 +85,11 @@ public class RightPanel extends GuiWidget {
|
||||
setFocus(true);
|
||||
}
|
||||
|
||||
if (focused() && KeyManager.isHashDown("gui.getprevioussearch")) {
|
||||
if (focused() && KeyManager.isKeyDown("gui.getprevioussearch")) {
|
||||
handleNavigateHistory(TextHistory.Direction.PREVIOUS);
|
||||
}
|
||||
|
||||
if (focused() && KeyManager.isHashDown("gui.getnextsearch")) {
|
||||
if (focused() && KeyManager.isKeyDown("gui.getnextsearch")) {
|
||||
handleNavigateHistory(TextHistory.Direction.NEXT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -289,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 (KeyManager.isHashDown("recipe.recipe")) {
|
||||
if (KeyManager.isKeyDown("recipe.recipe")) {
|
||||
return transferRect(gui, false);
|
||||
} else if (KeyManager.isHashDown("recipe.usage")) {
|
||||
} else if (KeyManager.isKeyDown("recipe.usage")) {
|
||||
return transferRect(gui, true);
|
||||
}
|
||||
|
||||
@@ -673,9 +673,9 @@ public abstract class TemplateRecipeHandler implements ICraftingHandler, IUsageH
|
||||
@Override
|
||||
public boolean keyTyped(GuiRecipe<?> gui, char keyChar, int keyCode, int recipe) {
|
||||
|
||||
if (KeyManager.isHashDown("recipe.recipe")) {
|
||||
if (KeyManager.isKeyDown("recipe.recipe")) {
|
||||
return transferRect(gui, recipe, false);
|
||||
} else if (KeyManager.isHashDown("recipe.usage")) {
|
||||
} else if (KeyManager.isKeyDown("recipe.usage")) {
|
||||
return transferRect(gui, recipe, true);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user