Преглед на файлове

Fix Vanilla Tab Container

Danielshe преди 5 години
родител
ревизия
4d523a9795

+ 1 - 1
gradle.properties

@@ -1,4 +1,4 @@
-mod_version=3.1.4
+mod_version=3.1.5
 minecraft_version=1.14.4
 yarn_version=1.14.4+build.1
 fabricloader_version=0.6.1+build.164

+ 5 - 0
src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java

@@ -282,6 +282,11 @@ public class RoughlyEnoughItemsCore implements ClientModInitializer {
             if (screen instanceof AbstractContainerScreen)
                 if (ScreenHelper.getLastOverlay().keyPressed(i, i1, i2))
                     return ActionResult.SUCCESS;
+            if (screen instanceof AbstractContainerScreen && configManager.getConfig().doesDisableRecipeBook() && configManager.getConfig().doesFixTabCloseContainer())
+                if (i == 258 && minecraftClient.options.keyInventory.matchesKey(i, i1)) {
+                    minecraftClient.player.closeContainer();
+                    return ActionResult.SUCCESS;
+                }
             return ActionResult.PASS;
         });
     }

+ 2 - 0
src/main/java/me/shedaniel/rei/api/ConfigObject.java

@@ -58,6 +58,8 @@ public interface ConfigObject {
     
     boolean doesDisableRecipeBook();
     
+    boolean doesFixTabCloseContainer();
+    
     boolean areClickableRecipeArrowsEnabled();
     
     ItemCheatingMode getItemCheatingMode();

+ 12 - 0
src/main/java/me/shedaniel/rei/impl/ConfigObjectImpl.java

@@ -130,6 +130,13 @@ public class ConfigObjectImpl implements ConfigObject {
             .withName("disableRecipeBook")
             .build();
     
+    private ConfigValue<Boolean> fixTabCloseContainer = ConfigValue.builder(Boolean.class)
+            .withParent(modules)
+            .withDefaultValue(false)
+            .withComment("Declares whether REI should fix closing container with tab.")
+            .withName("fixTabCloseContainer")
+            .build();
+    
     private ConfigValue<Boolean> clickableRecipeArrows = ConfigValue.builder(Boolean.class)
             .withParent(appearance)
             .withDefaultValue(true)
@@ -296,6 +303,11 @@ public class ConfigObjectImpl implements ConfigObject {
         return disableRecipeBook.getValue().booleanValue();
     }
     
+    @Override
+    public boolean doesFixTabCloseContainer() {
+        return fixTabCloseContainer.getValue().booleanValue();
+    }
+    
     @Override
     public boolean areClickableRecipeArrowsEnabled() {
         return clickableRecipeArrows.getValue().booleanValue();

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

@@ -109,6 +109,7 @@
   "config.roughlyenoughitems.disableRecipeBook": "Vanilla Recipe Book:",
   "config.roughlyenoughitems.disableRecipeBook.boolean.true": "Disabled",
   "config.roughlyenoughitems.disableRecipeBook.boolean.false": "Enabled",
+  "config.roughlyenoughitems.fixTabCloseContainer": "Fix Vanilla Tab Container (When Recipe Book Disabled):",
   "config.roughlyenoughitems.enableCraftableOnlyButton": "Craftable Filter:",
   "config.roughlyenoughitems.enableCraftableOnlyButton.boolean.true": "Enabled",
   "config.roughlyenoughitems.enableCraftableOnlyButton.boolean.false": "Disabled",