aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/rei/impl/ConfigManagerImpl.java
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2020-02-06 11:55:23 +0800
committershedaniel <daniel@shedaniel.me>2020-02-06 11:55:23 +0800
commit3ab6f974fb63b9f9232f8507e156cfc53cdf0250 (patch)
treef6625574308f0e5fd6e3e8f0120919ca4de4a0b1 /src/main/java/me/shedaniel/rei/impl/ConfigManagerImpl.java
parent129d287ddad825878af3b447f144ab38ccd1acf6 (diff)
downloadRoughlyEnoughItems-3ab6f974fb63b9f9232f8507e156cfc53cdf0250.tar.gz
RoughlyEnoughItems-3ab6f974fb63b9f9232f8507e156cfc53cdf0250.tar.bz2
RoughlyEnoughItems-3ab6f974fb63b9f9232f8507e156cfc53cdf0250.zip
4.0-unstable
Signed-off-by: shedaniel <daniel@shedaniel.me>
Diffstat (limited to 'src/main/java/me/shedaniel/rei/impl/ConfigManagerImpl.java')
-rw-r--r--src/main/java/me/shedaniel/rei/impl/ConfigManagerImpl.java17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/main/java/me/shedaniel/rei/impl/ConfigManagerImpl.java b/src/main/java/me/shedaniel/rei/impl/ConfigManagerImpl.java
index e2c4ef1b0..2e050a562 100644
--- a/src/main/java/me/shedaniel/rei/impl/ConfigManagerImpl.java
+++ b/src/main/java/me/shedaniel/rei/impl/ConfigManagerImpl.java
@@ -35,7 +35,6 @@ import me.shedaniel.rei.gui.ContainerScreenOverlay;
import me.shedaniel.rei.gui.PreRecipeViewingScreen;
import me.shedaniel.rei.gui.config.RecipeScreenType;
import me.shedaniel.rei.gui.credits.CreditsScreen;
-import me.shedaniel.rei.gui.widget.ReloadConfigButtonWidget;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.Element;
@@ -61,7 +60,7 @@ public class ConfigManagerImpl implements ConfigManager {
private boolean craftableOnly;
// private List<EntryStack> favorites = new ArrayList<>();
- private Gson gson = new GsonBuilder().create();
+ private final Gson gson = new GsonBuilder().create();
public ConfigManagerImpl() {
this.craftableOnly = false;
@@ -115,9 +114,10 @@ public class ConfigManagerImpl implements ConfigManager {
guiRegistry.registerAnnotationProvider((i13n, field, config, defaults, guiProvider) -> {
int width = 220;
+ //noinspection deprecation
return Collections.singletonList(new TooltipListEntry<RecipeScreenType>(i13n, null) {
private RecipeScreenType type = getUnsafely(field, config, RecipeScreenType.UNSET);
- private AbstractButtonWidget buttonWidget = new AbstractPressableButtonWidget(0, 0, 0, 20, "") {
+ private final AbstractButtonWidget buttonWidget = new AbstractPressableButtonWidget(0, 0, 0, 20, "") {
@Override
public void onPress() {
MinecraftClient.getInstance().openScreen(new PreRecipeViewingScreen(getScreen(), type, false, original -> {
@@ -133,7 +133,7 @@ public class ConfigManagerImpl implements ConfigManager {
super.render(mouseX, mouseY, delta);
}
};
- private List<Element> children = ImmutableList.of(buttonWidget);
+ private final List<Element> children = ImmutableList.of(buttonWidget);
@Override
public RecipeScreenType getValue() {
@@ -188,7 +188,6 @@ public class ConfigManagerImpl implements ConfigManager {
((me.sargunvohra.mcmods.autoconfig1u.ConfigManager<ConfigObjectImpl>) AutoConfig.getConfigHolder(ConfigObjectImpl.class)).save();
}
- @Override
public ConfigObject getConfig() {
return AutoConfig.getConfigHolder(ConfigObjectImpl.class).getConfig();
}
@@ -214,8 +213,8 @@ public class ConfigManagerImpl implements ConfigManager {
provider.setBuildFunction(builder -> {
if (FabricLoader.getInstance().isModLoaded("modmenu")) {
builder.getOrCreateCategory("config.roughlyenoughitems.!general").addEntry(new TooltipListEntry<Object>(I18n.translate("config.roughlyenoughitems.smooth_scrolling"), null) {
- int width = 220;
- private AbstractButtonWidget buttonWidget = new AbstractPressableButtonWidget(0, 0, 0, 20, this.getFieldName()) {
+ final int width = 220;
+ private final AbstractButtonWidget buttonWidget = new AbstractPressableButtonWidget(0, 0, 0, 20, this.getFieldName()) {
public void onPress() {
Screen screen = ModMenu.getConfigScreen("cloth-config2", parent);
if (screen != null) {
@@ -224,7 +223,7 @@ public class ConfigManagerImpl implements ConfigManager {
ModMenu.openConfigScreen("cloth-config2");
}
};
- private List<Element> children = ImmutableList.of(this.buttonWidget);
+ private final List<Element> children = ImmutableList.of(this.buttonWidget);
public Object getValue() {
return null;
@@ -254,7 +253,7 @@ public class ConfigManagerImpl implements ConfigManager {
}
return builder.setAfterInitConsumer(screen -> {
if (MinecraftClient.getInstance().getNetworkHandler() != null && MinecraftClient.getInstance().getNetworkHandler().getRecipeManager() != null) {
- ((ScreenHooks) screen).cloth_addButton(new ReloadConfigButtonWidget(4, 4, 100, 20, I18n.translate("text.rei.reload_config"), buttonWidget -> {
+ ((ScreenHooks) screen).cloth_addButton(new net.minecraft.client.gui.widget.ButtonWidget(4, 4, 100, 20, I18n.translate("text.rei.reload_config"), buttonWidget -> {
RoughlyEnoughItemsCore.syncRecipes(null);
}) {
@Override