Skip to content

Commit

Permalink
Fix the 'O' hotkey to toggle item overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
mezz committed Nov 11, 2015
1 parent b3f2901 commit 5317fe4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/main/java/mezz/jei/gui/ItemListOverlay.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ public class ItemListOverlay implements IShowsItemStacks, IClickable, IKeyable {
private int width;
private int height;

private boolean isOpen = false;
private boolean open = false;
private boolean enabled = true;

public ItemListOverlay(ItemFilter itemFilter) {
this.itemFilter = itemFilter;
Expand Down Expand Up @@ -169,7 +170,7 @@ private void backPage() {
}

public void drawScreen(@Nonnull Minecraft minecraft, int mouseX, int mouseY) {
if (!isOpen) {
if (!isOpen()) {
return;
}

Expand Down Expand Up @@ -202,7 +203,7 @@ public void handleTick() {
@Override
@Nullable
public ItemStack getStackUnderMouse(int mouseX, int mouseY) {
if (!isOpen) {
if (!isOpen()) {
return null;
}
for (GuiItemStack guiItemStack : guiItemStacks) {
Expand Down Expand Up @@ -294,19 +295,22 @@ private void setPageNum(int pageNum) {

@Override
public void open() {
isOpen = true;
open = true;
searchField.setFocused(false);
}

@Override
public void close() {
isOpen = false;
open = false;
searchField.setFocused(false);
}

@Override
public boolean isOpen() {
return isOpen;
return open && enabled;
}

public void toggleEnabled() {
enabled = !enabled;
}
}
3 changes: 3 additions & 0 deletions src/main/java/mezz/jei/input/InputHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ private boolean handleKeyDown(int eventKey) {
recipesGui.showUses(itemStack);
return true;
}
} else if (eventKey == KeyBindings.toggleOverlay.getKeyCode()) {
itemListOverlay.toggleEnabled();
return false;
}

for (IKeyable keyable : keyables) {
Expand Down

0 comments on commit 5317fe4

Please sign in to comment.