Unknown vor 6 Jahren
Ursprung
Commit
7c2bc9f326

+ 3 - 1
CHANGELOG.md

@@ -1,7 +1,9 @@
 View full changelog [here](https://github.com/shedaniel/RoughlyEnoughItems/blob/1.14/CHANGELOG.md).
+## v2.7.5.89
+- Fixed: Keybinds (e.g. O, R, U) working even if recipe book search field is focused
 ## v2.7.4.88
 - Fixed: Item List Overlay buttons still enabled when there is only 1 page
-- Fixed [#58](https://github.com/shedaniel/RoughlyEnoughItems/issues/58): Keybinds (e.g. O, R, U) working even creative search field is focused
+- Fixed [#58](https://github.com/shedaniel/RoughlyEnoughItems/issues/58): Keybinds (e.g. O, R, U) working even if creative search field is focused
 - Fixed [#59](https://github.com/shedaniel/RoughlyEnoughItems/issues/59): Wrong page calculation (Thanks geniiii)
 ## v2.7.3.87
 - Fixed: Credits button not working

+ 1 - 0
README.md

@@ -28,6 +28,7 @@ One feature will be limited:
 - LOLCATS
 - Upside Down English
 - Brazilian Portuguese
+- Bulgarian
 
 ### License
 Roughly Enough Items was a fork of Almost Enough Items by ZenDarva until v2.0 rewrite. This fork is permitted under the MIT license.  

+ 1 - 1
gradle.properties

@@ -1,4 +1,4 @@
-mod_version=2.7.4+build.88
+mod_version=2.7.5+build.89
 minecraft_version=1.14 Pre-Release 2
 yarn_version=1.14 Pre-Release 2+build.1
 fabric_version=0.2.7+build.122

+ 9 - 1
src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java

@@ -11,6 +11,7 @@ import me.shedaniel.rei.client.ConfigManager;
 import me.shedaniel.rei.client.*;
 import me.shedaniel.rei.gui.ContainerScreenOverlay;
 import me.shedaniel.rei.listeners.CreativePlayerInventoryScreenHooks;
+import me.shedaniel.rei.listeners.RecipeBookGuiHooks;
 import net.fabricmc.api.ClientModInitializer;
 import net.fabricmc.loader.api.FabricLoader;
 import net.fabricmc.loader.api.ModContainer;
@@ -20,6 +21,7 @@ import net.minecraft.client.gui.ContainerScreen;
 import net.minecraft.client.gui.Element;
 import net.minecraft.client.gui.ingame.CreativePlayerInventoryScreen;
 import net.minecraft.client.gui.ingame.PlayerInventoryScreen;
+import net.minecraft.client.gui.recipebook.RecipeBookGui;
 import net.minecraft.client.gui.widget.RecipeBookButtonWidget;
 import net.minecraft.client.gui.widget.TextFieldWidget;
 import net.minecraft.item.ItemGroup;
@@ -213,8 +215,14 @@ public class RoughlyEnoughItemsCore implements ClientModInitializer {
         });
         ClothClientHooks.SCREEN_KEY_PRESSED.register((minecraftClient, screen, i, i1, i2) -> {
             if (screen instanceof CreativePlayerInventoryScreen && ((CreativePlayerInventoryScreenHooks) screen).rei_getSelectedTab() == ItemGroup.SEARCH.getIndex())
-                if (screen.getFocused() != null && screen.getFocused() instanceof TextFieldWidget && ((TextFieldWidget) screen.getFocused()).isFocused())
+                if (screen.getFocused() != null && screen.getFocused() instanceof TextFieldWidget)
                     return ActionResult.PASS;
+            if (screen instanceof ContainerScreen && !(screen instanceof CreativePlayerInventoryScreen))
+                if (screen.getFocused() != null && screen.getFocused() instanceof RecipeBookGui) {
+                    RecipeBookGuiHooks gui = (RecipeBookGuiHooks) screen.getFocused();
+                    if (gui.rei_getSearchField() != null && gui.rei_getSearchField().isFocused())
+                        return ActionResult.PASS;
+                }
             if (screen instanceof ContainerScreen)
                 if (ScreenHelper.getLastOverlay().keyPressed(i, i1, i2))
                     return ActionResult.SUCCESS;

+ 4 - 1
src/main/java/me/shedaniel/rei/listeners/GhostSlotsHooks.java → src/main/java/me/shedaniel/rei/listeners/RecipeBookGuiHooks.java

@@ -1,9 +1,12 @@
 package me.shedaniel.rei.listeners;
 
 import net.minecraft.client.gui.widget.RecipeBookGhostSlots;
+import net.minecraft.client.gui.widget.TextFieldWidget;
 
-public interface GhostSlotsHooks {
+public interface RecipeBookGuiHooks {
     
     RecipeBookGhostSlots rei_getGhostSlots();
     
+    TextFieldWidget rei_getSearchField();
+    
 }

+ 11 - 2
src/main/java/me/shedaniel/rei/mixin/MixinRecipeBookGui.java

@@ -1,21 +1,30 @@
 package me.shedaniel.rei.mixin;
 
-import me.shedaniel.rei.listeners.GhostSlotsHooks;
+import me.shedaniel.rei.listeners.RecipeBookGuiHooks;
 import net.minecraft.client.gui.recipebook.RecipeBookGui;
 import net.minecraft.client.gui.widget.RecipeBookGhostSlots;
+import net.minecraft.client.gui.widget.TextFieldWidget;
 import org.spongepowered.asm.mixin.Final;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.Shadow;
 
 @Mixin(RecipeBookGui.class)
-public class MixinRecipeBookGui implements GhostSlotsHooks {
+public class MixinRecipeBookGui implements RecipeBookGuiHooks {
     
     @Shadow
     @Final
     protected RecipeBookGhostSlots ghostSlots;
     
+    @Shadow
+    private TextFieldWidget searchField;
+    
     public RecipeBookGhostSlots rei_getGhostSlots() {
         return ghostSlots;
     }
     
+    @Override
+    public TextFieldWidget rei_getSearchField() {
+        return searchField;
+    }
+    
 }

+ 6 - 6
src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java

@@ -5,7 +5,7 @@ import me.shedaniel.rei.RoughlyEnoughItemsCore;
 import me.shedaniel.rei.api.*;
 import me.shedaniel.rei.client.ScreenHelper;
 import me.shedaniel.rei.gui.RecipeViewingScreen;
-import me.shedaniel.rei.listeners.GhostSlotsHooks;
+import me.shedaniel.rei.listeners.RecipeBookGuiHooks;
 import net.minecraft.client.MinecraftClient;
 import net.minecraft.client.gui.ContainerScreen;
 import net.minecraft.client.gui.Screen;
@@ -239,9 +239,9 @@ public class DefaultPlugin implements REIPlugin {
                 if (!recipe.getRecipe().isPresent())
                     return false;
                 if (screen.getClass().isAssignableFrom(CraftingTableScreen.class))
-                    ((GhostSlotsHooks) (((CraftingTableScreen) screen).getRecipeBookGui())).rei_getGhostSlots().reset();
+                    ((RecipeBookGuiHooks) (((CraftingTableScreen) screen).getRecipeBookGui())).rei_getGhostSlots().reset();
                 else if (screen.getClass().isAssignableFrom(PlayerInventoryScreen.class))
-                    ((GhostSlotsHooks) (((PlayerInventoryScreen) screen).getRecipeBookGui())).rei_getGhostSlots().reset();
+                    ((RecipeBookGuiHooks) (((PlayerInventoryScreen) screen).getRecipeBookGui())).rei_getGhostSlots().reset();
                 else
                     return false;
                 MinecraftClient.getInstance().interactionManager.clickRecipe(MinecraftClient.getInstance().player.container.syncId, (Recipe) recipe.getRecipe().get(), Screen.hasShiftDown());
@@ -264,7 +264,7 @@ public class DefaultPlugin implements REIPlugin {
                 if (!recipe.getRecipe().isPresent())
                     return false;
                 if (screen instanceof FurnaceScreen)
-                    ((GhostSlotsHooks) (((FurnaceScreen) screen).getRecipeBookGui())).rei_getGhostSlots().reset();
+                    ((RecipeBookGuiHooks) (((FurnaceScreen) screen).getRecipeBookGui())).rei_getGhostSlots().reset();
                 else
                     return false;
                 MinecraftClient.getInstance().interactionManager.clickRecipe(MinecraftClient.getInstance().player.container.syncId, (Recipe) recipe.getRecipe().get(), Screen.hasShiftDown());
@@ -287,7 +287,7 @@ public class DefaultPlugin implements REIPlugin {
                 if (!recipe.getRecipe().isPresent())
                     return false;
                 if (screen instanceof SmokerScreen)
-                    ((GhostSlotsHooks) (((SmokerScreen) screen).getRecipeBookGui())).rei_getGhostSlots().reset();
+                    ((RecipeBookGuiHooks) (((SmokerScreen) screen).getRecipeBookGui())).rei_getGhostSlots().reset();
                 else
                     return false;
                 MinecraftClient.getInstance().interactionManager.clickRecipe(MinecraftClient.getInstance().player.container.syncId, (Recipe) recipe.getRecipe().get(), Screen.hasShiftDown());
@@ -315,7 +315,7 @@ public class DefaultPlugin implements REIPlugin {
                 if (!recipe.getRecipe().isPresent())
                     return false;
                 if (screen instanceof BlastFurnaceScreen)
-                    ((GhostSlotsHooks) (((BlastFurnaceScreen) screen).getRecipeBookGui())).rei_getGhostSlots().reset();
+                    ((RecipeBookGuiHooks) (((BlastFurnaceScreen) screen).getRecipeBookGui())).rei_getGhostSlots().reset();
                 else
                     return false;
                 MinecraftClient.getInstance().interactionManager.clickRecipe(MinecraftClient.getInstance().player.container.syncId, (Recipe) recipe.getRecipe().get(), Screen.hasShiftDown());

+ 1 - 1
src/main/resources/assets/roughlyenoughitems/lang/en_us.json

@@ -81,5 +81,5 @@
   "text.rei.config.april_fools.2019": "Force 2019 REI April Fools' joke: ",
   "text.rei.no_config_api": "Cloth Config API does not exist!\nPlease install it in order to show an in-game config screen!",
   "_comment": "Don't change / translate the credit down below if you are doing it :)",
-  "text.rei.credit.text": "§lRoughly Enough Items\n§7Originally a fork for Almost Enough Items.\n\n§lDevelopers\n  - Originally by ZenDarva\n  - Created by Danielshe\n  - Plugin Support by TehNut\n\n§lLanguage Translation\n  English - Danielshe\n  Simplified Chinese - Danielshe\n  Traditional Chinese - hugoalh & Danielshe\n  French - Yanis48\n  German - MelanX\n  Estonian - Madis0\n  Portuguese - thiagokenis\n  LOLCAT - Danielshe\n  Upside Down - Danielshe\n\n§lLicense\n§7Roughly Enough Items is using MIT."
+  "text.rei.credit.text": "§lRoughly Enough Items\n§7Originally a fork for Almost Enough Items.\n\n§lDevelopers\n  - Originally by ZenDarva\n  - Created by Danielshe\n  - Plugin Support by TehNut\n\n§lLanguage Translation\n  English - Danielshe\n  Simplified Chinese - Danielshe\n  Traditional Chinese - hugoalh & Danielshe\n  French - Yanis48\n  German - MelanX\n  Estonian - Madis0\n  Portuguese - thiagokenis\n  LOLCAT - Danielshe\n  Upside Down - Danielshe\n  Brazilian Portuguese\n  Bulgarian - geniiii\n\n§lLicense\n§7Roughly Enough Items is using MIT."
 }