aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2019-11-15 20:09:15 +0800
committershedaniel <daniel@shedaniel.me>2019-11-15 20:09:15 +0800
commitb7246fa0016888fd52c45f9c77df46f9d791e326 (patch)
treeca455d73ea2213ef6e5a62855834119715a13fe2 /src
parent5c34cd8dae4879e04fd825f423e0ddbf8480668e (diff)
downloadRoughlyEnoughItems-b7246fa0016888fd52c45f9c77df46f9d791e326.tar.gz
RoughlyEnoughItems-b7246fa0016888fd52c45f9c77df46f9d791e326.tar.bz2
RoughlyEnoughItems-b7246fa0016888fd52c45f9c77df46f9d791e326.zip
Using more of the API instead of the Impl
Diffstat (limited to 'src')
-rw-r--r--src/main/java/me/shedaniel/rei/REIModMenuEntryPoint.java3
-rw-r--r--src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java11
-rw-r--r--src/main/java/me/shedaniel/rei/api/ConfigManager.java1
-rw-r--r--src/main/java/me/shedaniel/rei/api/ConfigObject.java31
-rw-r--r--src/main/java/me/shedaniel/rei/api/DisplayHelper.java3
-rw-r--r--src/main/java/me/shedaniel/rei/api/EntryRegistry.java1
-rw-r--r--src/main/java/me/shedaniel/rei/api/EntryStack.java2
-rw-r--r--src/main/java/me/shedaniel/rei/api/LiveRecipeGenerator.java11
-rw-r--r--src/main/java/me/shedaniel/rei/api/RecipeHelper.java14
-rw-r--r--src/main/java/me/shedaniel/rei/api/TransferRecipeDisplay.java4
-rw-r--r--src/main/java/me/shedaniel/rei/api/plugins/REIPluginV0.java2
-rw-r--r--src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java91
-rw-r--r--src/main/java/me/shedaniel/rei/gui/PreRecipeViewingScreen.java6
-rw-r--r--src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java7
-rw-r--r--src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java5
-rw-r--r--src/main/java/me/shedaniel/rei/gui/entries/RecipeEntry.java1
-rw-r--r--src/main/java/me/shedaniel/rei/gui/entries/SimpleRecipeEntry.java26
-rw-r--r--src/main/java/me/shedaniel/rei/gui/widget/AutoCraftingButtonWidget.java3
-rw-r--r--src/main/java/me/shedaniel/rei/gui/widget/CraftableToggleButtonWidget.java6
-rw-r--r--src/main/java/me/shedaniel/rei/gui/widget/EntryListWidget.java37
-rw-r--r--src/main/java/me/shedaniel/rei/gui/widget/PanelWidget.java6
-rw-r--r--src/main/java/me/shedaniel/rei/gui/widget/RecipeBaseWidget.java4
-rw-r--r--src/main/java/me/shedaniel/rei/gui/widget/RecipeChoosePageWidget.java16
-rw-r--r--src/main/java/me/shedaniel/rei/impl/BaseBoundsHandlerImpl.java6
-rw-r--r--src/main/java/me/shedaniel/rei/impl/ClientHelperImpl.java19
-rw-r--r--src/main/java/me/shedaniel/rei/impl/ConfigManagerImpl.java3
-rw-r--r--src/main/java/me/shedaniel/rei/impl/ConfigObjectImpl.java20
-rw-r--r--src/main/java/me/shedaniel/rei/impl/DisplayHelperImpl.java3
-rw-r--r--src/main/java/me/shedaniel/rei/impl/EmptyEntryStack.java5
-rw-r--r--src/main/java/me/shedaniel/rei/impl/EntryRegistryImpl.java3
-rw-r--r--src/main/java/me/shedaniel/rei/impl/FluidEntryStack.java14
-rw-r--r--src/main/java/me/shedaniel/rei/impl/ItemEntryStack.java15
-rw-r--r--src/main/java/me/shedaniel/rei/impl/ObjectHolderImpl.java1
-rw-r--r--src/main/java/me/shedaniel/rei/impl/RecipeHelperImpl.java95
-rw-r--r--src/main/java/me/shedaniel/rei/impl/ScreenHelper.java9
-rw-r--r--src/main/java/me/shedaniel/rei/impl/SearchArgument.java4
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/DefaultAutoCraftingPlugin.java4
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/autocrafting/DefaultRecipeBookHandler.java3
-rw-r--r--src/main/java/me/shedaniel/rei/utils/ClothScreenRegistry.java3
-rw-r--r--src/main/java/me/shedaniel/rei/utils/CollectionUtils.java9
40 files changed, 224 insertions, 283 deletions
diff --git a/src/main/java/me/shedaniel/rei/REIModMenuEntryPoint.java b/src/main/java/me/shedaniel/rei/REIModMenuEntryPoint.java
index 6f69001a9..fdb0ec1d9 100644
--- a/src/main/java/me/shedaniel/rei/REIModMenuEntryPoint.java
+++ b/src/main/java/me/shedaniel/rei/REIModMenuEntryPoint.java
@@ -6,6 +6,7 @@
package me.shedaniel.rei;
import io.github.prospector.modmenu.api.ModMenuApi;
+import me.shedaniel.rei.api.ConfigManager;
import net.minecraft.client.gui.screen.Screen;
import java.util.Optional;
@@ -25,7 +26,7 @@ public class REIModMenuEntryPoint implements ModMenuApi {
}
public Screen getScreen(Screen parent) {
- return RoughlyEnoughItemsCore.getConfigManager().getConfigScreen(parent);
+ return ConfigManager.getInstance().getConfigScreen(parent);
}
}
diff --git a/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java b/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java
index 05588262e..e4c79a060 100644
--- a/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java
+++ b/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java
@@ -134,6 +134,7 @@ public class RoughlyEnoughItemsCore implements ClientModInitializer {
return ClientSidePacketRegistry.INSTANCE.canServerReceive(RoughlyEnoughItemsNetwork.CREATE_ITEMS_PACKET) && ClientSidePacketRegistry.INSTANCE.canServerReceive(RoughlyEnoughItemsNetwork.DELETE_ITEMS_PACKET);
}
+ @SuppressWarnings("deprecation")
@Override
public void onInitializeClient() {
configManager = new ConfigManagerImpl();
@@ -215,14 +216,16 @@ public class RoughlyEnoughItemsCore implements ClientModInitializer {
return;
}
lastSync.set(System.currentTimeMillis());
- if (RoughlyEnoughItemsCore.getConfigManager().getConfig().doesRegisterRecipesInAnotherThread()) {
- CompletableFuture.runAsync(() -> ((RecipeHelperImpl) RoughlyEnoughItemsCore.getRecipeHelper()).recipesLoaded(recipeManager), SYNC_RECIPES);
+ if (ConfigManager.getInstance().getConfig().doesRegisterRecipesInAnotherThread()) {
+ //noinspection deprecation
+ CompletableFuture.runAsync(() -> ((RecipeHelperImpl) RecipeHelper.getInstance()).recipesLoaded(recipeManager), SYNC_RECIPES);
} else {
- ((RecipeHelperImpl) RoughlyEnoughItemsCore.getRecipeHelper()).recipesLoaded(recipeManager);
+ //noinspection deprecation
+ ((RecipeHelperImpl) RecipeHelper.getInstance()).recipesLoaded(recipeManager);
}
});
ClothClientHooks.SCREEN_ADD_BUTTON.register((minecraftClient, screen, abstractButtonWidget) -> {
- if (RoughlyEnoughItemsCore.getConfigManager().getConfig().doesDisableRecipeBook() && screen instanceof AbstractContainerScreen && abstractButtonWidget instanceof TexturedButtonWidget)
+ if (ConfigManager.getInstance().getConfig().doesDisableRecipeBook() && screen instanceof AbstractContainerScreen && abstractButtonWidget instanceof TexturedButtonWidget)
if (((RecipeBookButtonWidgetHooks) abstractButtonWidget).rei_getTexture().equals(recipeButtonTex))
return ActionResult.FAIL;
return ActionResult.PASS;
diff --git a/src/main/java/me/shedaniel/rei/api/ConfigManager.java b/src/main/java/me/shedaniel/rei/api/ConfigManager.java
index bd9ea38cb..a1ccecbdb 100644
--- a/src/main/java/me/shedaniel/rei/api/ConfigManager.java
+++ b/src/main/java/me/shedaniel/rei/api/ConfigManager.java
@@ -14,6 +14,7 @@ import java.io.IOException;
public interface ConfigManager {
static ConfigManager getInstance() {
+ //noinspection deprecation
return RoughlyEnoughItemsCore.getConfigManager();
}
diff --git a/src/main/java/me/shedaniel/rei/api/ConfigObject.java b/src/main/java/me/shedaniel/rei/api/ConfigObject.java
index e87662de3..fb5d0e66d 100644
--- a/src/main/java/me/shedaniel/rei/api/ConfigObject.java
+++ b/src/main/java/me/shedaniel/rei/api/ConfigObject.java
@@ -72,35 +72,4 @@ public interface ConfigObject {
boolean doesRegisterRecipesInAnotherThread();
- RelativePoint getChoosePageDialogPoint();
-
- void setChoosePageDialogPoint(RelativePoint choosePageDialogPoint);
-
- public static class RelativePoint {
-
- private double relativeX, relativeY;
-
- public RelativePoint(double relativeX, double relativeY) {
- this.relativeX = relativeX;
- this.relativeY = relativeY;
- }
-
- public double getRelativeX() {
- return relativeX;
- }
-
- public double getRelativeY() {
- return relativeY;
- }
-
- public double getX(double width) {
- return width * relativeX;
- }
-
- public double getY(double height) {
- return height * relativeY;
- }
-
- }
-
}
diff --git a/src/main/java/me/shedaniel/rei/api/DisplayHelper.java b/src/main/java/me/shedaniel/rei/api/DisplayHelper.java
index be6ed6a2f..de01337ea 100644
--- a/src/main/java/me/shedaniel/rei/api/DisplayHelper.java
+++ b/src/main/java/me/shedaniel/rei/api/DisplayHelper.java
@@ -17,6 +17,7 @@ import static net.minecraft.util.ActionResult.PASS;
public interface DisplayHelper {
static DisplayHelper getInstance() {
+ //noinspection deprecation
return RoughlyEnoughItemsCore.getDisplayHelper();
}
@@ -117,7 +118,7 @@ public interface DisplayHelper {
* @return the item list bounds
*/
default Rectangle getItemListArea(Rectangle rectangle) {
- return new Rectangle(rectangle.x + 1, rectangle.y + 2 + (RoughlyEnoughItemsCore.getConfigManager().getConfig().getSearchFieldLocation() == SearchFieldLocation.TOP_SIDE ? 24 : 0) + (RoughlyEnoughItemsCore.getConfigManager().getConfig().isEntryListWidgetScrolled() ? 0 : 22), rectangle.width - 2, rectangle.height - (RoughlyEnoughItemsCore.getConfigManager().getConfig().getSearchFieldLocation() != SearchFieldLocation.CENTER ? 27 + 22 : 27) + (!RoughlyEnoughItemsCore.getConfigManager().getConfig().isEntryListWidgetScrolled() ? 0 : 22));
+ return new Rectangle(rectangle.x + 1, rectangle.y + 2 + (ConfigManager.getInstance().getConfig().getSearchFieldLocation() == SearchFieldLocation.TOP_SIDE ? 24 : 0) + (ConfigManager.getInstance().getConfig().isEntryListWidgetScrolled() ? 0 : 22), rectangle.width - 2, rectangle.height - (ConfigManager.getInstance().getConfig().getSearchFieldLocation() != SearchFieldLocation.CENTER ? 27 + 22 : 27) + (!ConfigManager.getInstance().getConfig().isEntryListWidgetScrolled() ? 0 : 22));
}
/**
diff --git a/src/main/java/me/shedaniel/rei/api/EntryRegistry.java b/src/main/java/me/shedaniel/rei/api/EntryRegistry.java
index 03cf0c21e..e2c66bf94 100644
--- a/src/main/java/me/shedaniel/rei/api/EntryRegistry.java
+++ b/src/main/java/me/shedaniel/rei/api/EntryRegistry.java
@@ -6,7 +6,6 @@
package me.shedaniel.rei.api;
import me.shedaniel.rei.RoughlyEnoughItemsCore;
-import me.shedaniel.rei.api.annotations.ToBeRemoved;
import me.shedaniel.rei.utils.CollectionUtils;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
diff --git a/src/main/java/me/shedaniel/rei/api/EntryStack.java b/src/main/java/me/shedaniel/rei/api/EntryStack.java
index 905540d56..7d94fb27c 100644
--- a/src/main/java/me/shedaniel/rei/api/EntryStack.java
+++ b/src/main/java/me/shedaniel/rei/api/EntryStack.java
@@ -10,7 +10,6 @@ import me.shedaniel.rei.gui.widget.QueuedTooltip;
import me.shedaniel.rei.impl.EmptyEntryStack;
import me.shedaniel.rei.impl.FluidEntryStack;
import me.shedaniel.rei.impl.ItemEntryStack;
-import net.minecraft.block.Block;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.fluid.Fluid;
import net.minecraft.item.Item;
@@ -25,6 +24,7 @@ import java.util.Optional;
import java.util.function.Function;
import java.util.function.Supplier;
+@SuppressWarnings("deprecation")
public interface EntryStack {
static EntryStack empty() {
diff --git a/src/main/java/me/shedaniel/rei/api/LiveRecipeGenerator.java b/src/main/java/me/shedaniel/rei/api/LiveRecipeGenerator.java
index 8200fcdc0..588010042 100644
--- a/src/main/java/me/shedaniel/rei/api/LiveRecipeGenerator.java
+++ b/src/main/java/me/shedaniel/rei/api/LiveRecipeGenerator.java
@@ -5,7 +5,6 @@
package me.shedaniel.rei.api;
-import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;
import java.util.List;
@@ -15,20 +14,10 @@ public interface LiveRecipeGenerator<T extends RecipeDisplay> {
Identifier getCategoryIdentifier();
- @Deprecated
- default Optional<List<T>> getRecipeFor(ItemStack stack) {
- return Optional.empty();
- }
-
default Optional<List<T>> getRecipeFor(EntryStack entry) {
return Optional.empty();
}
- @Deprecated
- default Optional<List<T>> getUsageFor(ItemStack stack) {
- return Optional.empty();
- }
-
default Optional<List<T>> getUsageFor(EntryStack entry) {
return Optional.empty();
}
diff --git a/src/main/java/me/shedaniel/rei/api/RecipeHelper.java b/src/main/java/me/shedaniel/rei/api/RecipeHelper.java
index 30915a794..3ddfdf7a4 100644
--- a/src/main/java/me/shedaniel/rei/api/RecipeHelper.java
+++ b/src/main/java/me/shedaniel/rei/api/RecipeHelper.java
@@ -20,10 +20,8 @@ import java.util.function.Predicate;
public interface RecipeHelper {
- /**
- * @return the api instance of {@link me.shedaniel.rei.impl.RecipeHelperImpl}
- */
static RecipeHelper getInstance() {
+ //noinspection deprecation
return RoughlyEnoughItemsCore.getRecipeHelper();
}
@@ -56,7 +54,7 @@ public interface RecipeHelper {
*
* @param category the category to register
*/
- void registerCategory(RecipeCategory category);
+ void registerCategory(RecipeCategory<?> category);
/**
* Registers the working stations of a category
@@ -106,7 +104,7 @@ public interface RecipeHelper {
*
* @return the list of categories
*/
- List<RecipeCategory> getAllCategories();
+ List<RecipeCategory<?>> getAllCategories();
/**
* Gets a map of usages for an entry
@@ -122,7 +120,7 @@ public interface RecipeHelper {
* @param category the category of the display
* @return the optional of speed crafting button area
*/
- Optional<ButtonAreaSupplier> getAutoCraftButtonArea(RecipeCategory category);
+ Optional<ButtonAreaSupplier> getAutoCraftButtonArea(RecipeCategory<?> category);
/**
* Registers a speed crafting button area
@@ -155,7 +153,7 @@ public interface RecipeHelper {
*/
Map<RecipeCategory<?>, List<RecipeDisplay>> getAllRecipes();
- List<RecipeDisplay> getAllRecipesFromCategory(RecipeCategory category);
+ List<RecipeDisplay> getAllRecipesFromCategory(RecipeCategory<?> category);
/**
* Registers a recipe visibility handler
@@ -207,7 +205,7 @@ public interface RecipeHelper {
*/
void registerLiveRecipeGenerator(LiveRecipeGenerator<?> liveRecipeGenerator);
- void registerScreenClickArea(Rectangle rectangle, Class<? extends AbstractContainerScreen> screenClass, Identifier... categories);
+ void registerScreenClickArea(Rectangle rectangle, Class<? extends AbstractContainerScreen<?>> screenClass, Identifier... categories);
<T extends Recipe<?>> void registerRecipes(Identifier category, Class<T> recipeClass, Function<T, RecipeDisplay> mappingFunction);
diff --git a/src/main/java/me/shedaniel/rei/api/TransferRecipeDisplay.java b/src/main/java/me/shedaniel/rei/api/TransferRecipeDisplay.java
index 94f337bc5..40b65488f 100644
--- a/src/main/java/me/shedaniel/rei/api/TransferRecipeDisplay.java
+++ b/src/main/java/me/shedaniel/rei/api/TransferRecipeDisplay.java
@@ -5,13 +5,9 @@
package me.shedaniel.rei.api;
-import com.google.common.collect.Lists;
import me.shedaniel.rei.server.ContainerInfo;
import net.minecraft.container.Container;
-import net.minecraft.item.ItemStack;
-import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
public interface TransferRecipeDisplay extends RecipeDisplay {
diff --git a/src/main/java/me/shedaniel/rei/api/plugins/REIPluginV0.java b/src/main/java/me/shedaniel/rei/api/plugins/REIPluginV0.java
index 1c4a5c2a4..2b89abab1 100644
--- a/src/main/java/me/shedaniel/rei/api/plugins/REIPluginV0.java
+++ b/src/main/java/me/shedaniel/rei/api/plugins/REIPluginV0.java
@@ -10,8 +10,6 @@ import me.shedaniel.rei.api.EntryRegistry;
import me.shedaniel.rei.api.REIPluginEntry;
import me.shedaniel.rei.api.RecipeHelper;
import me.shedaniel.rei.api.annotations.ToBeRemoved;
-import net.fabricmc.loader.api.SemanticVersion;
-import net.fabricmc.loader.util.version.VersionParsingException;
public interface REIPluginV0 extends REIPluginEntry {
diff --git a/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java b/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java
index ee35a42a3..d33b38a67 100644
--- a/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java
+++ b/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java
@@ -11,13 +11,9 @@ import me.shedaniel.math.api.Point;
import me.shedaniel.math.api.Rectangle;
import me.shedaniel.math.impl.PointHelper;
import me.shedaniel.rei.RoughlyEnoughItemsCore;
-import me.shedaniel.rei.api.ClientHelper;
-import me.shedaniel.rei.api.DisplayHelper;
-import me.shedaniel.rei.api.EntryStack;
-import me.shedaniel.rei.api.RecipeHelper;
+import me.shedaniel.rei.api.*;
import me.shedaniel.rei.gui.config.SearchFieldLocation;
import me.shedaniel.rei.gui.widget.*;
-import me.shedaniel.rei.impl.RecipeHelperImpl;
import me.shedaniel.rei.impl.ScreenHelper;
import me.shedaniel.rei.impl.Weather;
import me.shedaniel.rei.listeners.ContainerScreenHooks;
@@ -109,13 +105,14 @@ public class ContainerScreenOverlay extends Widget {
//Update Variables
this.children().clear();
this.window = MinecraftClient.getInstance().getWindow();
- DisplayHelper.DisplayBoundsHandler boundsHandler = RoughlyEnoughItemsCore.getDisplayHelper().getResponsibleBoundsHandler(MinecraftClient.getInstance().currentScreen.getClass());
- this.rectangle = RoughlyEnoughItemsCore.getConfigManager().getConfig().isLeftHandSidePanel() ? boundsHandler.getLeftBounds(MinecraftClient.getInstance().currentScreen) : boundsHandler.getRightBounds(MinecraftClient.getInstance().currentScreen);
+ @SuppressWarnings({"RawTypeCanBeGeneric", "rawtypes"})
+ DisplayHelper.DisplayBoundsHandler boundsHandler = DisplayHelper.getInstance().getResponsibleBoundsHandler(MinecraftClient.getInstance().currentScreen.getClass());
+ this.rectangle = ConfigManager.getInstance().getConfig().isLeftHandSidePanel() ? boundsHandler.getLeftBounds(MinecraftClient.getInstance().currentScreen) : boundsHandler.getRightBounds(MinecraftClient.getInstance().currentScreen);
widgets.add(entryListWidget = new EntryListWidget(page));
entryListWidget.updateList(boundsHandler, boundsHandler.getItemListArea(rectangle), page, searchTerm, false);
- if (!RoughlyEnoughItemsCore.getConfigManager().getConfig().isEntryListWidgetScrolled()) {
- widgets.add(buttonLeft = new ButtonWidget(rectangle.x, rectangle.y + (RoughlyEnoughItemsCore.getConfigManager().getConfig().getSearchFieldLocation() == SearchFieldLocation.TOP_SIDE ? 24 : 0) + 5, 16, 16, new TranslatableText("text.rei.left_arrow")) {
+ if (!ConfigManager.getInstance().getConfig().isEntryListWidgetScrolled()) {
+ widgets.add(buttonLeft = new ButtonWidget(rectangle.x, rectangle.y + (ConfigManager.getInstance().getConfig().getSearchFieldLocation() == SearchFieldLocation.TOP_SIDE ? 24 : 0) + 5, 16, 16, new TranslatableText("text.rei.left_arrow")) {
@Override
public void onPressed() {
page--;
@@ -139,7 +136,7 @@ public class ContainerScreenOverlay extends Widget {
return isNotInExclusionZones(mouseX, mouseY) && super.containsMouse(mouseX, mouseY);
}
});
- widgets.add(buttonRight = new ButtonWidget(rectangle.x + rectangle.width - 18, rectangle.y + (RoughlyEnoughItemsCore.getConfigManager().getConfig().getSearchFieldLocation() == SearchFieldLocation.TOP_SIDE ? 24 : 0) + 5, 16, 16, new TranslatableText("text.rei.right_arrow")) {
+ widgets.add(buttonRight = new ButtonWidget(rectangle.x + rectangle.width - 18, rectangle.y + (ConfigManager.getInstance().getConfig().getSearchFieldLocation() == SearchFieldLocation.TOP_SIDE ? 24 : 0) + 5, 16, 16, new TranslatableText("text.rei.right_arrow")) {
@Override
public void onPressed() {
page++;
@@ -168,14 +165,14 @@ public class ContainerScreenOverlay extends Widget {
if (setPage)
page = MathHelper.clamp(page, 0, getTotalPage());
- widgets.add(new ButtonWidget(RoughlyEnoughItemsCore.getConfigManager().getConfig().isLeftHandSidePanel() ? window.getScaledWidth() - 30 : 10, 10, 20, 20, "") {
+ widgets.add(new ButtonWidget(ConfigManager.getInstance().getConfig().isLeftHandSidePanel() ? window.getScaledWidth() - 30 : 10, 10, 20, 20, "") {
@Override
public void onPressed() {
if (Screen.hasShiftDown()) {
ClientHelper.getInstance().setCheating(!ClientHelper.getInstance().isCheating());
return;
}
- RoughlyEnoughItemsCore.getConfigManager().openConfigScreen(ScreenHelper.getLastContainerScreen());
+ ConfigManager.getInstance().openConfigScreen(ScreenHelper.getLastContainerScreen());
}
@Override
@@ -218,11 +215,11 @@ public class ContainerScreenOverlay extends Widget {
return isNotInExclusionZones(mouseX, mouseY) && super.containsMouse(mouseX, mouseY);
}
});
- if (RoughlyEnoughItemsCore.getConfigManager().getConfig().doesShowUtilsButtons()) {
- widgets.add(new ButtonWidget(RoughlyEnoughItemsCore.getConfigManager().getConfig().isLeftHandSidePanel() ? window.getScaledWidth() - 55 : 35, 10, 20, 20, "") {
+ if (ConfigManager.getInstance().getConfig().doesShowUtilsButtons()) {
+ widgets.add(new ButtonWidget(ConfigManager.getInstance().getConfig().isLeftHandSidePanel() ? window.getScaledWidth() - 55 : 35, 10, 20, 20, "") {
@Override
public void onPressed() {
- MinecraftClient.getInstance().player.sendChatMessage(RoughlyEnoughItemsCore.getConfigManager().getConfig().getGamemodeCommand().replaceAll("\\{gamemode}", getNextGameMode(Screen.hasShiftDown()).getName()));
+ MinecraftClient.getInstance().player.sendChatMessage(ConfigManager.getInstance().getConfig().getGamemodeCommand().replaceAll("\\{gamemode}", getNextGameMode(Screen.hasShiftDown()).getName()));
}
@Override
@@ -246,12 +243,12 @@ public class ContainerScreenOverlay extends Widget {
return isNotInExclusionZones(mouseX, mouseY) && super.containsMouse(mouseX, mouseY);
}
});
- int xxx = RoughlyEnoughItemsCore.getConfigManager().getConfig().isLeftHandSidePanel() ? window.getScaledWidth() - 30 : 10;
+ int xxx = ConfigManager.getInstance().getConfig().isLeftHandSidePanel() ? window.getScaledWidth() - 30 : 10;
for (Weather weather : Weather.values()) {
widgets.add(new ButtonWidget(xxx, 35, 20, 20, "") {
@Override
public void onPressed() {
- MinecraftClient.getInstance().player.sendChatMessage(RoughlyEnoughItemsCore.getConfigManager().getConfig().getWeatherCommand().replaceAll("\\{weather}", weather.name().toLowerCase(Locale.ROOT)));
+ MinecraftClient.getInstance().player.sendChatMessage(ConfigManager.getInstance().getConfig().getWeatherCommand().replaceAll("\\{weather}", weather.name().toLowerCase(Locale.ROOT)));
}
@Override
@@ -278,11 +275,11 @@ public class ContainerScreenOverlay extends Widget {
return isNotInExclusionZones(mouseX, mouseY) && super.containsMouse(mouseX, mouseY);
}
});
- xxx += RoughlyEnoughItemsCore.getConfigManager().getConfig().isLeftHandSidePanel() ? -25 : 25;
+ xxx += ConfigManager.getInstance().getConfig().isLeftHandSidePanel() ? -25 : 25;
}
}
- if (!RoughlyEnoughItemsCore.getConfigManager().getConfig().isEntryListWidgetScrolled()) {
- widgets.add(new ClickableLabelWidget(rectangle.x + (rectangle.width / 2), rectangle.y + (RoughlyEnoughItemsCore.getConfigManager().getConfig().getSearchFieldLocation() == SearchFieldLocation.TOP_SIDE ? 24 : 0) + 10, "", getTotalPage() > 0) {
+ if (!ConfigManager.getInstance().getConfig().isEntryListWidgetScrolled()) {
+ widgets.add(new ClickableLabelWidget(rectangle.x + (rectangle.width / 2), rectangle.y + (ConfigManager.getInstance().getConfig().getSearchFieldLocation() == SearchFieldLocation.TOP_SIDE ? 24 : 0) + 10, "", getTotalPage() > 0) {
@Override
public void render(int mouseX, int mouseY, float delta) {
page = MathHelper.clamp(page, 0, getTotalPage());
@@ -309,20 +306,22 @@ public class ContainerScreenOverlay extends Widget {
});
buttonLeft.enabled = buttonRight.enabled = getTotalPage() > 0;
}
- if (ScreenHelper.searchField == null)
+ if (ScreenHelper.getSearchField() == null) {
+ //noinspection deprecation
ScreenHelper.setSearchField(new OverlaySearchField(0, 0, 0, 0));
- ScreenHelper.searchField.getBounds().setBounds(getTextFieldArea());
- this.widgets.add(ScreenHelper.searchField);
- ScreenHelper.searchField.setText(searchTerm);
- ScreenHelper.searchField.setChangedListener(s -> {
+ }
+ ScreenHelper.getSearchField().getBounds().setBounds(getTextFieldArea());
+ this.widgets.add(ScreenHelper.getSearchField());
+ ScreenHelper.getSearchField().setText(searchTerm);
+ ScreenHelper.getSearchField().setChangedListener(s -> {
searchTerm = s;
entryListWidget.updateList(boundsHandler, boundsHandler.getItemListArea(rectangle), page, searchTerm, true);
});
- if (RoughlyEnoughItemsCore.getConfigManager().getConfig().isCraftableFilterEnabled())
+ if (ConfigManager.getInstance().getConfig().isCraftableFilterEnabled())
this.widgets.add(toggleButtonWidget = new CraftableToggleButtonWidget(getCraftableToggleArea()) {
@Override
public void onPressed() {
- RoughlyEnoughItemsCore.getConfigManager().toggleCraftableOnly();
+ ConfigManager.getInstance().toggleCraftableOnly();
entryListWidget.updateList(boundsHandler, boundsHandler.getItemListArea(rectangle), page, searchTerm, true);
}
@@ -392,8 +391,8 @@ public class ContainerScreenOverlay extends Widget {
}
private Rectangle getTextFieldArea() {
- int widthRemoved = RoughlyEnoughItemsCore.getConfigManager().getConfig().isCraftableFilterEnabled() ? 22 : 2;
- SearchFieldLocation searchFieldLocation = RoughlyEnoughItemsCore.getConfigManager().getConfig().getSearchFieldLocation();
+ int widthRemoved = ConfigManager.getInstance().getConfig().isCraftableFilterEnabled() ? 22 : 2;
+ SearchFieldLocation searchFieldLocation = ConfigManager.getInstance().getConfig().getSearchFieldLocation();
if (searchFieldLocation == SearchFieldLocation.BOTTOM_SIDE)
return new Rectangle(rectangle.x + 2, window.getScaledHeight(