Explorar o código

fixes esc and crashes

Unknown %!s(int64=6) %!d(string=hai) anos
pai
achega
be6a22cb24

+ 1 - 1
build.gradle

@@ -6,7 +6,7 @@ sourceCompatibility = 1.8
 targetCompatibility = 1.8
 targetCompatibility = 1.8
 
 
 archivesBaseName = "RoughlyEnoughItems"
 archivesBaseName = "RoughlyEnoughItems"
-version = "1.4-9"
+version = "1.4-10"
 
 
 minecraft {
 minecraft {
 }
 }

+ 3 - 3
src/main/java/me/shedaniel/ClientListener.java

@@ -47,7 +47,7 @@ public class ClientListener implements DoneLoading, RecipeLoadListener {
             @Override
             @Override
             public boolean apply(int key) {
             public boolean apply(int key) {
                 if (key == this.getKey())
                 if (key == this.getKey())
-                    REIRenderHelper.recipeKeybind();
+                    REIRenderHelper.recipeKeyBind();
                 return key == this.getKey();
                 return key == this.getKey();
             }
             }
         };
         };
@@ -55,7 +55,7 @@ public class ClientListener implements DoneLoading, RecipeLoadListener {
             @Override
             @Override
             public boolean apply(int key) {
             public boolean apply(int key) {
                 if (key == this.getKey())
                 if (key == this.getKey())
-                    REIRenderHelper.hideKeybind();
+                    REIRenderHelper.hideKeyBind();
                 return key == this.getKey();
                 return key == this.getKey();
             }
             }
         };
         };
@@ -63,7 +63,7 @@ public class ClientListener implements DoneLoading, RecipeLoadListener {
             @Override
             @Override
             public boolean apply(int key) {
             public boolean apply(int key) {
                 if (key == this.getKey())
                 if (key == this.getKey())
-                    REIRenderHelper.useKeybind();
+                    REIRenderHelper.useKeyBind();
                 return key == this.getKey();
                 return key == this.getKey();
             }
             }
         };
         };

+ 2 - 5
src/main/java/me/shedaniel/gui/GuiItemList.java

@@ -35,11 +35,8 @@ public class GuiItemList extends Drawable {
     private ArrayList<REISlot> displaySlots;
     private ArrayList<REISlot> displaySlots;
     protected ArrayList<Control> controls;
     protected ArrayList<Control> controls;
     private boolean needsResize = false;
     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 ArrayList<ItemStack> view;
     private Control lastHovered;
     private Control lastHovered;
     protected boolean visible = true;
     protected boolean visible = true;

+ 13 - 9
src/main/java/me/shedaniel/gui/REIRenderHelper.java

@@ -238,41 +238,45 @@ public class REIRenderHelper {
             reiGui.tick();
             reiGui.tick();
     }
     }
     
     
-    public static void recipeKeybind() {
+    public static boolean recipeKeyBind() {
         if (!(MinecraftClient.getInstance().currentGui instanceof ContainerGui))
         if (!(MinecraftClient.getInstance().currentGui instanceof ContainerGui))
-            return;
+            return false;
         Control control = reiGui.getLastHovered();
         Control control = reiGui.getLastHovered();
         if (control != null && control.isHighlighted() && control instanceof REISlot) {
         if (control != null && control.isHighlighted() && control instanceof REISlot) {
             REISlot slot = (REISlot) control;
             REISlot slot = (REISlot) control;
             REIRecipeManager.instance().displayRecipesFor(slot.getStack());
             REIRecipeManager.instance().displayRecipesFor(slot.getStack());
-            return;
+            return true;
         }
         }
         if (((IMixinContainerGui) overlayedGui).getHoveredSlot() != null) {
         if (((IMixinContainerGui) overlayedGui).getHoveredSlot() != null) {
             ItemStack stack = ((IMixinContainerGui) overlayedGui).getHoveredSlot().getStack();
             ItemStack stack = ((IMixinContainerGui) overlayedGui).getHoveredSlot().getStack();
             REIRecipeManager.instance().displayRecipesFor(stack);
             REIRecipeManager.instance().displayRecipesFor(stack);
+            return true;
         }
         }
-        
+        return false;
     }
     }
     
     
-    public static void useKeybind() {
+    public static boolean useKeyBind() {
         if (!(MinecraftClient.getInstance().currentGui instanceof ContainerGui))
         if (!(MinecraftClient.getInstance().currentGui instanceof ContainerGui))
-            return;
+            return false;
         Control control = reiGui.getLastHovered();
         Control control = reiGui.getLastHovered();
         if (control != null && control.isHighlighted() && control instanceof REISlot) {
         if (control != null && control.isHighlighted() && control instanceof REISlot) {
             REISlot slot = (REISlot) control;
             REISlot slot = (REISlot) control;
             REIRecipeManager.instance().displayUsesFor(slot.getStack());
             REIRecipeManager.instance().displayUsesFor(slot.getStack());
-            return;
+            return true;
         }
         }
         if (((IMixinContainerGui) overlayedGui).getHoveredSlot() != null) {
         if (((IMixinContainerGui) overlayedGui).getHoveredSlot() != null) {
             ItemStack stack = ((IMixinContainerGui) overlayedGui).getHoveredSlot().getStack();
             ItemStack stack = ((IMixinContainerGui) overlayedGui).getHoveredSlot().getStack();
             REIRecipeManager.instance().displayUsesFor(stack);
             REIRecipeManager.instance().displayUsesFor(stack);
+            return true;
         }
         }
-        
+        return false;
     }
     }
     
     
-    public static void hideKeybind() {
+    public static boolean hideKeyBind() {
         if (MinecraftClient.getInstance().currentGui == overlayedGui && reiGui != null) {
         if (MinecraftClient.getInstance().currentGui == overlayedGui && reiGui != null) {
             reiGui.visible = !reiGui.visible;
             reiGui.visible = !reiGui.visible;
+            return true;
         }
         }
+        return false;
     }
     }
 }
 }

+ 1 - 1
src/main/java/me/shedaniel/gui/RecipeGui.java

@@ -220,7 +220,7 @@ public class RecipeGui extends ContainerGui {
     
     
     @Override
     @Override
     public boolean keyPressed(int p_keyPressed_1_, int p_keyPressed_2_, int p_keyPressed_3_) {
     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) {
             this.client.openGui(prevScreen);
             this.client.openGui(prevScreen);
             return true;
             return true;
         }
         }

+ 4 - 1
src/main/java/me/shedaniel/gui/widget/REISlot.java

@@ -127,7 +127,10 @@ public class REISlot extends Control {
                 return true;
                 return true;
             }
             }
         } else {
         } else {
-            REIRenderHelper.recipeKeybind();
+            if (button == 0)
+                return REIRenderHelper.recipeKeyBind();
+            else if (button == 1)
+                return REIRenderHelper.useKeyBind();
         }
         }
         return false;
         return false;
     }
     }