diff options
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.java | 84 |
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) |
