diff options
| author | shedaniel <daniel@shedaniel.me> | 2021-02-21 22:33:45 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2021-02-21 22:33:45 +0800 |
| commit | a56baa875630ffac06e421a7389854b5301ed7f0 (patch) | |
| tree | 9469ff3f61f2aca622d6f86dbe8044769198e639 /api | |
| parent | 5eae235995583e378a884a14118095c1fda08fab (diff) | |
| download | RoughlyEnoughItems-a56baa875630ffac06e421a7389854b5301ed7f0.tar.gz RoughlyEnoughItems-a56baa875630ffac06e421a7389854b5301ed7f0.tar.bz2 RoughlyEnoughItems-a56baa875630ffac06e421a7389854b5301ed7f0.zip | |
More
Signed-off-by: shedaniel <daniel@shedaniel.me>
Diffstat (limited to 'api')
26 files changed, 461 insertions, 454 deletions
diff --git a/api/src/main/java/me/shedaniel/rei/api/ButtonAreaSupplier.java b/api/src/main/java/me/shedaniel/rei/api/ButtonAreaSupplier.java index 64e4b27e8..65116400e 100644 --- a/api/src/main/java/me/shedaniel/rei/api/ButtonAreaSupplier.java +++ b/api/src/main/java/me/shedaniel/rei/api/ButtonAreaSupplier.java @@ -28,7 +28,11 @@ import me.shedaniel.math.Rectangle; /** * The supplier for the + button area. */ +@FunctionalInterface public interface ButtonAreaSupplier { + static ButtonAreaSupplier defaultArea() { + return bounds -> new Rectangle(bounds.getMaxX() - 16, bounds.getMaxY() - 16, 10, 10); + } /** * Declares the button bounds diff --git a/api/src/main/java/me/shedaniel/rei/api/ClientHelper.java b/api/src/main/java/me/shedaniel/rei/api/ClientHelper.java index c1ff48e21..00cbb338b 100644 --- a/api/src/main/java/me/shedaniel/rei/api/ClientHelper.java +++ b/api/src/main/java/me/shedaniel/rei/api/ClientHelper.java @@ -24,10 +24,12 @@ package me.shedaniel.rei.api; import me.shedaniel.rei.api.ingredient.EntryStack; +import me.shedaniel.rei.api.registry.CategoryRegistry; import me.shedaniel.rei.api.registry.display.Display; import me.shedaniel.rei.api.registry.display.DisplayCategory; import me.shedaniel.rei.api.util.CollectionUtils; import me.shedaniel.rei.api.util.FormattingUtils; +import me.shedaniel.rei.api.util.Identifiable; import me.shedaniel.rei.impl.Internals; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -183,7 +185,7 @@ public interface ClientHelper { ViewSearchBuilder addCategories(Collection<ResourceLocation> categories); default ViewSearchBuilder addAllCategories() { - return addCategories(CollectionUtils.map(RecipeRegistry.getInstance().getAllCategories(), DisplayCategory::getIdentifier)); + return addCategories(CollectionUtils.map(CategoryRegistry.getInstance(), Identifiable::getIdentifier)); } @NotNull Set<ResourceLocation> getCategories(); diff --git a/api/src/main/java/me/shedaniel/rei/api/DisplayRegistry.java b/api/src/main/java/me/shedaniel/rei/api/DisplayRegistry.java new file mode 100644 index 000000000..59879c891 --- /dev/null +++ b/api/src/main/java/me/shedaniel/rei/api/DisplayRegistry.java @@ -0,0 +1,92 @@ +/* + * This file is licensed under the MIT License, part of Roughly Enough Items. + * Copyright (c) 2018, 2019, 2020 shedaniel + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package me.shedaniel.rei.api; + +import me.shedaniel.rei.api.registry.RecipeManagerContext; +import me.shedaniel.rei.api.registry.Reloadable; +import me.shedaniel.rei.api.registry.display.Display; +import me.shedaniel.rei.impl.Internals; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.crafting.Recipe; +import org.jetbrains.annotations.NotNull; + +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.function.Predicate; + +@Environment(EnvType.CLIENT) +public interface DisplayRegistry extends RecipeManagerContext, Reloadable { + /** + * @return the instance of {@link DisplayRegistry} + */ + @NotNull + static DisplayRegistry getInstance() { + return Internals.getDisplayRegistry(); + } + + /** + * Gets the total display count registered + * + * @return the recipe count + */ + int getDisplayCount(); + + /** + * Registers a recipe display. + * + * @param display the recipe display + */ + void registerDisplay(Display display); + + /** + * Gets the map of all recipes visible to the player + * + * @return the map of recipes + */ + Map<ResourceLocation, List<Display>> getAllRecipes(); + + /** + * Registers a live display generator. + * + * @param categoryId the identifier of the category + * @param generator the generator to register + */ + void registerLiveDisplayGenerator(ResourceLocation categoryId, LiveDisplayGenerator<?> generator); + + /** + * Registers a display visibility handler. + * + * @param visibilityHandler the handler to be registered + */ + void registerRecipeVisibilityHandler(DisplayVisibilityHandler visibilityHandler); + + default <T extends Recipe<?>> void registerRecipes(ResourceLocation category, Class<T> recipeClass, Function<T, Display> mappingFunction) { + registerRecipes(category, recipe -> recipeClass.isAssignableFrom(recipe.getClass()), mappingFunction); + } + + <T extends Recipe<?>> void registerRecipes(ResourceLocation category, Predicate<? extends T> recipeFilter, Function<T, Display> mappingFunction); +} diff --git a/api/src/main/java/me/shedaniel/rei/api/LiveRecipeGenerator.java b/api/src/main/java/me/shedaniel/rei/api/LiveDisplayGenerator.java index 8549b95b7..ca5098a8c 100644 --- a/api/src/main/java/me/shedaniel/rei/api/LiveRecipeGenerator.java +++ b/api/src/main/java/me/shedaniel/rei/api/LiveDisplayGenerator.java @@ -30,13 +30,7 @@ import net.minecraft.resources.ResourceLocation; import java.util.List; import java.util.Optional; -public interface LiveRecipeGenerator<T extends Display> { - - /** - * @return the identifier of the category the recipes goes to. - */ - ResourceLocation getCategoryIdentifier(); - +public interface LiveDisplayGenerator<T extends Display> { default Optional<List<T>> getRecipeFor(EntryStack<?> entry) { return Optional.empty(); } @@ -48,5 +42,4 @@ public interface LiveRecipeGenerator<T extends Display> { default Optional<List<T>> getDisplaysGenerated(ClientHelper.ViewSearchBuilder builder) { return Optional.empty(); } - } diff --git a/api/src/main/java/me/shedaniel/rei/api/REIPlugin.java b/api/src/main/java/me/shedaniel/rei/api/REIPluginEntry.java index a7249f647..dc9f05c24 100644 --- a/api/src/main/java/me/shedaniel/rei/api/REIPlugin.java +++ b/api/src/main/java/me/shedaniel/rei/api/REIPluginEntry.java @@ -28,7 +28,7 @@ import org.jetbrains.annotations.NotNull; /** * Get base class of a REI plugin. */ -public interface REIPlugin extends Comparable<REIPlugin> { +public interface REIPluginEntry extends Comparable<REIPluginEntry> { /** * @return the priority of the plugin, the smaller the number, the earlier it is called. */ @@ -37,13 +37,13 @@ public interface REIPlugin extends Comparable<REIPlugin> { } default String getPluginName() { - Class<? extends REIPlugin> self = getClass(); + Class<? extends REIPluginEntry> self = getClass(); String simpleName = self.getSimpleName(); return simpleName == null ? self.getName() : simpleName; } @Override - default int compareTo(@NotNull REIPlugin o) { + default int compareTo(@NotNull REIPluginEntry o) { return Double.compare(getPriority(), o.getPriority()); } } diff --git a/api/src/main/java/me/shedaniel/rei/api/RecipeRegistry.java b/api/src/main/java/me/shedaniel/rei/api/RecipeRegistry.java deleted file mode 100644 index 50bcd8016..000000000 --- a/api/src/main/java/me/shedaniel/rei/api/RecipeRegistry.java +++ /dev/null @@ -1,266 +0,0 @@ -/* - * This file is licensed under the MIT License, part of Roughly Enough Items. - * Copyright (c) 2018, 2019, 2020 shedaniel - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package me.shedaniel.rei.api; - -import me.shedaniel.math.Rectangle; -import me.shedaniel.rei.api.ingredient.EntryStack; -import me.shedaniel.rei.api.registry.display.Display; -import me.shedaniel.rei.api.registry.display.DisplayCategory; -import me.shedaniel.rei.impl.Internals; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.gui.screens.Screen; -import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.crafting.Recipe; -import net.minecraft.world.item.crafting.RecipeManager; -import org.jetbrains.annotations.ApiStatus; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.function.Function; -import java.util.function.Predicate; - -@Environment(EnvType.CLIENT) -public interface RecipeRegistry { - - /** - * @return the instance of {@link RecipeRegistry} - */ - @NotNull - static RecipeRegistry getInstance() { - return Internals.getRecipeHelper(); - } - - AutoTransferHandler registerAutoCraftingHandler(AutoTransferHandler handler); - - void registerFocusedStackProvider(FocusedStackProvider provider); - - @Nullable - @ApiStatus.Internal - EntryStack<?> getScreenFocusedStack(Screen screen); - - List<AutoTransferHandler> getSortedAutoCraftingHandler(); - - /** - * Gets the total recipe count registered - * - * @return the recipe count - */ - int getRecipeCount(); - - /** - * @return a list of sorted recipes - */ - List<Recipe<?>> getAllSortedRecipes(); - - /** - * Gets all craftable items from materials. - * - * @param inventoryItems the materials - * @return the list of craftable entries - */ - List<EntryStack<?>> findCraftableEntriesByItems(Iterable<? extends EntryStack<?>> inventoryItems); - - /** - * Gets all craftable items from materials. - * - * @param inventoryItems the materials - * @return the list of craftable entries - */ - default List<EntryStack<?>> findCraftableEntriesByItems(List<? extends EntryStack<?>> inventoryItems) { - return findCraftableEntriesByItems((Iterable<? extends EntryStack<?>>) inventoryItems); - } - - /** - * Registers a recipe display. - * - * @param display the recipe display - */ - void registerDisplay(Display display); - - Map<DisplayCategory<?>, List<Display>> buildMapFor(ClientHelper.ViewSearchBuilder builder); - - /** - * Gets a map of recipes for an entry - * - * @param stack the stack to be crafted - * @return the map of recipes - */ - Map<DisplayCategory<?>, List<Display>> getRecipesFor(EntryStack<?> stack); - - DisplayCategory<?> getCategory(ResourceLocation identifier); - - /** - * Gets the vanilla recipe manager - * - * @return the recipe manager - */ - RecipeManager getRecipeManager(); - - /** - * Gets all registered categories - * - * @return the list of categories - */ - List<DisplayCategory<?>> getAllCategories(); - - /** - * Gets a map of usages for an entry - * - * @param stack the stack to be used - * @return the map of recipes - */ - Map<DisplayCategory<?>, List<Display>> getUsagesFor(EntryStack<?> stack); - - /** - * Gets the optional of the auto crafting button area from a category - * - * @param category the category of the display - * @return the optional of auto crafting button area - */ - Optional<ButtonAreaSupplier> getAutoCraftButtonArea(DisplayCategory<?> category); - - /** - * Registers a auto crafting button area - * - * @param category the category of the button area - * @param rectangle the button area - */ - void registerAutoCraftButtonArea(ResourceLocation category, ButtonAreaSupplier rectangle); - - /** - * Removes the auto crafting button - * - * @param category the category of the button - */ - default void removeAutoCraftButton(ResourceLocation category) { - registerAutoCraftButtonArea(category, bounds -> null); - } - - /** - * Gets the map of all recipes visible to the player - * - * @return the map of recipes - */ - Map<DisplayCategory<?>, List<Display>> getAllRecipes(); - - Map<DisplayCategory<?>, List<Display>> getAllRecipesNoHandlers(); - - List<Display> getAllRecipesFromCategory(DisplayCategory<?> category); - - /** - * Registers a recipe visibility handler - * - * @param visibilityHandler the handler to be registered - */ - void registerRecipeVisibilityHandler(DisplayVisibilityHandler visibilityHandler); - - /** - * Unregisters a recipe visibility handler - * - * @param visibilityHandler the handler to be unregistered - */ - void unregisterRecipeVisibilityHandler(DisplayVisibilityHandler visibilityHandler); - - /** - * Gets an unmodifiable list of recipe visibility handlers - * - * @return the unmodifiable list of handlers - */ - List<DisplayVisibilityHandler> getDisplayVisibilityHandlers(); - - boolean isDisplayNotVisible(Display display); - - /** - * Checks if the display is visible by asking recipe visibility handlers - * - * @param display the display to be checked - * @return whether the display should be visible - */ - boolean isDisplayVisible(Display display); - - /** - * Registers a live recipe generator. - * - * @param liveRecipeGenerator the generator to register - * @apiNote Still work in progress - */ - void registerLiveRecipeGenerator(LiveRecipeGenerator<?> liveRecipeGenerator); - - /** - * Registers a click area for a container screen. - * - * @param rectangle The click area that is offset to the container screen's top left corner. - * @param screenClass The class of the screen. - * @param categories The categories of result. - * @param <T> The screen type to be registered to. - */ - default <T extends AbstractContainerScreen<?>> void registerContainerClickArea(Rectangle rectangle, Class<T> screenClass, ResourceLocation... categories) { - registerContainerClickArea(screen -> rectangle, screenClass, categories); - } - - /** - * Registers a click area for a container screen. - * - * @param rectangleSupplier The click area supplier that is offset to the container screen's top left corner. - * @param screenClass The class of the screen. - * @param categories The categories of result. - * @param <T> The screen type to be registered to. - */ - <T extends AbstractContainerScreen<?>> void registerContainerClickArea(ScreenClickAreaProvider<T> rectangleSupplier, Class<T> screenClass, ResourceLocation... categories); - - /** - * Registers a click area for a screen. - * - * @param rectangleSupplier The click area supplier that is offset to the window's top left corner. - * @param screenClass The class of the screen. - * @param categories The categories of result. - * @param <T> The screen type to be registered to. - */ - <T extends Screen> void registerClickArea(ScreenClickAreaProvider<T> rectangleSupplier, Class<T> screenClass, ResourceLocation... categories); - - /** - * Registers a click area handler for a screen. A handler allows more specific implementation of click areas. - * - * @param screenClass The class of the screen. - * @param handler The click area handler that is offset to the window's top left corner. - * @param <T> The screen type to be registered to. - * @see #registerClickArea(ScreenClickAreaProvider, Class, ResourceLocation...) for a simpler way to handle areas without custom categories. - */ - <T extends Screen> void registerClickArea(Class<T> screenClass, ClickAreaHandler<T> handler); - - default <T extends Recipe<?>> void registerRecipes(ResourceLocation category, Class<T> recipeClass, Function<T, Display> mappingFunction) { - registerRecipes(category, recipe -> recipeClass.isAssignableFrom(recipe.getClass()), mappingFunction); - } - - <T extends Recipe<?>> void registerRecipes(ResourceLocation category, Predicate<Recipe<?>> recipeFilter, Function<T, Display> mappingFunction); - - @ApiStatus.Internal - boolean arePluginsLoading(); -} - diff --git a/api/src/main/java/me/shedaniel/rei/api/ingredient/entry/AbstractRenderer.java b/api/src/main/java/me/shedaniel/rei/api/gui/AbstractRenderer.java index 75a52d696..b4ffb75c5 100644 --- a/api/src/main/java/me/shedaniel/rei/api/ingredient/entry/AbstractRenderer.java +++ b/api/src/main/java/me/shedaniel/rei/api/gui/AbstractRenderer.java @@ -21,7 +21,7 @@ * SOFTWARE. */ -package me.shedaniel.rei.api.ingredient.entry; +package me.shedaniel.rei.api.gui; import me.shedaniel.rei.api.gui.Renderer; import net.minecraft.client.gui.GuiComponent; diff --git a/api/src/main/java/me/shedaniel/rei/api/gui/DisplayRenderer.java b/api/src/main/java/me/shedaniel/rei/api/gui/DisplayRenderer.java index 281d79a18..1b177e84b 100644 --- a/api/src/main/java/me/shedaniel/rei/api/gui/DisplayRenderer.java +++ b/api/src/main/java/me/shedaniel/rei/api/gui/DisplayRenderer.java @@ -24,7 +24,6 @@ package me.shedaniel.rei.api.gui; import me.shedaniel.math.Point; -import me.shedaniel.rei.api.ingredient.entry.AbstractRenderer; import me.shedaniel.rei.api.gui.widgets.Tooltip; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; diff --git a/api/src/main/java/me/shedaniel/rei/api/gui/widgets/Widget.java b/api/src/main/java/me/shedaniel/rei/api/gui/widgets/Widget.java index ab55936a3..abe4454ae 100644 --- a/api/src/main/java/me/shedaniel/rei/api/gui/widgets/Widget.java +++ b/api/src/main/java/me/shedaniel/rei/api/gui/widgets/Widget.java @@ -23,7 +23,10 @@ package me.shedaniel.rei.api.gui.widgets; +import com.mojang.blaze3d.vertex.PoseStack; import me.shedaniel.math.Point; +import me.shedaniel.math.Rectangle; +import me.shedaniel.rei.api.gui.Renderer; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; import net.minecraft.client.gui.components.events.AbstractContainerEventHandler; @@ -33,7 +36,7 @@ import net.minecraft.client.gui.components.events.AbstractContainerEventHandler; * * @see WidgetWithBounds for a widget with bounds */ -public abstract class Widget extends AbstractContainerEventHandler implements net.minecraft.client.gui.components.Widget { +public abstract class Widget extends AbstractContainerEventHandler implements net.minecraft.client.gui.components.Widget, Renderer { /** * The Minecraft Client instance @@ -71,4 +74,8 @@ public abstract class Widget extends AbstractContainerEventHandler implements ne return containsMouse(double_1, double_2); } + @Override + public void render(PoseStack matrices, Rectangle bounds, int mouseX, int mouseY, float delta) { + render(matrices, mouseX, mouseY, delta); + } } diff --git a/api/src/main/java/me/shedaniel/rei/api/gui/widgets/Widgets.java b/api/src/main/java/me/shedaniel/rei/api/gui/widgets/Widgets.java index 1bacf4d68..614c5f4ec 100644 --- a/api/src/main/java/me/shedaniel/rei/api/gui/widgets/Widgets.java +++ b/api/src/main/java/me/shedaniel/rei/api/gui/widgets/Widgets.java @@ -29,6 +29,7 @@ import me.shedaniel.math.Point; import me.shedaniel.math.Rectangle; import me.shedaniel.rei.api.ConfigObject; import me.shedaniel.rei.api.gui.DrawableConsumer; +import me.shedaniel.rei.api.gui.Renderer; import me.shedaniel.rei.impl.Internals; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -52,12 +53,15 @@ public final class Widgets { private Widgets() {} @NotNull - public static Widget createDrawableWidget(@NotNull DrawableConsumer drawable) { + public static Widget createDrawableWidget(DrawableConsumer drawable) { return Internals.getWidgetsProvider().createDrawableWidget(drawable); } @NotNull - public static Widget wrapVanillaWidget(@NotNull GuiEventListener element) { + public static Widget wrapVanillaWidget(GuiEventListener element) { + Widgets.createDrawableWidget((helper, matrices, mouseX, mouseY, delta) -> { + + }); return new VanillaWrappedWidget(element); } @@ -83,6 +87,38 @@ public final class Widgets { } @NotNull + public static WidgetWithBounds wrapRenderer(Rectangle bounds, Renderer renderer) { + return new RendererWrappedWidget(renderer); + } + + private static class RendererWrappedWidget extends WidgetWithBounds { + private Renderer renderer; + private Rectangle bounds; + + public RendererWrappedWidget(Renderer renderer) { + this.renderer = Objects.requireNonNull(renderer); + } + + @Override + public void render(PoseStack matrices, int mouseX, int mouseY, float delta) { + renderer.render(matrices, getBounds(), mouseX, mouseY, delta); + } + + @Override + public List<? extends GuiEventListener> children() { + if (renderer instanceof GuiEventListener) + return Collections.singletonList((GuiEventListener) renderer); + return Collections.emptyList(); + } + + @NotNull + @Override + public Rectangle getBounds() { + return bounds; + } + } + + @NotNull public static Widget createTexturedWidget(@NotNull ResourceLocation identifier, @NotNull Rectangle bounds) { return createTexturedWidget(identifier, bounds, 0, 0); } @@ -159,12 +195,9 @@ public final class Widgets { @NotNull public static Panel createRecipeBase(@NotNull Rectangle rectangle) { - return Internals.getWidgetsProvider().createPanelWidget(rectangle).yTextureOffset(ConfigObject.getInstance().getRecipeBorderType().getYOffset()).rendering(Widgets::shouldRecipeBaseRender); - } - - @NotNull - public static Panel createCategoryBase(@NotNull Rectangle rectangle) { - return Internals.getWidgetsProvider().createPanelWidget(rectangle).rendering(Widgets::shouldSlotBaseRender); + return Internals.getWidgetsProvider().createPanelWidget(rectangle) + .yTextureOffset(ConfigObject.getInstance().getRecipeBorderType().getYOffset()) + .rendering(Widgets::shouldRecipeBaseRender); } private static boolean shouldRecipeBaseRender(@NotNull Panel panel) { @@ -172,6 +205,11 @@ public final class Widgets { } @NotNull + public static Panel createCategoryBase(@NotNull Rectangle rectangle) { + return Internals.getWidgetsProvider().createPanelWidget(rectangle); + } + + @NotNull public static Panel createRecipeBase(@NotNull Rectangle rectangle, int color) { return createRecipeBase(rectangle).color(color); } diff --git a/api/src/main/java/me/shedaniel/rei/api/plugins/REIPluginV0.java b/api/src/main/java/me/shedaniel/rei/api/plugins/REIPlugin.java index 143490b37..1ad633834 100644 --- a/api/src/main/java/me/shedaniel/rei/api/plugins/REIPluginV0.java +++ b/api/src/main/java/me/shedaniel/rei/api/plugins/REIPlugin.java @@ -23,16 +23,34 @@ package me.shedaniel.rei.api.plugins; -import me.shedaniel.rei.api.DisplayBoundsRegistry; -import me.shedaniel.rei.api.EntryRegistry; -import me.shedaniel.rei.api.REIPlugin; -import me.shedaniel.rei.api.RecipeRegistry; +import me.shedaniel.rei.api.registry.screens.ScreenRegistry; +import me.shedaniel.rei.api.DisplayRegistry; +import me.shedaniel.rei.api.registry.EntryRegistry; import me.shedaniel.rei.api.ingredient.entry.EntryTypeRegistry; import me.shedaniel.rei.api.registry.CategoryRegistry; import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; @ApiStatus.OverrideOnly -public interface REIPluginV0 extends REIPlugin { |
