aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorUnknown <shekwancheung0528@gmail.com>2019-03-23 00:46:32 +0800
committerUnknown <shekwancheung0528@gmail.com>2019-03-23 00:46:32 +0800
commit1c966e927b3f41e129b2e19c4dd5ea7d67a0f47d (patch)
treed87ea14890f5feba3d81bcea6f3b1a3393bf7323 /src/main/java
parent19349d7da7ac6bb0939f59066dec61f09d9c5e8c (diff)
downloadRoughlyEnoughItems-1c966e927b3f41e129b2e19c4dd5ea7d67a0f47d.tar.gz
RoughlyEnoughItems-1c966e927b3f41e129b2e19c4dd5ea7d67a0f47d.tar.bz2
RoughlyEnoughItems-1c966e927b3f41e129b2e19c4dd5ea7d67a0f47d.zip
v2.5.0.73
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/me/shedaniel/rei/client/ClientHelper.java1
-rw-r--r--src/main/java/me/shedaniel/rei/client/ConfigManager.java39
-rw-r--r--src/main/java/me/shedaniel/rei/client/SearchArgument.java1
-rw-r--r--src/main/java/me/shedaniel/rei/utils/ClothRegistry.java39
4 files changed, 46 insertions, 34 deletions
diff --git a/src/main/java/me/shedaniel/rei/client/ClientHelper.java b/src/main/java/me/shedaniel/rei/client/ClientHelper.java
index 16692a004..103f5784f 100644
--- a/src/main/java/me/shedaniel/rei/client/ClientHelper.java
+++ b/src/main/java/me/shedaniel/rei/client/ClientHelper.java
@@ -18,7 +18,6 @@ import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.ingame.CreativePlayerInventoryScreen;
import net.minecraft.client.util.InputUtil;
import net.minecraft.item.ItemStack;
-import net.minecraft.item.Items;
import net.minecraft.text.TranslatableTextComponent;
import net.minecraft.util.DefaultedList;
import net.minecraft.util.Identifier;
diff --git a/src/main/java/me/shedaniel/rei/client/ConfigManager.java b/src/main/java/me/shedaniel/rei/client/ConfigManager.java
index 7b6b2b534..59a870234 100644
--- a/src/main/java/me/shedaniel/rei/client/ConfigManager.java
+++ b/src/main/java/me/shedaniel/rei/client/ConfigManager.java
@@ -4,22 +4,14 @@ import blue.endless.jankson.Jankson;
import blue.endless.jankson.JsonObject;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
-import javafx.util.Pair;
-import me.shedaniel.cloth.api.ConfigScreenBuilder;
-import me.shedaniel.cloth.gui.ClothConfigScreen;
-import me.shedaniel.cloth.gui.entries.BooleanListEntry;
-import me.shedaniel.cloth.gui.entries.IntegerListEntry;
-import me.shedaniel.cloth.gui.entries.StringListEntry;
import me.shedaniel.rei.RoughlyEnoughItemsCore;
-import me.shedaniel.rei.gui.config.ItemListOrderingEntry;
import net.fabricmc.loader.api.FabricLoader;
-import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.Screen;
-import net.minecraft.client.resource.language.I18n;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
@@ -130,30 +122,11 @@ public class ConfigManager implements me.shedaniel.rei.api.ConfigManager {
@Override
public void openConfigScreen(Screen parent) {
- ClothConfigScreen.Builder builder = new ClothConfigScreen.Builder(parent, I18n.translate("text.rei.config.title"), null);
- builder.addCategory("text.rei.config.general").addOption(new BooleanListEntry("text.rei.config.cheating", config.cheating, "text.cloth.reset_value", () -> false, bool -> config.cheating = bool));
- ConfigScreenBuilder.CategoryBuilder appearance = builder.addCategory("text.rei.config.appearance");
- appearance.addOption(new BooleanListEntry("text.rei.config.side_search_box", config.sideSearchField, "text.cloth.reset_value", () -> false, bool -> config.sideSearchField = bool));
- appearance.addOption(new ItemListOrderingEntry("text.rei.config.list_ordering", new Pair<>(config.itemListOrdering, config.isAscending)));
- appearance.addOption(new BooleanListEntry("text.rei.config.mirror_rei", config.mirrorItemPanel, "text.cloth.reset_value", () -> false, bool -> config.mirrorItemPanel = bool));
- appearance.addOption(new IntegerListEntry("text.rei.config.max_recipes_per_page", config.maxRecipePerPage, "text.cloth.reset_value", () -> 3, i -> config.maxRecipePerPage = i).setMinimum(2).setMaximum(99));
- ConfigScreenBuilder.CategoryBuilder modules = builder.addCategory("text.rei.config.modules");
- modules.addOption(new BooleanListEntry("text.rei.config.enable_craftable_only", config.enableCraftableOnlyButton, "text.cloth.reset_value", () -> true, bool -> config.enableCraftableOnlyButton = bool));
- modules.addOption(new BooleanListEntry("text.rei.config.enable_util_buttons", config.showUtilsButtons, "text.cloth.reset_value", () -> false, bool -> config.showUtilsButtons = bool));
- modules.addOption(new BooleanListEntry("text.rei.config.disable_recipe_book", config.disableRecipeBook, "text.cloth.reset_value", () -> false, bool -> config.disableRecipeBook = bool));
- ConfigScreenBuilder.CategoryBuilder advanced = builder.addCategory("text.rei.config.advanced");
- advanced.addOption(new StringListEntry("text.rei.give_command", config.giveCommand, "text.cloth.reset_value", () -> "/give {player_name} {item_identifier}{nbt} {count}", s -> config.giveCommand = s));
- advanced.addOption(new StringListEntry("text.rei.gamemode_command", config.gamemodeCommand, "text.cloth.reset_value", () -> "/gamemode {gamemode}", s -> config.gamemodeCommand = s));
- advanced.addOption(new StringListEntry("text.rei.weather_command", config.weatherCommand, "text.cloth.reset_value", () -> "/weather {weather}", s -> config.weatherCommand = s));
- advanced.addOption(new BooleanListEntry("text.rei.config.prefer_visible_recipes", config.preferVisibleRecipes, "text.cloth.reset_value", () -> false, bool -> config.preferVisibleRecipes = bool));
- builder.setOnSave(savedConfig -> {
- try {
- ConfigManager.this.saveConfig();
- } catch (IOException e) {
- e.printStackTrace();
- }
- });
- MinecraftClient.getInstance().openScreen(builder.build());
+ try {
+ Class.forName("me.shedaniel.rei.utils.ClothRegistry").getDeclaredMethod("openConfigScreen", Screen.class).invoke(null, parent);
+ } catch (IllegalAccessException | ClassNotFoundException | NoSuchMethodException | InvocationTargetException e) {
+ e.printStackTrace();
+ }
}
}
diff --git a/src/main/java/me/shedaniel/rei/client/SearchArgument.java b/src/main/java/me/shedaniel/rei/client/SearchArgument.java
index f3a5a5032..4d0716566 100644
--- a/src/main/java/me/shedaniel/rei/client/SearchArgument.java
+++ b/src/main/java/me/shedaniel/rei/client/SearchArgument.java
@@ -5,6 +5,7 @@ public class SearchArgument {
private ArgumentType argumentType;
private String text;
private boolean include;
+
public SearchArgument(ArgumentType argumentType, String text, boolean include) {
this.argumentType = argumentType;
this.text = text;
diff --git a/src/main/java/me/shedaniel/rei/utils/ClothRegistry.java b/src/main/java/me/shedaniel/rei/utils/ClothRegistry.java
index ba87250f2..39feba41f 100644
--- a/src/main/java/me/shedaniel/rei/utils/ClothRegistry.java
+++ b/src/main/java/me/shedaniel/rei/utils/ClothRegistry.java
@@ -1,18 +1,30 @@
package me.shedaniel.rei.utils;
+import javafx.util.Pair;
import me.shedaniel.cloth.api.ClientUtils;
+import me.shedaniel.cloth.api.ConfigScreenBuilder;
+import me.shedaniel.cloth.gui.ClothConfigScreen;
+import me.shedaniel.cloth.gui.entries.BooleanListEntry;
+import me.shedaniel.cloth.gui.entries.IntegerListEntry;
+import me.shedaniel.cloth.gui.entries.StringListEntry;
import me.shedaniel.cloth.hooks.ClothClientHooks;
import me.shedaniel.rei.RoughlyEnoughItemsCore;
import me.shedaniel.rei.api.TabGetter;
import me.shedaniel.rei.client.RecipeHelperImpl;
import me.shedaniel.rei.client.ScreenHelper;
import me.shedaniel.rei.gui.ContainerScreenOverlay;
+import me.shedaniel.rei.gui.config.ItemListOrderingEntry;
+import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.ContainerScreen;
+import net.minecraft.client.gui.Screen;
import net.minecraft.client.gui.ingame.CreativePlayerInventoryScreen;
import net.minecraft.client.gui.widget.RecipeBookButtonWidget;
+import net.minecraft.client.resource.language.I18n;
import net.minecraft.item.ItemGroup;
import net.minecraft.util.ActionResult;
+import java.io.IOException;
+
public class ClothRegistry {
public static void register() {
@@ -56,4 +68,31 @@ public class ClothRegistry {
});
}
+ public static void openConfigScreen(Screen parent) {
+ ClothConfigScreen.Builder builder = new ClothConfigScreen.Builder(parent, I18n.translate("text.rei.config.title"), null);
+ 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));
+ appearance.addOption(new ItemListOrderingEntry("text.rei.config.list_ordering", new Pair<>(RoughlyEnoughItemsCore.getConfigManager().getConfig().itemListOrdering, RoughlyEnoughItemsCore.getConfigManager().getConfig().isAscending)));
+ appearance.addOption(new BooleanListEntry("text.rei.config.mirror_rei", RoughlyEnoughItemsCore.getConfigManager().getConfig().mirrorItemPanel, "text.cloth.reset_value", () -> false, bool -> RoughlyEnoughItemsCore.getConfigManager().getConfig().mirrorItemPanel = bool));
+ appearance.addOption(new IntegerListEntry("text.rei.config.max_recipes_per_page", RoughlyEnoughItemsCore.getConfigManager().getConfig().maxRecipePerPage, "text.cloth.reset_value", () -> 3, i -> RoughlyEnoughItemsCore.getConfigManager().getConfig().maxRecipePerPage = i).setMinimum(2).setMaximum(99));
+ ConfigScreenBuilder.CategoryBuilder modules = builder.addCategory("text.rei.config.modules");
+ modules.addOption(new BooleanListEntry("text.rei.config.enable_craftable_only", RoughlyEnoughItemsCore.getConfigManager().getConfig().enableCraftableOnlyButton, "text.cloth.reset_value", () -> true, bool -> RoughlyEnoughItemsCore.getConfigManager().getConfig().enableCraftableOnlyButton = bool));
+ modules.addOption(new BooleanListEntry("text.rei.config.enable_util_buttons", RoughlyEnoughItemsCore.getConfigManager().getConfig().showUtilsButtons, "text.cloth.reset_value", () -> false, bool -> RoughlyEnoughItemsCore.getConfigManager().getConfig().showUtilsButtons = bool));
+ modules.addOption(new BooleanListEntry("text.rei.config.disable_recipe_book", RoughlyEnoughItemsCore.getConfigManager().getConfig().disableRecipeBook, "text.cloth.reset_value", () -> false, bool -> RoughlyEnoughItemsCore.getConfigManager().getConfig().disableRecipeBook = bool));
+ ConfigScreenBuilder.CategoryBuilder advanced = builder.addCategory("text.rei.config.advanced");
+ advanced.addOption(new StringListEntry("text.rei.give_command", RoughlyEnoughItemsCore.getConfigManager().getConfig().giveCommand, "text.cloth.reset_value", () -> "/give {player_name} {item_identifier}{nbt} {count}", s -> RoughlyEnoughItemsCore.getConfigManager().getConfig().giveCommand = s));
+ advanced.addOption(new StringListEntry("text.rei.gamemode_command", RoughlyEnoughItemsCore.getConfigManager().getConfig().gamemodeCommand, "text.cloth.reset_value", () -> "/gamemode {gamemode}", s -> RoughlyEnoughItemsCore.getConfigManager().getConfig().gamemodeCommand = s));
+ advanced.addOption(new StringListEntry("text.rei.weather_command", RoughlyEnoughItemsCore.getConfigManager().getConfig().weatherCommand, "text.cloth.reset_value", () -> "/weather {weather}", s -> RoughlyEnoughItemsCore.getConfigManager().getConfig().weatherCommand = s));
+ advanced.addOption(new BooleanListEntry("text.rei.config.prefer_visible_recipes", RoughlyEnoughItemsCore.getConfigManager().getConfig().preferVisibleRecipes, "text.cloth.reset_value", () -> false, bool -> RoughlyEnoughItemsCore.getConfigManager().getConfig().preferVisibleRecipes = bool));
+ builder.setOnSave(savedConfig -> {
+ try {
+ RoughlyEnoughItemsCore.getConfigManager().saveConfig();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ });
+ MinecraftClient.getInstance().openScreen(builder.build());
+ }
+
}