aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/rei/utils/ClothRegistry.java
diff options
context:
space:
mode:
authorUnknown <shekwancheung0528@gmail.com>2019-04-05 17:13:06 +0800
committerUnknown <shekwancheung0528@gmail.com>2019-04-05 17:13:06 +0800
commit127e6b24a8dbc11ec110076be724b022e456d080 (patch)
tree89fbe11f15834910f2c45da6b63f015e2e1a5283 /src/main/java/me/shedaniel/rei/utils/ClothRegistry.java
parent48e3131d69dad0bd06532f7c3d5bdc0c34877e83 (diff)
downloadRoughlyEnoughItems-127e6b24a8dbc11ec110076be724b022e456d080.tar.gz
RoughlyEnoughItems-127e6b24a8dbc11ec110076be724b022e456d080.tar.bz2
RoughlyEnoughItems-127e6b24a8dbc11ec110076be724b022e456d080.zip
v2.6.1
Diffstat (limited to 'src/main/java/me/shedaniel/rei/utils/ClothRegistry.java')
-rw-r--r--src/main/java/me/shedaniel/rei/utils/ClothRegistry.java31
1 files changed, 22 insertions, 9 deletions
diff --git a/src/main/java/me/shedaniel/rei/utils/ClothRegistry.java b/src/main/java/me/shedaniel/rei/utils/ClothRegistry.java
index 75abaa803..0192a4783 100644
--- a/src/main/java/me/shedaniel/rei/utils/ClothRegistry.java
+++ b/src/main/java/me/shedaniel/rei/utils/ClothRegistry.java
@@ -22,7 +22,6 @@ import net.minecraft.client.gui.Screen;
import net.minecraft.client.gui.ingame.CreativePlayerInventoryScreen;
import net.minecraft.client.gui.ingame.PlayerInventoryScreen;
import net.minecraft.client.gui.widget.RecipeBookButtonWidget;
-import net.minecraft.client.resource.language.I18n;
import net.minecraft.item.ItemGroup;
import net.minecraft.util.ActionResult;
@@ -101,10 +100,31 @@ public class ClothRegistry {
return ActionResult.SUCCESS;
return ActionResult.PASS;
});
+ ClothClientHooks.SCREEN_LATE_RENDER.register((minecraftClient, screen, i, i1, v) -> {
+ if (screen instanceof CreativePlayerInventoryScreen)
+ if (((CreativePlayerInventoryScreenHooks) screen).rei_getSelectedTab() != ItemGroup.INVENTORY.getIndex())
+ return;
+ if (screen instanceof ContainerScreen)
+ ScreenHelper.getLastOverlay().lateRender(i, i1, v);
+ });
+ ClothClientHooks.SCREEN_KEY_PRESSED.register((minecraftClient, screen, i, i1, i2) -> {
+ if (screen instanceof CreativePlayerInventoryScreen)
+ if (((CreativePlayerInventoryScreenHooks) screen).rei_getSelectedTab() != ItemGroup.INVENTORY.getIndex())
+ return ActionResult.PASS;
+ if (ScreenHelper.getLastOverlay().keyPressed(i, i1, i2))
+ return ActionResult.SUCCESS;
+ return ActionResult.PASS;
+ });
}
public static void openConfigScreen(Screen parent) {
- ConfigScreenBuilder builder = new ClothConfigScreen.Builder(parent, I18n.translate("text.rei.config.title"), null);
+ ConfigScreenBuilder builder = new ClothConfigScreen.Builder(parent, "text.rei.config.title", savedConfig -> {
+ try {
+ RoughlyEnoughItemsCore.getConfigManager().saveConfig();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ });
builder.addCategory("text.rei.config.general").addOption(new BooleanListEntry("text.rei.config.cheating", RoughlyEnoughItemsCore.getConfigManager().getConfig().cheating, "text.cloth.reset_value", () -> false, bool -> RoughlyEnoughItemsCore.getConfigManager().getConfig().cheating = bool));
ConfigScreenBuilder.CategoryBuilder appearance = builder.addCategory("text.rei.config.appearance");
appearance.addOption(new BooleanListEntry("text.rei.config.side_search_box", RoughlyEnoughItemsCore.getConfigManager().getConfig().sideSearchField, "text.cloth.reset_value", () -> false, bool -> RoughlyEnoughItemsCore.getConfigManager().getConfig().sideSearchField = bool));
@@ -123,13 +143,6 @@ public class ClothRegistry {
advanced.addOption(new BooleanListEntry("text.rei.config.enable_legacy_speedcraft_support", RoughlyEnoughItemsCore.getConfigManager().getConfig().enableLegacySpeedCraftSupport, "text.cloth.reset_value", () -> false, bool -> RoughlyEnoughItemsCore.getConfigManager().getConfig().enableLegacySpeedCraftSupport = bool));
ConfigScreenBuilder.CategoryBuilder aprilFools = builder.addCategory("text.rei.config.april_fools");
aprilFools.addOption(new BooleanListEntry("text.rei.config.april_fools.2019", RoughlyEnoughItemsCore.getConfigManager().getConfig().aprilFoolsFish2019, "text.cloth.reset_value", () -> false, bool -> RoughlyEnoughItemsCore.getConfigManager().getConfig().aprilFoolsFish2019 = bool));
- builder.setOnSave(savedConfig -> {
- try {
- RoughlyEnoughItemsCore.getConfigManager().saveConfig();
- } catch (IOException e) {
- e.printStackTrace();
- }
- });
MinecraftClient.getInstance().openScreen(builder.build());
}