diff options
| author | Unknown <shekwancheung0528@gmail.com> | 2019-01-04 20:55:03 +0800 |
|---|---|---|
| committer | Unknown <shekwancheung0528@gmail.com> | 2019-01-04 20:55:03 +0800 |
| commit | de3c58b1e140ba3e3a450c01df226e650ec4a391 (patch) | |
| tree | 795aae95389b5cb909c4d8114a1b5d7f5ed0aa43 /src/main/java | |
| parent | 02f72e3d47b0f5133f4f984a0bd51968e0c9d8fd (diff) | |
| download | RoughlyEnoughItems-de3c58b1e140ba3e3a450c01df226e650ec4a391.tar.gz RoughlyEnoughItems-de3c58b1e140ba3e3a450c01df226e650ec4a391.tar.bz2 RoughlyEnoughItems-de3c58b1e140ba3e3a450c01df226e650ec4a391.zip | |
fixes esc and crashes
Diffstat (limited to 'src/main/java')
| -rwxr-xr-x | src/main/java/me/shedaniel/ClientListener.java | 6 | ||||
| -rwxr-xr-x | src/main/java/me/shedaniel/gui/GuiItemList.java | 10 | ||||
| -rwxr-xr-x | src/main/java/me/shedaniel/gui/REIRenderHelper.java | 22 | ||||
| -rwxr-xr-x | src/main/java/me/shedaniel/gui/RecipeGui.java | 2 | ||||
| -rwxr-xr-x | src/main/java/me/shedaniel/gui/widget/REISlot.java | 6 |
5 files changed, 25 insertions, 21 deletions
diff --git a/src/main/java/me/shedaniel/ClientListener.java b/src/main/java/me/shedaniel/ClientListener.java index 8ec8f27cc..b6b1052bd 100755 --- a/src/main/java/me/shedaniel/ClientListener.java +++ b/src/main/java/me/shedaniel/ClientListener.java @@ -42,7 +42,7 @@ public class ClientListener implements DoneLoading, RecipeLoadListener { @Override public boolean apply(int key) { if (key == this.getKey()) - REIRenderHelper.recipeKeybind(); + REIRenderHelper.recipeKeyBind(); return key == this.getKey(); } }; @@ -50,7 +50,7 @@ public class ClientListener implements DoneLoading, RecipeLoadListener { @Override public boolean apply(int key) { if (key == this.getKey()) - REIRenderHelper.hideKeybind(); + REIRenderHelper.hideKeyBind(); return key == this.getKey(); } }; @@ -58,7 +58,7 @@ public class ClientListener implements DoneLoading, RecipeLoadListener { @Override public boolean apply(int key) { if (key == this.getKey()) - REIRenderHelper.useKeybind(); + REIRenderHelper.useKeyBind(); return key == this.getKey(); } }; diff --git a/src/main/java/me/shedaniel/gui/GuiItemList.java b/src/main/java/me/shedaniel/gui/GuiItemList.java index c3917b175..27da65727 100755 --- a/src/main/java/me/shedaniel/gui/GuiItemList.java +++ b/src/main/java/me/shedaniel/gui/GuiItemList.java @@ -35,16 +35,14 @@ public class GuiItemList extends Drawable { private ArrayList<REISlot> displaySlots; protected ArrayList<Control> controls; private boolean needsResize = false; - Button buttonLeft; - Button buttonRight; - Button buttonCheating; - Button buttonConfig; - TextBox searchBox; + Button buttonLeft, buttonRight, buttonCheating, buttonConfig; + private TextBox searchBox; private ArrayList<ItemStack> view; private Control lastHovered; protected boolean visible = true; private int oldGuiLeft = 0; - private boolean cheatMode = false; private Button btnCategoryPageLeft, btnCategoryPageRight; + private boolean cheatMode = false; + private Button btnCategoryPageLeft, btnCategoryPageRight; public Button btnRecipeLeft, btnRecipeRight; public GuiItemList(GuiContainer overlayedGui) { diff --git a/src/main/java/me/shedaniel/gui/REIRenderHelper.java b/src/main/java/me/shedaniel/gui/REIRenderHelper.java index a6c4cdac3..25193d954 100755 --- a/src/main/java/me/shedaniel/gui/REIRenderHelper.java +++ b/src/main/java/me/shedaniel/gui/REIRenderHelper.java @@ -235,41 +235,45 @@ public class REIRenderHelper { reiGui.tick(); } - public static void recipeKeybind() { + public static boolean recipeKeyBind() { if (!(Minecraft.getInstance().currentScreen instanceof GuiContainer)) - return; + return false; Control control = reiGui.getLastHovered(); if (control != null && control.isHighlighted() && control instanceof REISlot) { REISlot slot = (REISlot) control; REIRecipeManager.instance().displayRecipesFor(slot.getStack()); - return; + return true; } if (((IMixinGuiContainer) overlayedGui).getHoveredSlot() != null) { ItemStack stack = ((IMixinGuiContainer) overlayedGui).getHoveredSlot().getStack(); REIRecipeManager.instance().displayRecipesFor(stack); + return true; } - + return false; } - public static void useKeybind() { + public static boolean useKeyBind() { if (!(Minecraft.getInstance().currentScreen instanceof GuiContainer)) - return; + return false; Control control = reiGui.getLastHovered(); if (control != null && control.isHighlighted() && control instanceof REISlot) { REISlot slot = (REISlot) control; REIRecipeManager.instance().displayUsesFor(slot.getStack()); - return; + return true; } if (((IMixinGuiContainer) overlayedGui).getHoveredSlot() != null) { ItemStack stack = ((IMixinGuiContainer) overlayedGui).getHoveredSlot().getStack(); REIRecipeManager.instance().displayUsesFor(stack); + return true; } - + return false; } - public static void hideKeybind() { + public static boolean hideKeyBind() { if (Minecraft.getInstance().currentScreen == overlayedGui && reiGui != null) { reiGui.visible = !reiGui.visible; + return true; } + return true; } } diff --git a/src/main/java/me/shedaniel/gui/RecipeGui.java b/src/main/java/me/shedaniel/gui/RecipeGui.java index dcd247906..1674bcc6d 100755 --- a/src/main/java/me/shedaniel/gui/RecipeGui.java +++ b/src/main/java/me/shedaniel/gui/RecipeGui.java @@ -222,7 +222,7 @@ public class RecipeGui extends GuiContainer { @Override public boolean keyPressed(int p_keyPressed_1_, int p_keyPressed_2_, int p_keyPressed_3_) { - if (p_keyPressed_1_ == 259 && prevScreen != null && REIRenderHelper.focusedControl == null) { + if (p_keyPressed_1_ == 256 && prevScreen != null) { Minecraft.getInstance().displayGuiScreen(prevScreen); return true; } diff --git a/src/main/java/me/shedaniel/gui/widget/REISlot.java b/src/main/java/me/shedaniel/gui/widget/REISlot.java index d815b1d91..217bc996d 100755 --- a/src/main/java/me/shedaniel/gui/widget/REISlot.java +++ b/src/main/java/me/shedaniel/gui/widget/REISlot.java @@ -4,7 +4,6 @@ import com.google.common.collect.Lists; import me.shedaniel.Core; import me.shedaniel.gui.REIRenderHelper; import me.shedaniel.listenerdefinitions.IMixinGuiContainer; -import me.shedaniel.network.CheatPacket; import me.shedaniel.network.DeletePacket; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiContainer; @@ -126,7 +125,10 @@ public class REISlot extends Control { return true; } } else { - REIRenderHelper.recipeKeybind(); + if (button == 0) + return REIRenderHelper.recipeKeyBind(); + else if (button == 1) + return REIRenderHelper.useKeyBind(); } return false; } |
