From 9ea4a22e9a194fd8fdc2fb03226ab38ee175a6cc Mon Sep 17 00:00:00 2001 From: shedaniel Date: Mon, 26 Oct 2020 10:49:27 +0800 Subject: Favorites Dragging Signed-off-by: shedaniel --- .../src/main/java/me/shedaniel/rei/impl/Internals.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/impl/Internals.java') diff --git a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/impl/Internals.java b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/impl/Internals.java index d8fc9fc6d..29d9ddecc 100644 --- a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/impl/Internals.java +++ b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/impl/Internals.java @@ -23,9 +23,12 @@ 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.favorites.FavoriteEntry; +import me.shedaniel.rei.api.favorites.FavoriteEntryType; import me.shedaniel.rei.api.fluid.FluidSupportProvider; import me.shedaniel.rei.api.fractions.Fraction; import me.shedaniel.rei.api.subsets.SubsetsRegistry; @@ -61,6 +64,9 @@ public final class Internals { 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 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 BiFunction<@Nullable Point, Collection, Tooltip> tooltipProvider = (point, texts) -> throwNotSetup(); private static Supplier builtinPlugin = Internals::throwNotSetup; @@ -125,6 +131,10 @@ public final class Internals { return viewSearchBuilder.get(); } + public static FavoriteEntryType.Registry getFavoriteEntryTypeRegistry() { + return favoriteEntryTypeRegistry.get(); + } + @NotNull public static ClickAreaHandler.Result createClickAreaHandlerResult(boolean applicable) { return clickAreaHandlerResult.apply(applicable); @@ -161,6 +171,14 @@ public final class Internals { } } + public static FavoriteEntry delegateFavoriteEntry(Supplier supplier, Supplier toJoin) { + return delegateFavoriteEntry.apply(supplier, toJoin); + } + + public static FavoriteEntry favoriteEntryFromJson(JsonObject object) { + return favoriteEntryFromJson.apply(object); + } + public interface EntryStackProvider { EntryStack empty(); -- cgit