From 90b8a8181eb7e642fb88832f8bd8baa3acdcf804 Mon Sep 17 00:00:00 2001 From: shedaniel Date: Fri, 11 Dec 2020 20:24:47 +0800 Subject: Remove deprecated classes Signed-off-by: shedaniel --- .../me/shedaniel/rei/api/AutoTransferHandler.java | 27 +-- .../java/me/shedaniel/rei/api/ClientHelper.java | 80 +------- .../java/me/shedaniel/rei/api/ConfigObject.java | 31 --- .../java/me/shedaniel/rei/api/DisplayHelper.java | 126 ------------ .../java/me/shedaniel/rei/api/EntryRegistry.java | 33 --- .../main/java/me/shedaniel/rei/api/EntryStack.java | 55 ----- .../main/java/me/shedaniel/rei/api/REIHelper.java | 14 -- .../java/me/shedaniel/rei/api/REIPluginEntry.java | 14 -- .../java/me/shedaniel/rei/api/RecipeDisplay.java | 17 +- .../java/me/shedaniel/rei/api/RecipeHelper.java | 42 ---- .../main/java/me/shedaniel/rei/api/TextTest.java | 39 ---- .../rei/api/fluid/FluidSupportProvider.java | 59 ------ .../shedaniel/rei/api/subsets/SubsetsRegistry.java | 34 ---- .../java/me/shedaniel/rei/api/widgets/Label.java | 9 - .../java/me/shedaniel/rei/api/widgets/Panel.java | 24 --- .../rei/gui/entries/SimpleRecipeEntry.java | 13 -- .../shedaniel/rei/server/ContainerInfoHandler.java | 10 - .../me/shedaniel/rei/utils/CollectionUtils.java | 5 +- .../me/shedaniel/rei/plugin/DefaultPlugin.java | 8 +- .../DefaultBeaconPaymentCategory.java | 15 +- .../DefaultBeaconPaymentDisplay.java | 8 +- .../me/shedaniel/rei/RoughlyEnoughItemsCore.java | 2 +- .../me/shedaniel/rei/gui/RecipeViewingScreen.java | 2 +- .../me/shedaniel/rei/gui/TransformingScreen.java | 2 - .../rei/gui/VillagerRecipeViewingScreen.java | 2 +- .../rei/gui/config/entry/FilteringScreen.java | 4 +- .../me/shedaniel/rei/gui/modules/MenuEntry.java | 1 + .../rei/gui/plugin/DefaultRuntimePlugin.java | 2 - .../me/shedaniel/rei/gui/widget/ButtonWidget.java | 221 --------------------- .../rei/gui/widget/CategoryBaseWidget.java | 50 ----- .../rei/gui/widget/ClickableLabelWidget.java | 137 ------------- .../shedaniel/rei/gui/widget/EntryListWidget.java | 1 - .../me/shedaniel/rei/gui/widget/EntryWidget.java | 24 +-- .../me/shedaniel/rei/gui/widget/LabelWidget.java | 194 ------------------ .../me/shedaniel/rei/gui/widget/PanelWidget.java | 140 ------------- .../rei/gui/widget/RecipeArrowWidget.java | 86 -------- .../shedaniel/rei/gui/widget/RecipeBaseWidget.java | 60 ------ .../shedaniel/rei/gui/widget/SlotBaseWidget.java | 67 ------- .../me/shedaniel/rei/impl/ClientHelperImpl.java | 24 +-- .../me/shedaniel/rei/impl/ConfigManagerImpl.java | 5 +- .../me/shedaniel/rei/impl/ConfigObjectImpl.java | 15 -- .../me/shedaniel/rei/impl/DisplayHelperImpl.java | 52 +---- .../java/me/shedaniel/rei/impl/ScreenHelper.java | 37 +--- .../me/shedaniel/rei/impl/widgets/PanelWidget.java | 13 -- 44 files changed, 41 insertions(+), 1763 deletions(-) delete mode 100644 RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/TextTest.java delete mode 100644 RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/widget/ButtonWidget.java delete mode 100644 RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/widget/CategoryBaseWidget.java delete mode 100644 RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/widget/ClickableLabelWidget.java delete mode 100644 RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/widget/LabelWidget.java delete mode 100644 RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/widget/PanelWidget.java delete mode 100644 RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/widget/RecipeArrowWidget.java delete mode 100644 RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/widget/RecipeBaseWidget.java delete mode 100644 RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/widget/SlotBaseWidget.java diff --git a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/AutoTransferHandler.java b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/AutoTransferHandler.java index f6b9232e7..743538410 100644 --- a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/AutoTransferHandler.java +++ b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/AutoTransferHandler.java @@ -58,17 +58,6 @@ public interface AutoTransferHandler { return new ResultImpl(); } - /** - * Creates a successful result, no further handlers will be called. - * Will return to the previous screen rather than staying open. - * - * @deprecated use {@link #blocksFurtherHandling(boolean)} - */ - @Deprecated - static Result createSuccessfulReturningToScreen() { - return createSuccessful().blocksFurtherHandling(true); - } - /** * Creates a passing result, further handlers will be called. * This will also mark the handler as not applicable. @@ -185,23 +174,9 @@ public interface AutoTransferHandler { @Nullable AbstractContainerScreen getContainerScreen(); - - @Nullable - @Deprecated - @ApiStatus.ScheduledForRemoval - default AbstractContainerScreen getHandledScreen() { - return getContainerScreen(); - } RecipeDisplay getRecipe(); - - @Nullable - @Deprecated - @ApiStatus.ScheduledForRemoval - default AbstractContainerMenu getScreenHandler() { - return getContainer(); - } - + @Nullable default AbstractContainerMenu getContainer() { return getContainerScreen() == null ? null : getContainerScreen().getMenu(); diff --git a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/ClientHelper.java b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/ClientHelper.java index 797e44ecb..ddb17e63f 100644 --- a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/ClientHelper.java +++ b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/ClientHelper.java @@ -37,7 +37,6 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; -import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -71,22 +70,6 @@ public interface ClientHelper { */ void setCheating(boolean cheating); - @Deprecated - @ApiStatus.ScheduledForRemoval - List getInventoryItemsTypes(); - - /** - * Opens a recipe viewing screen: - * Opens {@link me.shedaniel.rei.gui.PreRecipeViewingScreen} if not set - * Opens {@link me.shedaniel.rei.gui.RecipeViewingScreen} if set to default - * Opens {@link me.shedaniel.rei.gui.VillagerRecipeViewingScreen} if set to villager - * - * @param map the map of recipes - */ - @ApiStatus.ScheduledForRemoval - @Deprecated - void openRecipeViewingScreen(Map, List> map); - /** * Tries to cheat stack using either packets or commands. * @@ -99,42 +82,6 @@ public interface ClientHelper { return tryCheatingEntry(EntryStack.create(stack)); } - /** - * Finds recipe for the stack and opens the recipe screen. - * - * @param stack the stack to find recipe for - * @return whether the stack has any recipes to show - */ - @Deprecated - @ApiStatus.ScheduledForRemoval - default boolean executeRecipeKeyBind(EntryStack stack) { - return openView(ViewSearchBuilder.builder().addRecipesFor(stack).setOutputNotice(stack).fillPreferredOpenedCategory()); - } - - @Deprecated - @ApiStatus.ScheduledForRemoval - default boolean executeRecipeKeyBind(ItemStack stack) { - return executeRecipeKeyBind(EntryStack.create(stack)); - } - - /** - * Finds usage for the stack and opens the recipe screen. - * - * @param stack the stack to find usage for - * @return whether the stack has any usages to show - */ - @Deprecated - @ApiStatus.ScheduledForRemoval - default boolean executeUsageKeyBind(EntryStack stack) { - return openView(ViewSearchBuilder.builder().addUsagesFor(stack).setInputNotice(stack).fillPreferredOpenedCategory()); - } - - @Deprecated - @ApiStatus.ScheduledForRemoval - default boolean executeUsageKeyBind(ItemStack stack) { - return executeUsageKeyBind(EntryStack.create(stack)); - } - /** * Gets the mod from an item * @@ -219,33 +166,10 @@ public interface ClientHelper { /** * Gets the mod from a modid * - * @param modid the modid of the mod + * @param modId the modid of the mod * @return the mod name */ - String getModFromModId(String modid); - - /** - * Finds all recipes and open them in a recipe screen. - * - * @return whether there are any recipes to show - */ - @Deprecated - @ApiStatus.ScheduledForRemoval - default boolean executeViewAllRecipesKeyBind() { - return openView(ViewSearchBuilder.builder().addAllCategories().fillPreferredOpenedCategory()); - } - - @Deprecated - @ApiStatus.ScheduledForRemoval - default boolean executeViewAllRecipesFromCategory(ResourceLocation category) { - return openView(ViewSearchBuilder.builder().addCategory(category).fillPreferredOpenedCategory()); - } - - @Deprecated - @ApiStatus.ScheduledForRemoval - default boolean executeViewAllRecipesFromCategories(List categories) { - return openView(ViewSearchBuilder.builder().addCategories(categories).fillPreferredOpenedCategory()); - } + String getModFromModId(String modId); boolean openView(ViewSearchBuilder builder); diff --git a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/ConfigObject.java b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/ConfigObject.java index 8bce78e5b..d193b1bc4 100644 --- a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/ConfigObject.java +++ b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/ConfigObject.java @@ -30,7 +30,6 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import org.jetbrains.annotations.ApiStatus; -import java.util.Collections; import java.util.List; @Environment(EnvType.CLIENT) @@ -63,10 +62,6 @@ public interface ConfigObject { boolean isToastDisplayedOnCopyIdentifier(); - @Deprecated - @ApiStatus.ScheduledForRemoval - boolean doesRenderEntryEnchantmentGlint(); - boolean isEntryListWidgetScrolled(); boolean shouldAppendModNames(); @@ -75,10 +70,6 @@ public interface ConfigObject { void setRecipeScreenType(RecipeScreenType recipeScreenType); - @Deprecated - @ApiStatus.ScheduledForRemoval - boolean isLoadingDefaultPlugin(); - SearchFieldLocation getSearchFieldLocation(); default boolean isLeftHandSidePanel() { @@ -117,22 +108,10 @@ public interface ConfigObject { boolean doDisplayFavoritesTooltip(); - @Deprecated - @ApiStatus.ScheduledForRemoval - default boolean doDisplayFavoritesOnTheLeft() { - return true; - } - boolean doesFastEntryRendering(); boolean doDebugRenderTimeRequired(); - @Deprecated - @ApiStatus.ScheduledForRemoval - default boolean doSearchFavorites() { - return false; - } - ModifierKeyCode getFavoriteKeyCode(); ModifierKeyCode getRecipeKeybind(); @@ -157,12 +136,6 @@ public interface ConfigObject { boolean isLowerConfigButton(); - @Deprecated - @ApiStatus.ScheduledForRemoval - default List getFavorites() { - return Collections.emptyList(); - } - @ApiStatus.Experimental List getFavoriteEntries(); @@ -181,10 +154,6 @@ public interface ConfigObject { boolean isInventoryHighlightingAllowed(); - @Deprecated - @ApiStatus.ScheduledForRemoval - boolean shouldResizeDynamically(); - @ApiStatus.Experimental double getHorizontalEntriesBoundaries(); diff --git a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/DisplayHelper.java b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/DisplayHelper.java index cdafd0ba2..d63896203 100644 --- a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/DisplayHelper.java +++ b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/DisplayHelper.java @@ -25,16 +25,13 @@ package me.shedaniel.rei.api; import me.shedaniel.math.Rectangle; import me.shedaniel.rei.gui.config.DisplayPanelLocation; -import me.shedaniel.rei.gui.config.SearchFieldLocation; import me.shedaniel.rei.impl.Internals; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.world.InteractionResult; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import java.util.List; -import java.util.function.Supplier; @Environment(EnvType.CLIENT) public interface DisplayHelper { @@ -47,17 +44,6 @@ public interface DisplayHelper { return Internals.getDisplayHelper(); } - /** - * Gets the sorted version of all responsible bounds handlers - * - * @param screenClass the class for checking responsible bounds handlers - * @return the sorted list of responsible bounds handlers - * @see DisplayHelper#getResponsibleBoundsHandler(Class) for the unsorted version - */ - @Deprecated - @ApiStatus.ScheduledForRemoval - List> getSortedBoundsHandlers(Class screenClass); - List getSortedOverlayDeciders(Class screenClass); /** @@ -67,17 +53,6 @@ public interface DisplayHelper { */ List getAllOverlayDeciders(); - /** - * Gets the responsible bounds handlers - * - * @param screenClass the class for checking responsible bounds handlers - * @return the the list of responsible bounds handlers - * @see DisplayHelper#getSortedBoundsHandlers(Class) for the sorted version - */ - @Deprecated - @ApiStatus.ScheduledForRemoval - DisplayBoundsHandler getResponsibleBoundsHandler(Class screenClass); - /** * Registers a bounds decider * @@ -122,105 +97,4 @@ public interface DisplayHelper { return getBaseSupportedClass().isAssignableFrom(screen); } } - - @Deprecated - @ApiStatus.ScheduledForRemoval - interface DisplayBoundsHandler extends OverlayDecider { - /** - * Gets the base supported class for the bounds handler - * - * @return the base class - */ - Class getBaseSupportedClass(); - - @Override - default boolean isHandingScreen(Class screen) { - return getBaseSupportedClass().isAssignableFrom(screen); - } - - /** - * Gets the left bounds of the overlay - * - * @param screen the current screen - * @return the left bounds - */ - Rectangle getLeftBounds(T screen); - - /** - * Gets the right bounds of the overlay - * - * @param screen the current screen - * @return the right bounds - */ - Rectangle getRightBounds(T screen); - - /** - * Checks if item slot can fit the screen - * - * @param left the left x coordinates of the stack - * @param top the top y coordinates for the stack - * @param screen the current screen - * @param fullBounds the current bounds - * @return whether the item slot can fit - * @see BaseBoundsHandler#registerExclusionZones(Class, Supplier) for easier api - */ - default InteractionResult canItemSlotWidgetFit(int left, int top, T screen, Rectangle fullBounds) { - InteractionResult fit; - fit = isInZone(left, top); - if (fit != InteractionResult.PASS) - return fit; - fit = isInZone(left + 18, top); - if (fit != InteractionResult.PASS) - return fit; - fit = isInZone(left, top + 18); - if (fit != InteractionResult.PASS) - return fit; - fit = isInZone(left + 18, top + 18); - return fit; - } - - @Override - default InteractionResult isInZone(double mouseX, double mouseY) { - return OverlayDecider.super.isInZone(mouseX, mouseY); - } - - /** - * Gets the item list bounds by the overlay bounds - * - * @param rectangle the overlay bounds - * @return the item list bounds - */ - @Deprecated - @ApiStatus.ScheduledForRemoval - default Rectangle getItemListArea(Rectangle rectangle) { - return new Rectangle(rectangle.x + 1, rectangle.y + 2 + (ConfigObject.getInstance().getSearchFieldLocation() == SearchFieldLocation.TOP_SIDE ? 24 : 0) + (ConfigObject.getInstance().isEntryListWidgetScrolled() ? 0 : 22), rectangle.width - 2, rectangle.height - (ConfigObject.getInstance().getSearchFieldLocation() != SearchFieldLocation.CENTER ? 27 + 22 : 27) + (!ConfigObject.getInstance().isEntryListWidgetScrolled() ? 0 : 22)); - } - - @Deprecated - @ApiStatus.ScheduledForRemoval - default Rectangle getFavoritesListArea(Rectangle rectangle) { - int offset = 31 + (ConfigObject.getInstance().doesShowUtilsButtons() ? 25 : 0); - return new Rectangle(rectangle.x + 1, rectangle.y + 2 + offset, rectangle.width - 2, rectangle.height - 5 - offset); - } - - @Deprecated - @ApiStatus.ScheduledForRemoval - default boolean shouldRecalculateArea(boolean isOnRightSide, Rectangle rectangle) { - return false; - } - - @Override - default boolean shouldRecalculateArea(DisplayPanelLocation location, Rectangle rectangle) { - return shouldRecalculateArea(location == DisplayPanelLocation.RIGHT, rectangle); - } - - /** - * Gets the priority of the handler, the higher it is, the earlier it is called. - * - * @return the priority in float - */ - @Override - float getPriority(); - } - } diff --git a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/EntryRegistry.java b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/EntryRegistry.java index 7d32ccf40..369862794 100644 --- a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/EntryRegistry.java +++ b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/EntryRegistry.java @@ -36,7 +36,6 @@ import java.util.Arrays; import java.util.Collection; import java.util.List; import java.util.function.Predicate; -import java.util.stream.Collectors; import java.util.stream.Stream; @Environment(EnvType.CLIENT) @@ -50,18 +49,6 @@ public interface EntryRegistry { return Internals.getEntryRegistry(); } - /** - * Gets the current modifiable stacks list - * - * @return a stacks list - */ - @Deprecated - @ApiStatus.ScheduledForRemoval - @NotNull - default List getStacksList() { - return getEntryStacks().collect(Collectors.toList()); - } - @NotNull Stream getEntryStacks(); @@ -95,26 +82,6 @@ public interface EntryRegistry { */ void registerEntryAfter(@Nullable EntryStack afterEntry, @NotNull EntryStack stack); - /** - * Registers an new stack to the entry list - * - * @param afterEntry the stack to put after - * @param stack the stack to register - * @param checkAlreadyContains whether the list should check if it is already on the list - * @see #queueRegisterEntryAfter(EntryStack, Collection) for a faster method - */ - @Deprecated - @ApiStatus.ScheduledForRemoval - default void registerEntryAfter(@Nullable EntryStack afterEntry, @NotNull EntryStack stack, boolean checkAlreadyContains) { - registerEntryAfter(afterEntry, stack); - } - - @Deprecated - @ApiStatus.ScheduledForRemoval - default void queueRegisterEntryAfter(@Nullable EntryStack afterEntry, @NotNull Collection<@NotNull ? extends EntryStack> stacks) { - registerEntriesAfter(afterEntry, stacks); - } - /** * Registers multiple stacks to the item list * diff --git a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/EntryStack.java b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/EntryStack.java index 70c8a06bc..fb117d3b8 100644 --- a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/EntryStack.java +++ b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/EntryStack.java @@ -146,24 +146,6 @@ public interface EntryStack extends TextRepresentable { return ImmutableList.copyOf(result); } - @Deprecated - @ApiStatus.ScheduledForRemoval - static List create(Collection stacks) { - return ofItemStacks(stacks); - } - - @Deprecated - @ApiStatus.ScheduledForRemoval - static List create(Ingredient ingredient) { - return ofIngredient(ingredient); - } - - @Deprecated - @ApiStatus.ScheduledForRemoval - static List> create(List ingredients) { - return ofIngredients(ingredients); - } - @ApiStatus.Internal static EntryStack readFromJson(JsonElement jsonElement) { try { @@ -216,34 +198,6 @@ public interface EntryStack extends TextRepresentable { } } - @Deprecated - @ApiStatus.ScheduledForRemoval - static EntryStack copyFluidToBucket(EntryStack stack) { - return copyFluidToItem(stack); - } - - @Deprecated - @ApiStatus.ScheduledForRemoval - static EntryStack copyFluidToItem(EntryStack stack) { - Item bucketItem = stack.getFluid().getBucket(); - if (bucketItem != null) { - return EntryStack.create(bucketItem); - } - return EntryStack.empty(); - } - - @Deprecated - @ApiStatus.ScheduledForRemoval - static EntryStack copyBucketToFluid(EntryStack stack) { - return copyItemToFluid(stack); - } - - @Deprecated - @ApiStatus.ScheduledForRemoval - static EntryStack copyItemToFluid(EntryStack stack) { - return FluidSupportProvider.getInstance().itemToFluid(stack); - } - static Stream copyItemToFluids(EntryStack stack) { return FluidSupportProvider.getInstance().itemToFluids(stack); } @@ -409,15 +363,6 @@ public interface EntryStack extends TextRepresentable { return id; } - public static class Item { - @Deprecated - @ApiStatus.ScheduledForRemoval - public static final Settings> RENDER_ENCHANTMENT_GLINT = new Settings<>(TRUE); - - private Item() { - } - } - public static class Fluid { // Return null to disable public static final Settings> AMOUNT_TOOLTIP = new Settings<>(stack -> I18n.get("tooltip.rei.fluid_amount", stack.simplifyAmount().getAccurateAmount())); diff --git a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/REIHelper.java b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/REIHelper.java index 787c83e19..c4bc5b429 100644 --- a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/REIHelper.java +++ b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/REIHelper.java @@ -30,12 +30,10 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.ItemStack; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.List; import java.util.Optional; @Environment(EnvType.CLIENT) @@ -54,23 +52,11 @@ public interface REIHelper { @Nullable AbstractContainerScreen getPreviousContainerScreen(); - @Nullable - @Deprecated - default AbstractContainerScreen getPreviousHandledScreen() { - return getPreviousContainerScreen(); - } - boolean isDarkThemeEnabled(); @Nullable TextFieldWidget getSearchTextField(); - @NotNull - @ApiStatus.Internal - @Deprecated - @ApiStatus.ScheduledForRemoval - List getInventoryStacks(); - void queueTooltip(@Nullable Tooltip tooltip); @NotNull diff --git a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/REIPluginEntry.java b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/REIPluginEntry.java index 6bf43e5a5..3285898f2 100644 --- a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/REIPluginEntry.java +++ b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/REIPluginEntry.java @@ -23,26 +23,12 @@ package me.shedaniel.rei.api; -import net.fabricmc.loader.api.SemanticVersion; -import net.fabricmc.loader.util.version.VersionParsingException; import net.minecraft.resources.ResourceLocation; -import org.jetbrains.annotations.ApiStatus; /** * Get base class of a REI plugin. */ public interface REIPluginEntry { - - /** - * @return the minimum version for the REI plugin to load - * @deprecated deprecated due to the lack of need of this method, please declare conflicts with fabric.mod.json - */ - @ApiStatus.ScheduledForRemoval - @Deprecated - default SemanticVersion getMinimumVersion() throws VersionParsingException { - return null; - } - /** * @return the priority of the plugin, the smaller the number, the earlier it is called. */ diff --git a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/RecipeDisplay.java b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/RecipeDisplay.java index ff6722e74..c99eb50a3 100644 --- a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/RecipeDisplay.java +++ b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/RecipeDisplay.java @@ -23,9 +23,7 @@ package me.shedaniel.rei.api; -import me.shedaniel.rei.utils.CollectionUtils; import net.minecraft.resources.ResourceLocation; -import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import java.util.Collections; @@ -42,22 +40,9 @@ public interface RecipeDisplay { /** * @return a list of outputs - * @deprecated Use {@link RecipeDisplay#getResultingEntries()} */ - @Deprecated - @ApiStatus.ScheduledForRemoval(inVersion = "1.17") @NotNull - default List getOutputEntries() { - return Collections.emptyList(); - } - - /** - * @return a list of outputs - */ - @NotNull - default List> getResultingEntries() { - return CollectionUtils.map(getOutputEntries(), Collections::singletonList); - } + List> getResultingEntries(); /** * Gets the required items used in craftable filters diff --git a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/RecipeHelper.java b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/RecipeHelper.java index 205608e14..b0c61e380 100644 --- a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/RecipeHelper.java +++ b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/RecipeHelper.java @@ -36,7 +36,6 @@ import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Optional; @@ -138,19 +137,6 @@ public interface RecipeHelper { */ void registerDisplay(RecipeDisplay display); - /** - * Registers a recipe display. - * - * @param categoryIdentifier the category to display in - * @param display the recipe display - * @deprecated Use {@link RecipeHelper#registerDisplay(RecipeDisplay)} - */ - @ApiStatus.ScheduledForRemoval - @Deprecated - default void registerDisplay(ResourceLocation categoryIdentifier, RecipeDisplay display) { - registerDisplay(display); - } - Map, List> buildMapFor(ClientHelper.ViewSearchBuilder builder); /** @@ -262,15 +248,6 @@ public interface RecipeHelper { */ void registerLiveRecipeGenerator(LiveRecipeGenerator liveRecipeGenerator); - /** - * @deprecated Use {@link #registerContainerClickArea(Rectangle, Class, ResourceLocation...)} for the same result. - */ - @Deprecated - @ApiStatus.ScheduledForRemoval - default void registerScreenClickArea(Rectangle rectangle, Class> screenClass, ResourceLocation... categories) { - registerContainerClickArea(rectangle, screenClass, categories); - } - /** * Registers a click area for a container screen. * @@ -317,26 +294,7 @@ public interface RecipeHelper { > void registerRecipes(ResourceLocation category, Function recipeFilter, Function mappingFunction); - @ApiStatus.Internal - @Deprecated - @ApiStatus.ScheduledForRemoval(inVersion = "6.0") - default List getScreenClickAreas() { - return Collections.emptyList(); - } - @ApiStatus.Internal boolean arePluginsLoading(); - - @ApiStatus.Internal - @Deprecated - @ApiStatus.ScheduledForRemoval(inVersion = "6.0") - interface ScreenClickArea { - Class getScreenClass(); - - Rectangle getRectangle(); - - ResourceLocation[] getCategories(); - } - } diff --git a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/TextTest.java b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/TextTest.java deleted file mode 100644 index b4c7554ef..000000000 --- a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/TextTest.java +++ /dev/null @@ -1,39 +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 net.minecraft.ChatFormatting; -import net.minecraft.network.chat.MutableComponent; -import net.minecraft.network.chat.TextComponent; -import org.jetbrains.annotations.ApiStatus; - -@ApiStatus.ScheduledForRemoval(inVersion = "1.17") -@Deprecated -public class TextTest { - public static void main(String[] args) { - MutableComponent text = new TextComponent("adaw").append("dawdwdaw").withStyle(ChatFormatting.RED); - System.out.println(text.getString()); - System.out.println(text.getString()); - } -} diff --git a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/fluid/FluidSupportProvider.java b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/fluid/FluidSupportProvider.java index 76d964965..a4ffe23e4 100644 --- a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/fluid/FluidSupportProvider.java +++ b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/fluid/FluidSupportProvider.java @@ -32,7 +32,6 @@ import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.Objects; import java.util.stream.Stream; /** @@ -41,73 +40,15 @@ import java.util.stream.Stream; @ApiStatus.Experimental @Environment(EnvType.CLIENT) public interface FluidSupportProvider { - @Deprecated - @ApiStatus.ScheduledForRemoval - FluidSupportProvider INSTANCE = new FluidSupportProvider() { - @Override - public void registerProvider(@NotNull Provider provider) { - getInstance().registerProvider(provider); - } - - @Override - public @NotNull Stream itemToFluids(@NotNull EntryStack itemStack) { - return getInstance().itemToFluids(itemStack); - } - }; - static FluidSupportProvider getInstance() { return Internals.getFluidSupportProvider(); } - /** - * @deprecated Please switch to {@link FluidSupportProvider#registerProvider(Provider)} - */ - @Deprecated - @ApiStatus.ScheduledForRemoval - default void registerFluidProvider(@NotNull FluidProvider provider) { - registerProvider(itemStack -> { - EntryStack stack = Objects.requireNonNull(provider.itemToFluid(itemStack)); - if (!stack.isEmpty()) - return InteractionResultHolder.success(Stream.of(stack)); - return InteractionResultHolder.pass(null); - }); - } - void registerProvider(@NotNull Provider provider); - @Deprecated - @ApiStatus.ScheduledForRemoval - @NotNull - default EntryStack fluidToItem(@NotNull EntryStack fluidStack) { - return EntryStack.empty(); - } - - @NotNull - default EntryStack itemToFluid(@NotNull EntryStack itemStack) { - return itemToFluids(itemStack).findFirst().orElse(EntryStack.empty()); - } - @NotNull Stream itemToFluids(@NotNull EntryStack itemStack); - @Deprecated - @ApiStatus.ScheduledForRemoval - interface FluidProvider { - @Deprecated - @ApiStatus.ScheduledForRemoval - @NotNull - default EntryStack fluidToItem(@NotNull EntryStack fluidStack) { - return EntryStack.empty(); - } - - @Deprecated - @ApiStatus.ScheduledForRemoval - @NotNull - default EntryStack itemToFluid(@NotNull EntryStack itemStack) { - return EntryStack.empty(); - } - } - @FunctionalInterface interface Provider { @NotNull diff --git a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/subsets/SubsetsRegistry.java b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/subsets/SubsetsRegistry.java index 06b5a4ead..26969ed32 100644 --- a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/subsets/SubsetsRegistry.java +++ b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/subsets/SubsetsRegistry.java @@ -39,40 +39,6 @@ import java.util.Set; @ApiStatus.Experimental @Environment(EnvType.CLIENT) public interface SubsetsRegistry { - @Deprecated - @ApiStatus.ScheduledForRemoval - SubsetsRegistry INSTANCE = new SubsetsRegistry() { - @Override - public @NotNull List getEntryPaths(@NotNull EntryStack stack) { - return getInstance().getEntryPaths(stack); - } - - @Override - public @Nullable Set getPathEntries(@NotNull String path) { - return getInstance().getPathEntries(path); - } - - @Override - public @NotNull Set getOrCreatePathEntries(@NotNull String path) { - return getInstance().getOrCreatePathEntries(path); - } - - @Override - public @NotNull Set getPaths() { - return getInstance().getPaths(); - } - - @Override - public void registerPathEntry(@NotNull String path, @NotNull EntryStack stack) { - getInstance().registerPathEntry(path, stack); - } - - @Override - public void registerPathEntries(@NotNull String path, @NotNull Collection stacks) { - getInstance().registerPathEntries(path, stacks); - } - }; - static SubsetsRegistry getInstance() { return Internals.getSubsetsRegistry(); } diff --git a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/widgets/Label.java b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/widgets/Label.java index 55761012b..9196529c9 100644 --- a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/widgets/Label.java +++ b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/widgets/Label.java @@ -29,8 +29,6 @@ import me.shedaniel.rei.api.REIHelper; import me.shedaniel.rei.gui.widget.WidgetWithBounds; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.FormattedText; -import net.minecraft.network.chat.TextComponent; -import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -296,13 +294,6 @@ public abstract class Label extends WidgetWithBounds { return this; } - @NotNull - @ApiStatus.ScheduledForRemoval - @Deprecated - public Component getText() { - return new TextComponent(""); - } - public abstract FormattedText getMessage(); public final void setText(@NotNull Component text) { diff --git a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/widgets/Panel.java b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/widgets/Panel.java index 6e53eb41b..1e039a889 100644 --- a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/widgets/Panel.java +++ b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/widgets/Panel.java @@ -25,35 +25,11 @@ package me.shedaniel.rei.api.widgets; import me.shedaniel.rei.api.REIHelper; import me.shedaniel.rei.gui.widget.WidgetWithBounds; -import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import java.util.function.Predicate; public abstract class Panel extends WidgetWithBounds { - @Deprecated - @ApiStatus.ScheduledForRemoval - public abstract int getInnerColor(); - - @Deprecated - @ApiStatus.ScheduledForRemoval - public abstract void setInnerColor(int innerColor); - - @Deprecated - @ApiStatus.ScheduledForRemoval - @NotNull - public final Panel innerColor(int innerColor) { - setInnerColor(innerColor); - return this; - } - - @Deprecated - @ApiStatus.ScheduledForRemoval - @NotNull - public final Panel innerColor(int lightColor, int darkColor) { - return innerColor(REIHelper.getInstance().isDarkThemeEnabled() ? darkColor : lightColor); - } - public abstract int getXTextureOffset(); public abstract void setXTextureOffset(int xTextureOffset); diff --git a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/gui/entries/SimpleRecipeEntry.java b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/gui/entries/SimpleRecipeEntry.java index 8120d5d03..eb3267a19 100644 --- a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/gui/entries/SimpleRecipeEntry.java +++ b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/gui/entries/SimpleRecipeEntry.java @@ -39,7 +39,6 @@ import net.minecraft.util.Mth; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; -import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.Map; @@ -80,22 +79,10 @@ public class SimpleRecipeEntry extends RecipeEntry { })).collect(Collectors.toList()); } - @Deprecated - @ApiStatus.ScheduledForRemoval - public static RecipeEntry create(Supplier>> input, Supplier> output) { - return create(input.get(), output.get()); - } - public static RecipeEntry from(Supplier>> input, Supplier>> output) { return from(input.get(), output.get()); } - @Deprecated - @ApiStatus.ScheduledForRemoval - public static RecipeEntry create(List> input, List output) { - return from(input, CollectionUtils.map(output, Collections::singletonList)); - } - public static RecipeEntry from(List> input, List> output) { return new SimpleRecipeEntry(input, output); } diff --git a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/server/ContainerInfoHandler.java b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/server/ContainerInfoHandler.java index fdfeba33c..a1149f5e1 100644 --- a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/server/ContainerInfoHandler.java +++ b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/server/ContainerInfoHandler.java @@ -26,7 +26,6 @@ package me.shedaniel.rei.server; import com.google.common.collect.Maps; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.inventory.AbstractContainerMenu; -import org.jetbrains.annotations.ApiStatus; import java.util.Map; @@ -34,15 +33,6 @@ public class ContainerInfoHandler { private static final Map, ContainerInfo>> containerInfoMap = Maps.newLinkedHashMap(); public static void registerContainerInfo(ResourceLocation category, ContainerInfo containerInfo) { - registerScreenWithHandlerInfo(category, containerInfo); - } - - /** - * @deprecated Use {@link #registerContainerInfo(Identifier, ContainerInfo)} - */ - @Deprecated - @ApiStatus.ScheduledForRemoval - public static void registerScreenWithHandlerInfo(ResourceLocation category, ContainerInfo containerInfo) { if (!containerInfoMap.containsKey(category.toString())) containerInfoMap.put(category.toString(), Maps.newLinkedHashMap()); containerInfoMap.get(category.toString()).put(containerInfo.getContainerClass(), containerInfo); diff --git a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/utils/CollectionUtils.java b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/utils/CollectionUtils.java index fd4cac467..90de9a2c1 100644 --- a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/utils/CollectionUtils.java +++ b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/utils/CollectionUtils.java @@ -34,7 +34,10 @@ import net.fabricmc.api.Environment; import net.minecraft.util.Mth; import java.util.*; -import java.util.function.*; +import java.util.function.Function; +import java.util.function.Predicate; +import java.util.function.Supplier; +import java.util.function.ToIntFunction; import java.util.stream.Collectors; import java.util.stream.Stream; diff --git a/RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java b/RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java index fe76dfcab..e89dba219 100644 --- a/RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java +++ b/RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java @@ -105,7 +105,6 @@ import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.ApiStatus; import java.util.*; -import java.util.function.Consumer; import java.util.function.IntConsumer; import java.util.function.UnaryOperator; import java.util.stream.Stream; @@ -113,6 +112,7 @@ import java.util.stream.Stream; import static me.shedaniel.rei.impl.Internals.attachInstance; @Environment(EnvType.CLIENT) +@ApiStatus.Internal public class DefaultPlugin implements REIPluginV0, BuiltinPlugin { private static final Logger LOGGER = LogManager.getFormatterLogger("REI/DefaultPlugin"); public static final ResourceLocation CRAFTING = BuiltinPlugin.CRAFTING; @@ -143,12 +143,6 @@ public class DefaultPlugin implements REIPluginV0, BuiltinPlugin { attachInstance(this, BuiltinPlugin.class); } - @Deprecated - @ApiStatus.ScheduledForRemoval - public static void registerBrewingDisplay(DefaultBrewingDisplay recipe) { - RecipeHelper.getInstance().registerDisplay(recipe); - } - public static void registerBrewingRecipe(RegisteredBrewingRecipe recipe) { RecipeHelper.getInstance().registerDisplay(new DefaultBrewingDisplay(recipe.input, recipe.ingredient, recipe.output)); } diff --git a/RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/beacon_payment/DefaultBeaconPaymentCategory.java b/RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/beacon_payment/DefaultBeaconPaymentCategory.java index 156f83915..1a3baa681 100644 --- a/RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/beacon_payment/DefaultBeaconPaymentCategory.java +++ b/RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/beacon_payment/DefaultBeaconPaymentCategory.java @@ -23,14 +23,8 @@ package me.shedaniel.rei.plugin.beacon_payment; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.components.events.GuiEventListener; -import net.minecraft.client.resources.language.I18n; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.Mth; -import net.minecraft.world.level.block.Blocks; +import com.google.common.collect.Lists; import com.mojang.blaze3d.vertex.PoseStack; - import me.shedaniel.clothconfig2.ClothConfigInitializer; import me.shedaniel.clothconfig2.api.ScissorsHandler; import me.shedaniel.clothconfig2.api.ScrollingContainer; @@ -46,9 +40,14 @@ import me.shedaniel.rei.gui.widget.Widget; import me.shedaniel.rei.gui.widget.WidgetWithBounds; import me.shedaniel.rei.plugin.DefaultPlugin; import me.shedaniel.rei.utils.CollectionUtils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.components.events.GuiEventListener; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.Mth; +import net.minecraft.world.level.block.Blocks; import org.jetbrains.annotations.NotNull; -import com.google.common.collect.Lists; import java.util.List; import java.util.Objects; diff --git a/RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/beacon_payment/DefaultBeaconPaymentDisplay.java b/RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/beacon_payment/DefaultBeaconPaymentDisplay.java index 34eca7444..cdee28852 100644 --- a/RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/beacon_payment/DefaultBeaconPaymentDisplay.java +++ b/RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/beacon_payment/DefaultBeaconPaymentDisplay.java @@ -23,15 +23,13 @@ package me.shedaniel.rei.plugin.beacon_payment; +import me.shedaniel.rei.api.EntryStack; +import me.shedaniel.rei.api.RecipeDisplay; +import me.shedaniel.rei.plugin.DefaultPlugin; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; - import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; - -import me.shedaniel.rei.api.EntryStack; -import me.shedaniel.rei.api.RecipeDisplay; -import me.shedaniel.rei.plugin.DefaultPlugin; import org.jetbrains.annotations.NotNull; import java.util.Collections; diff --git a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java index 60ff88f70..fb2728932 100644 --- a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java +++ b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java @@ -151,7 +151,7 @@ public class RoughlyEnoughItemsCore implements ClientModInitializer { @Override public me.shedaniel.rei.api.widgets.Slot createSlot(Point point) { - return EntryWidget.create(point); + return new EntryWidget(point); } @Override diff --git a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java index bcc21caa7..c24164451 100644 --- a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java +++ b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java @@ -258,7 +258,7 @@ public class RecipeViewingScreen extends Screen implements RecipeScreen { ClientHelperImpl.getInstance().openRecipeViewingScreen(categoriesMap, categories.get(currentCategoryIndex).getIdentifier(), ingredientStackToNotice, resultStackToNotice); }).tooltipLine(I18n.get("text.rei.previous_category"))); widgets.add(Widgets.createClickableLabel(new Point(bounds.getCenterX(), bounds.getY() + 7), new TextComponent(selectedCategory.getCategoryName()), clickableLabelWidget -> { - ClientHelper.getInstance().executeViewAllRecipesKeyBind(); + ClientHelper.getInstance().openView(ClientHelper.ViewSearchBuilder.builder().addAllCategories().fillPreferredOpenedCategory()); }).tooltipLine(I18n.get("text.rei.view_all_categories"))); widgets.add(categoryNext = Widgets.createButton(new Rectangle(bounds.getMaxX() - 17, bounds.getY() + 5, 12, 12), new TranslatableComponent("text.rei.right_arrow")) .onClick(button -> { diff --git a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/TransformingScreen.java b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/TransformingScreen.java index e8c2e615c..e72c921e1 100644 --- a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/TransformingScreen.java +++ b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/TransformingScreen.java @@ -29,10 +29,8 @@ import me.shedaniel.clothconfig2.api.ScissorsScreen; import me.shedaniel.math.Rectangle; import net.minecraft.client.KeyMapping; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.screens.DeathScreen; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.TitleScreen; -import net.minecraft.client.gui.screens.multiplayer.JoinMultiplayerScreen; import org.jetbrains.annotations.Nullable; import java.util.function.BooleanSupplier; diff --git a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java index 36a18ac78..9eecc4616 100644 --- a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java +++ b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java @@ -241,7 +241,7 @@ public class VillagerRecipeViewingScreen extends Screen implements RecipeScreen .enabled(categories.size() > tabsPerPage)); this.widgets.add(Widgets.createClickableLabel(new Point(bounds.x + 4 + scrollListBounds.width / 2, bounds.y + 6), new TextComponent(categories.get(selectedCategoryIndex).getCategoryName()), label -> { - ClientHelper.getInstance().executeViewAllRecipesKeyBind(); + ClientHelper.getInstance().openView(ClientHelper.ViewSearchBuilder.builder().addAllCategories().fillPreferredOpenedCategory()); }).tooltipLine(I18n.get("text.rei.view_all_categories")).noShadow().color(0xFF404040, 0xFFBBBBBB).hoveredColor(0xFF0041FF, 0xFFFFBD4D)); this.children.addAll(buttonList); diff --git a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/config/entry/FilteringScreen.java b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/config/entry/FilteringScreen.java index 31e2a3948..1d3d37014 100644 --- a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/config/entry/FilteringScreen.java +++ b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/config/entry/FilteringScreen.java @@ -309,11 +309,11 @@ public class FilteringScreen extends Screen { public void updateSearch(String searchTerm) { lastSearchArguments = SearchArgument.processSearchTerm(searchTerm); Set list = Sets.newLinkedHashSet(); - for (EntryStack stack : EntryRegistry.getInstance().getStacksList()) { + EntryRegistry.getInstance().getEntryStacks().forEach(stack -> { if (canLastSearchTermsBeAppliedTo(stack)) { list.add(stack.copy().setting(EntryStack.Settings.CHECK_AMOUNT, EntryStack.Settings.FALSE).setting(EntryStack.Settings.RENDER_COUNTS, EntryStack.Settings.FALSE).setting(EntryStack.Settings.CHECK_TAGS, EntryStack.Settings.TRUE)); } - } + }); entryStacks = Lists.newArrayList(list); updateEntriesPosition(); diff --git a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/modules/MenuEntry.java b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/modules/MenuEntry.java index 455dae30b..7a1101a9d 100644 --- a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/modules/MenuEntry.java +++ b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/modules/MenuEntry.java @@ -29,6 +29,7 @@ import org.jetbrains.annotations.ApiStatus; @ApiStatus.Experimental @ApiStatus.Internal public abstract class MenuEntry extends Widget { + @ApiStatus.Internal @Deprecated Menu parent = null; diff --git a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/plugin/DefaultRuntimePlugin.java b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/plugin/DefaultRuntimePlugin.java index 71f6f8dfe..05a450867 100644 --- a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/plugin/DefaultRuntimePlugin.java +++ b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/plugin/DefaultRuntimePlugin.java @@ -33,10 +33,8 @@ import me.shedaniel.rei.api.favorites.FavoriteEntryType; import me.shedaniel.rei.api.plugins.REIPluginV0; import me.shedaniel.rei.api.widgets.Panel; import me.shedaniel.rei.api.widgets.Tooltip; -import me.shedaniel.rei.gui.ContainerScreenOverlay; import me.shedaniel.rei.gui.RecipeViewingScreen; import me.shedaniel.rei.gui.VillagerRecipeViewingScreen; -import me.shedaniel.rei.gui.widget.FavoritesListWidget; import me.shedaniel.rei.impl.ClientHelperImpl; import me.shedaniel.rei.impl.RenderingEntry; import me.shedaniel.rei.plugin.autocrafting.DefaultCategoryHandler; diff --git a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/widget/ButtonWidget.java b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/widget/ButtonWidget.java deleted file mode 100644 index 48214cda9..000000000 --- a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/widget/ButtonWidget.java +++ /dev/null @@ -1,221 +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.gui.widget; - -import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.PoseStack; -import me.shedaniel.math.Point; -import me.shedaniel.math.Rectangle; -import me.shedaniel.rei.api.REIHelper; -import me.shedaniel.rei.api.widgets.Tooltip; -import net.minecraft.client.gui.components.events.GuiEventListener; -import net.minecraft.client.resources.sounds.SimpleSoundInstance; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TextComponent; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.sounds.SoundEvents; -import net.minecraft.util.Mth; -import org.jetbrains.annotations.ApiStatus; -import org.jetbrains.annotations.NotNull; - -import java.util.Collections; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.function.Consumer; -import java.util.function.Supplier; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -/** - * @see me.shedaniel.rei.api.widgets.Widgets#createButton(me.shedaniel.math.Rectangle, Text) - */ -@Deprecated -@ApiStatus.ScheduledForRemoval -public abstract class ButtonWidget extends WidgetWithBounds { - - protected static final ResourceLocation BUTTON_LOCATION = new ResourceLocation("roughlyenoughitems", "textures/gui/button.png"); - protected static final ResourceLocation BUTTON_LOCATION_DARK = new ResourceLocation("roughlyenoughitems", "textures/gui/button_dark.png"); - public boolean enabled = true; - public boolean focused = false; - private boolean canChangeFocuses = true; - private String text; - private Rectangle bounds; - private Supplier tooltipSupplier; - - protected ButtonWidget(Rectangle rectangle, Component text) { - this.bounds = Objects.requireNonNull(rectangle); - this.text = Objects.requireNonNull(text).getString(); - } - - public static ButtonWidget create(Rectangle point, String text, Consumer onClick) { - return create(point, new TextComponent(text), onClick); - } - - public static ButtonWidget create(Rectangle point, Component text, Consumer onClick) { - ButtonWidget[] widget = {null}; - widget[0] = new ButtonWidget(point, text) { - @Override - public void onPressed() { - onClick.accept(widget[0]); - } - }; - return widget[0]; - } - - public ButtonWidget tooltip(Supplier tooltipSupplier) { - this.tooltipSupplier = tooltipSupplier; - return this; - } - - public ButtonWidget enabled(boolean enabled) { - this.enabled = enabled; - return this; - } - - public ButtonWidget canChangeFocuses(boolean canChangeFocuses) { - this.canChangeFocuses = canChangeFocuses; - return this; - } - - public boolean canChangeFocuses() { - return canChangeFocuses; - } - - @NotNull - public Rectangle getBounds() { - return bounds; - } - - public String getText() { - return text; - } - - public void setText(String text) { - this.text = text; - } - - protected int getTextureId(boolean boolean_1) { - int int_1 = 1; - if (!this.enabled) { - int_1 = 0; - } else if (boolean_1) { - int_1 = 4; // 2 is the old blue highlight, 3 is the 1.15 outline, 4 is the 1.15 online + light hover - } - - return int_1; - } - - protected void renderBackground(PoseStack matrices, int x, int y, int width, int height, int textureOffset) { - minecraft.getTextureManager().bind(REIHelper.getInstance().isDarkThemeEnabled() ? BUTTON_LOCATION_DARK : BUTTON_LOCATION); - RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - RenderSystem.enableBlend(); - RenderSystem.blendFuncSeparate(770, 771, 1, 0); - RenderSystem.blendFunc(770, 771); - //Four Corners - blit(matrices, x, y, getBlitOffset(), 0, textureOffset * 80, 4, 4, 512, 256); - blit(matrices, x + width - 4, y, getBlitOffset(), 252, textureOffset * 80, 4, 4, 512, 256); - blit(matrices, x, y + height - 4, getBlitOffset(), 0, textureOffset * 80 + 76, 4, 4, 512, 256); - blit(matrices, x + width - 4, y + height - 4, getBlitOffset(), 252, textureOffset * 80 + 76, 4, 4, 512, 256); - - //Sides - blit(matrices, x + 4, y, getBlitOffset(), 4, textureOffset * 80, Mth.ceil((width - 8) / 2f), 4, 512, 256); - blit(matrices, x + 4, y + height - 4, getBlitOffset(), 4, textureOffset * 80 + 76, Mth.ceil((width - 8) / 2f), 4, 512, 256); - blit(matrices, x + 4 + Mth.ceil((width - 8) / 2f), y + height - 4, getBlitOffset(), 252 - Mth.floor((width - 8) / 2f), textureOffset * 80 + 76, Mth.floor((width - 8) / 2f), 4, 512, 256); - blit(matrices, x + 4 + Mth.ceil((width - 8) / 2f), y, getBlitOffset(), 252 - Mth.floor((width - 8) / 2f), textureOffset * 80, Mth.floor((width - 8) / 2f), 4, 512, 256); - for (int i = y + 4; i < y + height - 4; i += 76) { - blit(matrices, x, i, getBlitOffset(), 0, 4 + textureOffset * 80, Mth.ceil(width / 2f), Mth.clamp(y + height - 4 - i, 0, 76), 512, 256); - blit(matrices, x + Mth.ceil(width / 2f), i, getBlitOffset(), 256 - Mth.floor(width / 2f), 4 + textureOffset * 80, Mth.floor(width / 2f), Mth.clamp(y + height - 4 - i, 0, 76), 512, 256); - } - } - - @Override - public void render(PoseStack matrices, int mouseX, int mouseY, float delta) { - int x = bounds.x, y = bounds.y, width = bounds.width, height = bounds.height; - renderBackground(matrices, x, y, width, height, this.getTextureId(isHovered(mouseX, mouseY))); - - int color = 14737632; - if (!this.enabled) { - color = 10526880; - } else if (isHovered(mouseX, mouseY)) { - color = 16777120; - } - - this.drawCenteredString(matrices, font, getText(), x + width / 2, y + (height - 8) / 2, color); - - if (getTooltips().isPresent()) - if (!focused && containsMouse(mouseX, mouseY)) - Tooltip.create(Stream.of(getTooltips().get().split("\n")).map(TextComponent::new).collect(Collectors.toList())).queue(); - else if (focused) - Tooltip.create(new Point(x + width / 2, y + height / 2), Stream.of(getTooltips().get().split("\n")).map(TextComponent::new).collect(Collectors.toList())).queue(); - } - - public boolean isHovered(int mouseX, int mouseY) { - return isMouseOver(mouseX, mouseY) || focused; - } - - @Override - public boolean changeFocus(boolean boolean_1) { - if (!enabled || !canChangeFocuses) - return false; - this.focused = !this.focused; - return true; - } - - @Override - public List children() { - return Collections.emptyList(); - } - - @Override - public boolean mouseClicked(double mouseX, double mouseY, int button) { - if (isMouseOver(mouseX, mouseY) && enabled && button == 0) { - minecraft.getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.UI_BUTT