From 542eb5154ebce387312ca3691f743b89e4aef99e Mon Sep 17 00:00:00 2001 From: shedaniel Date: Sat, 27 Feb 2021 17:14:08 +0800 Subject: Remove depending on Cloth API, switching to architectury Signed-off-by: shedaniel --- .../main/java/me/shedaniel/rei/impl/Internals.java | 84 ++++++---------------- 1 file changed, 23 insertions(+), 61 deletions(-) (limited to 'api/src/main/java/me/shedaniel/rei/impl/Internals.java') 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 = Internals::throwNotSetup; private static Supplier clientHelper = Internals::throwNotSetup; - private static Supplier displayRegistry = Internals::throwNotSetup; private static Supplier reiHelper = Internals::throwNotSetup; - private static Supplier fluidSupportProvider = Internals::throwNotSetup; private static Supplier entryStackProvider = Internals::throwNotSetup; private static Supplier entryIngredientProvider = Internals::throwNotSetup; - private static Supplier subsetsRegistry = Internals::throwNotSetup; - private static Supplier entryRegistry = Internals::throwNotSetup; - private static Supplier categoryRegistry = Internals::throwNotSetup; - private static Supplier displayHelper = Internals::throwNotSetup; private static Supplier widgetsProvider = Internals::throwNotSetup; - private static Supplier viewSearchBuilder = Internals::throwNotSetup; - private static Supplier favoriteEntryTypeRegistry = Internals::throwNotSetup; - private static Supplier entryTypeRegistry = Internals::throwNotSetup; + private static Supplier viewSearchBuilder = Internals::throwNotSetup; private static Function> entryTypeDeferred = (object) -> throwNotSetup(); + private static Supplier views = Internals::throwNotSetup; + private static Supplier pluginManager = Internals::throwNotSetup; private static BiFunction, Supplier, FavoriteEntry> delegateFavoriteEntry = (supplier, toJson) -> throwNotSetup(); private static Function 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, Tooltip> tooltipProvider = (point, texts) -> throwNotSetup(); private static Supplier 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 empty(); @@ -206,11 +168,11 @@ public final class Internals { public interface EntryIngredientProvider { EntryIngredient empty(); - EntryIngredient of(EntryStack stack); + EntryIngredient of(EntryStack stack); - EntryIngredient of(EntryStack... stacks); + EntryIngredient of(EntryStack... stacks); - EntryIngredient of(Iterable> stacks); + EntryIngredient of(Iterable> stacks); } @Environment(EnvType.CLIENT) -- cgit