aboutsummaryrefslogtreecommitdiff
path: root/api/src/main/java/me/shedaniel/rei/impl/Internals.java
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2021-02-27 17:14:08 +0800
committershedaniel <daniel@shedaniel.me>2021-02-27 17:15:02 +0800
commit542eb5154ebce387312ca3691f743b89e4aef99e (patch)
tree48583bad05514d9a1a8d0ab3499af0d39f3fd1e5 /api/src/main/java/me/shedaniel/rei/impl/Internals.java
parent9c570a0e71a6e209e0d234a99f35bd24efc18d7d (diff)
downloadRoughlyEnoughItems-542eb5154ebce387312ca3691f743b89e4aef99e.tar.gz
RoughlyEnoughItems-542eb5154ebce387312ca3691f743b89e4aef99e.tar.bz2
RoughlyEnoughItems-542eb5154ebce387312ca3691f743b89e4aef99e.zip
Remove depending on Cloth API, switching to architectury
Signed-off-by: shedaniel <daniel@shedaniel.me>
Diffstat (limited to 'api/src/main/java/me/shedaniel/rei/impl/Internals.java')
-rw-r--r--api/src/main/java/me/shedaniel/rei/impl/Internals.java84
1 files changed, 23 insertions, 61 deletions
diff --git a/api/src/main/java/me/shedaniel/rei/impl/Internals.java b/api/src/main/java/me/shedaniel/rei/impl/Internals.java
index 1157267bb..f8763f46c 100644
--- a/api/src/main/java/me/shedaniel/rei/impl/Internals.java
+++ b/api/src/main/java/me/shedaniel/rei/impl/Internals.java
@@ -26,10 +26,9 @@ package me.shedaniel.rei.impl;
import com.google.gson.JsonObject;
import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle;
-import me.shedaniel.rei.api.*;
+import me.shedaniel.rei.api.ClientHelper;
+import me.shedaniel.rei.api.REIHelper;
import me.shedaniel.rei.api.favorites.FavoriteEntry;
-import me.shedaniel.rei.api.favorites.FavoriteEntryType;
-import me.shedaniel.rei.api.fluid.FluidSupportProvider;
import me.shedaniel.rei.api.gui.DrawableConsumer;
import me.shedaniel.rei.api.gui.Renderer;
import me.shedaniel.rei.api.gui.widgets.*;
@@ -37,12 +36,11 @@ import me.shedaniel.rei.api.ingredient.EntryIngredient;
import me.shedaniel.rei.api.ingredient.EntryStack;
import me.shedaniel.rei.api.ingredient.entry.EntryDefinition;
import me.shedaniel.rei.api.ingredient.entry.EntryType;
-import me.shedaniel.rei.api.ingredient.entry.EntryTypeRegistry;
import me.shedaniel.rei.api.plugins.BuiltinPlugin;
-import me.shedaniel.rei.api.registry.CategoryRegistry;
-import me.shedaniel.rei.api.registry.EntryRegistry;
-import me.shedaniel.rei.api.registry.screens.ScreenRegistry;
-import me.shedaniel.rei.api.subsets.SubsetsRegistry;
+import me.shedaniel.rei.api.plugins.PluginManager;
+import me.shedaniel.rei.api.registry.screen.ClickArea;
+import me.shedaniel.rei.api.view.ViewSearchBuilder;
+import me.shedaniel.rei.api.view.Views;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.network.chat.Component;
@@ -61,25 +59,18 @@ import java.util.function.Supplier;
@ApiStatus.Internal
public final class Internals {
- private static Supplier<ConfigManager> configManager = Internals::throwNotSetup;
private static Supplier<ClientHelper> clientHelper = Internals::throwNotSetup;
- private static Supplier<DisplayRegistry> displayRegistry = Internals::throwNotSetup;
private static Supplier<REIHelper> reiHelper = Internals::throwNotSetup;
- private static Supplier<FluidSupportProvider> fluidSupportProvider = Internals::throwNotSetup;
private static Supplier<EntryStackProvider> entryStackProvider = Internals::throwNotSetup;
private static Supplier<EntryIngredientProvider> entryIngredientProvider = Internals::throwNotSetup;
- private static Supplier<SubsetsRegistry> subsetsRegistry = Internals::throwNotSetup;
- private static Supplier<EntryRegistry> entryRegistry = Internals::throwNotSetup;
- private static Supplier<CategoryRegistry> categoryRegistry = Internals::throwNotSetup;
- private static Supplier<ScreenRegistry> displayHelper = Internals::throwNotSetup;
private static Supplier<WidgetsProvider> widgetsProvider = Internals::throwNotSetup;
- private static Supplier<ClientHelper.ViewSearchBuilder> viewSearchBuilder = Internals::throwNotSetup;
- private static Supplier<FavoriteEntryType.Registry> favoriteEntryTypeRegistry = Internals::throwNotSetup;
- private static Supplier<EntryTypeRegistry> entryTypeRegistry = Internals::throwNotSetup;
+ private static Supplier<ViewSearchBuilder> viewSearchBuilder = Internals::throwNotSetup;
private static Function<ResourceLocation, EntryType<?>> entryTypeDeferred = (object) -> throwNotSetup();
+ private static Supplier<Views> views = Internals::throwNotSetup;
+ private static Supplier<PluginManager> pluginManager = Internals::throwNotSetup;
private static BiFunction<Supplier<FavoriteEntry>, Supplier<JsonObject>, FavoriteEntry> delegateFavoriteEntry = (supplier, toJson) -> throwNotSetup();
private static Function<JsonObject, FavoriteEntry> favoriteEntryFromJson = (object) -> throwNotSetup();
- private static Function<@NotNull Boolean, ClickAreaHandler.Result> clickAreaHandlerResult = (result) -> throwNotSetup();
+ private static Function<@NotNull Boolean, ClickArea.Result> clickAreaHandlerResult = (result) -> throwNotSetup();
private static BiFunction<@Nullable Point, Collection<Component>, Tooltip> tooltipProvider = (point, texts) -> throwNotSetup();
private static Supplier<BuiltinPlugin> builtinPlugin = Internals::throwNotSetup;
@@ -87,27 +78,14 @@ public final class Internals {
throw new AssertionError("REI Internals have not been initialized!");
}
- public static ConfigManager getConfigManager() {
- return configManager.get();
- }
-
public static ClientHelper getClientHelper() {
return clientHelper.get();
}
- public static DisplayRegistry getDisplayRegistry() {
- return displayRegistry.get();
- }
-
public static REIHelper getREIHelper() {
return reiHelper.get();
}
- @ApiStatus.Experimental
- public static FluidSupportProvider getFluidSupportProvider() {
- return fluidSupportProvider.get();
- }
-
public static EntryStackProvider getEntryStackProvider() {
return entryStackProvider.get();
}
@@ -116,35 +94,15 @@ public final class Internals {
return entryIngredientProvider.get();
}
- public static SubsetsRegistry getSubsetsRegistry() {
- return subsetsRegistry.get();
- }
-
- public static EntryRegistry getEntryRegistry() {
- return entryRegistry.get();
- }
-
- public static CategoryRegistry getCategoryRegistry() {
- return categoryRegistry.get();
- }
-
- public static ScreenRegistry getDisplayHelper() {
- return displayHelper.get();
- }
-
public static WidgetsProvider getWidgetsProvider() {
return widgetsProvider.get();
}
- public static ClientHelper.ViewSearchBuilder createViewSearchBuilder() {
+ public static ViewSearchBuilder createViewSearchBuilder() {
return viewSearchBuilder.get();
}
- public static FavoriteEntryType.Registry getFavoriteEntryTypeRegistry() {
- return favoriteEntryTypeRegistry.get();
- }
-
- public static ClickAreaHandler.Result createClickAreaHandlerResult(boolean applicable) {
+ public static ClickArea.Result createClickAreaHandlerResult(boolean applicable) {
return clickAreaHandlerResult.apply(applicable);
}
@@ -185,14 +143,18 @@ public final class Internals {
return favoriteEntryFromJson.apply(object);
}
- public static EntryTypeRegistry getEntryTypeRegistry() {
- return entryTypeRegistry.get();
- }
-
public static EntryType<?> deferEntryType(ResourceLocation id) {
return entryTypeDeferred.apply(id);
}
+ public static Views getViews() {
+ return views.get();
+ }
+
+ public static PluginManager getPluginManager() {
+ return pluginManager.get();
+ }
+
public interface EntryStackProvider {
EntryStack<Unit> empty();
@@ -206,11 +168,11 @@ public final class Internals {
public interface EntryIngredientProvider {
EntryIngredient empty();
- <T> EntryIngredient of(EntryStack<T> stack);
+ EntryIngredient of(EntryStack<?> stack);
- <T> EntryIngredient of(EntryStack<T>... stacks);
+ EntryIngredient of(EntryStack<?>... stacks);
- <T> EntryIngredient of(Iterable<EntryStack<T>> stacks);
+ EntryIngredient of(Iterable<EntryStack<?>> stacks);
}
@Environment(EnvType.CLIENT)