From 7a1cf35934ef14c04f884fe6ae34282e1d6243ba Mon Sep 17 00:00:00 2001 From: shedaniel Date: Fri, 17 Jan 2020 14:31:30 +0800 Subject: 3.3.12 --- .../me/shedaniel/rei/RoughlyEnoughItemsCore.java | 33 ++++------ .../me/shedaniel/rei/api/AutoTransferHandler.java | 3 + .../me/shedaniel/rei/api/BaseBoundsHandler.java | 11 ++++ .../me/shedaniel/rei/api/ButtonAreaSupplier.java | 3 + .../java/me/shedaniel/rei/api/ClientHelper.java | 2 + .../java/me/shedaniel/rei/api/ConfigManager.java | 7 ++- .../java/me/shedaniel/rei/api/ConfigObject.java | 5 +- .../rei/api/DisplayVisibilityHandler.java | 2 +- .../java/me/shedaniel/rei/api/EntryRegistry.java | 2 + src/main/java/me/shedaniel/rei/api/EntryStack.java | 26 ++++---- .../java/me/shedaniel/rei/api/ItemStackHook.java | 5 +- .../java/me/shedaniel/rei/api/ObjectHolder.java | 7 +++ .../me/shedaniel/rei/api/OptimalEntryStack.java | 5 +- .../java/me/shedaniel/rei/api/REIPluginEntry.java | 2 + .../java/me/shedaniel/rei/api/RecipeCategory.java | 8 ++- .../java/me/shedaniel/rei/api/RecipeDisplay.java | 2 +- .../java/me/shedaniel/rei/api/RecipeHelper.java | 4 +- .../shedaniel/rei/api/TransferRecipeCategory.java | 2 + .../rei/api/annotations/Experimental.java | 16 ----- .../me/shedaniel/rei/api/annotations/Internal.java | 16 ----- .../shedaniel/rei/api/annotations/ToBeRemoved.java | 16 ----- .../me/shedaniel/rei/api/plugins/REIPluginV0.java | 9 +++ .../shedaniel/rei/gui/ConfigReloadingScreen.java | 5 +- .../shedaniel/rei/gui/ContainerScreenOverlay.java | 8 +-- .../me/shedaniel/rei/gui/OverlaySearchField.java | 10 +--- .../shedaniel/rei/gui/PreRecipeViewingScreen.java | 9 ++- .../me/shedaniel/rei/gui/RecipeViewingScreen.java | 70 +++++++++++----------- .../rei/gui/VillagerRecipeViewingScreen.java | 20 ++----- .../shedaniel/rei/gui/config/ItemCheatingMode.java | 2 + .../shedaniel/rei/gui/config/ItemListOrdering.java | 3 + .../rei/gui/config/ItemListOrderingConfig.java | 2 + .../shedaniel/rei/gui/config/RecipeScreenType.java | 2 + .../rei/gui/config/SearchFieldLocation.java | 2 + .../rei/gui/credits/CreditsEntryListWidget.java | 2 + .../shedaniel/rei/gui/credits/CreditsScreen.java | 2 + .../me/shedaniel/rei/gui/entries/RecipeEntry.java | 2 + .../rei/gui/entries/SimpleRecipeEntry.java | 4 +- .../rei/gui/toast/CopyRecipeIdentifierToast.java | 5 +- .../rei/gui/widget/AutoCraftingButtonWidget.java | 13 ++-- .../me/shedaniel/rei/gui/widget/ButtonWidget.java | 6 +- .../gui/widget/ClickableActionedLabelWidget.java | 5 +- .../rei/gui/widget/ClickableLabelWidget.java | 9 +-- .../gui/widget/CraftableToggleButtonWidget.java | 5 +- .../shedaniel/rei/gui/widget/DraggableWidget.java | 5 +- .../shedaniel/rei/gui/widget/EntryListWidget.java | 8 +-- .../rei/gui/widget/FavoritesListWidget.java | 6 +- .../me/shedaniel/rei/gui/widget/LabelWidget.java | 9 +-- .../me/shedaniel/rei/gui/widget/PanelWidget.java | 16 ++--- .../me/shedaniel/rei/gui/widget/QueuedTooltip.java | 5 +- .../rei/gui/widget/RecipeArrowWidget.java | 11 +++- .../rei/gui/widget/RecipeChoosePageWidget.java | 5 +- .../rei/gui/widget/ReloadConfigButtonWidget.java | 5 +- .../me/shedaniel/rei/gui/widget/TabWidget.java | 5 +- .../shedaniel/rei/gui/widget/WidgetWithBounds.java | 1 + .../me/shedaniel/rei/impl/AbstractEntryStack.java | 7 ++- .../shedaniel/rei/impl/BaseBoundsHandlerImpl.java | 7 +-- .../me/shedaniel/rei/impl/ClientHelperImpl.java | 5 +- .../me/shedaniel/rei/impl/ConfigManagerImpl.java | 11 +--- .../me/shedaniel/rei/impl/ConfigObjectImpl.java | 5 +- .../me/shedaniel/rei/impl/DisplayHelperImpl.java | 17 +++--- .../me/shedaniel/rei/impl/EmptyEntryStack.java | 5 +- .../me/shedaniel/rei/impl/EntryRegistryImpl.java | 13 ++-- .../me/shedaniel/rei/impl/FluidEntryStack.java | 9 +-- .../java/me/shedaniel/rei/impl/ItemEntryStack.java | 17 +++--- .../me/shedaniel/rei/impl/ObjectHolderImpl.java | 3 +- .../me/shedaniel/rei/impl/RecipeHelperImpl.java | 5 +- .../java/me/shedaniel/rei/impl/RenderingEntry.java | 4 +- .../java/me/shedaniel/rei/impl/ScreenHelper.java | 7 +-- .../java/me/shedaniel/rei/impl/SearchArgument.java | 18 +++--- src/main/java/me/shedaniel/rei/impl/Weather.java | 4 +- .../listeners/AbstractInventoryScreenHooks.java | 2 + .../rei/listeners/ContainerScreenHooks.java | 2 + .../rei/listeners/RecipeBookButtonWidgetHooks.java | 2 + .../rei/listeners/RecipeBookGuiHooks.java | 2 + .../autocrafting/DefaultCategoryHandler.java | 2 +- .../autocrafting/DefaultRecipeBookHandler.java | 1 - .../rei/plugin/brewing/DefaultBrewingCategory.java | 2 +- .../plugin/campfire/DefaultCampfireCategory.java | 9 ++- .../plugin/campfire/DefaultCampfireDisplay.java | 2 +- .../composting/DefaultCompostingCategory.java | 2 +- .../composting/DefaultCompostingDisplay.java | 2 +- .../containers/CraftingContainerInfoWrapper.java | 6 +- .../rei/plugin/cooking/DefaultCookingCategory.java | 9 ++- .../rei/plugin/cooking/DefaultCookingDisplay.java | 20 +++++-- .../plugin/crafting/DefaultCraftingCategory.java | 3 +- .../rei/plugin/crafting/DefaultCustomDisplay.java | 5 +- .../rei/plugin/fuel/DefaultFuelCategory.java | 4 +- .../information/DefaultInformationCategory.java | 26 ++++---- .../shedaniel/rei/server/ContainerInfoHandler.java | 10 ++-- .../me/shedaniel/rei/server/InputSlotCrafter.java | 20 ++----- .../java/me/shedaniel/rei/server/RecipeFinder.java | 4 +- .../me/shedaniel/rei/server/RecipeGridAligner.java | 20 +++---- .../shedaniel/rei/tests/plugin/REITestPlugin.java | 3 +- .../me/shedaniel/rei/utils/CollectionUtils.java | 4 +- .../assets/roughlyenoughitems/lang/en_us.json | 3 +- 95 files changed, 380 insertions(+), 370 deletions(-) delete mode 100644 src/main/java/me/shedaniel/rei/api/annotations/Experimental.java delete mode 100644 src/main/java/me/shedaniel/rei/api/annotations/Internal.java delete mode 100644 src/main/java/me/shedaniel/rei/api/annotations/ToBeRemoved.java (limited to 'src') diff --git a/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java b/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java index 100cd75bb..fa05ffdc2 100644 --- a/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java +++ b/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java @@ -9,7 +9,6 @@ import com.google.common.collect.Lists; import com.google.common.collect.Maps; import me.shedaniel.cloth.hooks.ClothClientHooks; import me.shedaniel.rei.api.*; -import me.shedaniel.rei.api.annotations.Internal; import me.shedaniel.rei.api.plugins.REIPluginV0; import me.shedaniel.rei.gui.ContainerScreenOverlay; import me.shedaniel.rei.impl.*; @@ -44,6 +43,7 @@ import net.minecraft.util.ActionResult; import net.minecraft.util.Identifier; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.jetbrains.annotations.ApiStatus; import java.util.LinkedList; import java.util.List; @@ -54,37 +54,33 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.atomic.AtomicLong; -@Internal +@ApiStatus.Internal public class RoughlyEnoughItemsCore implements ClientModInitializer { - @Internal public static final Logger LOGGER; - @SuppressWarnings("deprecation") private static final RecipeHelper RECIPE_HELPER = new RecipeHelperImpl(); - @SuppressWarnings("deprecation") private static final EntryRegistry ENTRY_REGISTRY = new EntryRegistryImpl(); - @SuppressWarnings("deprecation") private static final DisplayHelper DISPLAY_HELPER = new DisplayHelperImpl(); + @ApiStatus.Internal public static final Logger LOGGER = LogManager.getFormatterLogger("REI"); + private static final RecipeHelper RECIPE_HELPER = new RecipeHelperImpl(); + private static final EntryRegistry ENTRY_REGISTRY = new EntryRegistryImpl(); + private static final DisplayHelper DISPLAY_HELPER = new DisplayHelperImpl(); private static final Map plugins = Maps.newHashMap(); private static final ExecutorService SYNC_RECIPES = Executors.newSingleThreadScheduledExecutor(r -> new Thread(r, "REI-SyncRecipes")); private static ConfigManager configManager; - static { - LOGGER = LogManager.getFormatterLogger("REI"); - } - - @Deprecated + @ApiStatus.Internal public static RecipeHelper getRecipeHelper() { return RECIPE_HELPER; } - @Deprecated + @ApiStatus.Internal public static ConfigManager getConfigManager() { return configManager; } - @Deprecated + @ApiStatus.Internal public static EntryRegistry getEntryRegistry() { return ENTRY_REGISTRY; } - @Deprecated + @ApiStatus.Internal public static DisplayHelper getDisplayHelper() { return DISPLAY_HELPER; } @@ -135,8 +131,7 @@ public class RoughlyEnoughItemsCore implements ClientModInitializer { return ClientSidePacketRegistry.INSTANCE.canServerReceive(RoughlyEnoughItemsNetwork.CREATE_ITEMS_PACKET) && ClientSidePacketRegistry.INSTANCE.canServerReceive(RoughlyEnoughItemsNetwork.DELETE_ITEMS_PACKET); } - @Internal - @Deprecated + @ApiStatus.Internal public static void syncRecipes(AtomicLong lastSync) { if (lastSync != null) { if (lastSync.get() > 0 && System.currentTimeMillis() - lastSync.get() <= 5000) { @@ -153,7 +148,6 @@ public class RoughlyEnoughItemsCore implements ClientModInitializer { } } - @SuppressWarnings("deprecation") @Override public void onInitializeClient() { configManager = new ConfigManagerImpl(); @@ -161,7 +155,8 @@ public class RoughlyEnoughItemsCore implements ClientModInitializer { registerClothEvents(); discoverPluginEntries(); for (ModContainer modContainer : FabricLoader.getInstance().getAllMods()) { - if (modContainer.getMetadata().containsCustomValue("roughlyenoughitems:plugins")) + //noinspection deprecation + if (modContainer.getMetadata().containsCustomElement("roughlyenoughitems:plugins")) RoughlyEnoughItemsCore.LOGGER.error("[REI] REI plugin from " + modContainer.getMetadata().getId() + " is not loaded because it is too old!"); } @@ -201,7 +196,6 @@ public class RoughlyEnoughItemsCore implements ClientModInitializer { }); } - @SuppressWarnings("deprecation") private void discoverPluginEntries() { for (REIPluginEntry reiPlugin : FabricLoader.getInstance().getEntrypoints("rei_plugins", REIPluginEntry.class)) { try { @@ -226,7 +220,6 @@ public class RoughlyEnoughItemsCore implements ClientModInitializer { loadTestPlugins(); } - @SuppressWarnings("deprecation") private void loadTestPlugins() { if (System.getProperty("rei.test", "false").equals("true")) { registerPlugin(new REITestPlugin()); diff --git a/src/main/java/me/shedaniel/rei/api/AutoTransferHandler.java b/src/main/java/me/shedaniel/rei/api/AutoTransferHandler.java index c8e761e25..cb1dbeb08 100644 --- a/src/main/java/me/shedaniel/rei/api/AutoTransferHandler.java +++ b/src/main/java/me/shedaniel/rei/api/AutoTransferHandler.java @@ -17,6 +17,9 @@ import java.util.function.Supplier; public interface AutoTransferHandler { + /** + * @return the priority of this handler, higher priorities will be called first. + */ default double getPriority() { return 0d; } diff --git a/src/main/java/me/shedaniel/rei/api/BaseBoundsHandler.java b/src/main/java/me/shedaniel/rei/api/BaseBoundsHandler.java index 84b8574a6..4f2c3480c 100644 --- a/src/main/java/me/shedaniel/rei/api/BaseBoundsHandler.java +++ b/src/main/java/me/shedaniel/rei/api/BaseBoundsHandler.java @@ -9,6 +9,7 @@ import com.google.common.collect.Lists; import me.shedaniel.math.api.Rectangle; import me.shedaniel.rei.RoughlyEnoughItemsCore; import net.minecraft.client.gui.screen.Screen; +import org.jetbrains.annotations.ApiStatus; import java.util.List; import java.util.function.Function; @@ -23,11 +24,13 @@ public interface BaseBoundsHandler extends DisplayHelper.DisplayBoundsHandler getCurrentExclusionZones(Class currentScreenClass, boolean isOnRightSide) { return getExclusionZones(currentScreenClass, false); } @Deprecated + @ApiStatus.ScheduledForRemoval default List getCurrentExclusionZones(Class currentScreenClass, boolean isOnRightSide, boolean sort) { return getExclusionZones(currentScreenClass, sort); } @@ -41,8 +44,10 @@ public interface BaseBoundsHandler extends DisplayHelper.DisplayBoundsHandler the list of exclusion zones + * @see #registerExclusionZones(Class, Supplier) for non deprecated version */ @Deprecated + @ApiStatus.ScheduledForRemoval default void registerExclusionZones(Class screenClass, Function> supplier) { RoughlyEnoughItemsCore.LOGGER.warn("[REI] Someone is registering exclusion zones with the deprecated method: " + supplier.getClass().getName()); registerExclusionZones(screenClass, () -> { @@ -52,6 +57,12 @@ public interface BaseBoundsHandler extends DisplayHelper.DisplayBoundsHandler screenClass, Supplier> supplier); } diff --git a/src/main/java/me/shedaniel/rei/api/ButtonAreaSupplier.java b/src/main/java/me/shedaniel/rei/api/ButtonAreaSupplier.java index 8ec5f3527..e1b3f8bcc 100644 --- a/src/main/java/me/shedaniel/rei/api/ButtonAreaSupplier.java +++ b/src/main/java/me/shedaniel/rei/api/ButtonAreaSupplier.java @@ -7,6 +7,9 @@ package me.shedaniel.rei.api; import me.shedaniel.math.api.Rectangle; +/** + * The supplier for the + button area. + */ public interface ButtonAreaSupplier { /** diff --git a/src/main/java/me/shedaniel/rei/api/ClientHelper.java b/src/main/java/me/shedaniel/rei/api/ClientHelper.java index 112037403..54f8940c4 100644 --- a/src/main/java/me/shedaniel/rei/api/ClientHelper.java +++ b/src/main/java/me/shedaniel/rei/api/ClientHelper.java @@ -9,6 +9,7 @@ import me.shedaniel.rei.impl.ClientHelperImpl; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.Identifier; +import org.jetbrains.annotations.ApiStatus; import java.util.List; import java.util.Map; @@ -52,6 +53,7 @@ public interface ClientHelper { /** * Registers REI's keybinds using Fabric API. */ + @ApiStatus.Internal void registerFabricKeyBinds(); /** diff --git a/src/main/java/me/shedaniel/rei/api/ConfigManager.java b/src/main/java/me/shedaniel/rei/api/ConfigManager.java index ca11825ba..b4dda9dbe 100644 --- a/src/main/java/me/shedaniel/rei/api/ConfigManager.java +++ b/src/main/java/me/shedaniel/rei/api/ConfigManager.java @@ -6,7 +6,9 @@ package me.shedaniel.rei.api; import me.shedaniel.rei.RoughlyEnoughItemsCore; +import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.Screen; +import org.jetbrains.annotations.ApiStatus; import java.util.List; @@ -31,6 +33,7 @@ public interface ConfigManager { * @deprecated Use {@link ConfigObject#getInstance()} */ @Deprecated + @ApiStatus.ScheduledForRemoval ConfigObject getConfig(); /** @@ -50,7 +53,9 @@ public interface ConfigManager { * * @param parent the screen shown before */ - void openConfigScreen(Screen parent); + default void openConfigScreen(Screen parent) { + MinecraftClient.getInstance().openScreen(getConfigScreen(parent)); + } /** * Gets the config screen diff --git a/src/main/java/me/shedaniel/rei/api/ConfigObject.java b/src/main/java/me/shedaniel/rei/api/ConfigObject.java index d7b39078f..9f9229d7a 100644 --- a/src/main/java/me/shedaniel/rei/api/ConfigObject.java +++ b/src/main/java/me/shedaniel/rei/api/ConfigObject.java @@ -11,6 +11,7 @@ import me.shedaniel.rei.gui.config.RecipeScreenType; import me.shedaniel.rei.gui.config.SearchFieldLocation; import me.shedaniel.rei.impl.ConfigObjectImpl; import net.minecraft.client.util.InputUtil; +import org.jetbrains.annotations.ApiStatus; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; @@ -24,6 +25,8 @@ public interface ConfigObject { return ConfigManager.getInstance().getConfig(); } + @Deprecated + @ApiStatus.ScheduledForRemoval boolean isLighterButtonHover(); boolean isOverlayVisible(); @@ -125,7 +128,7 @@ public interface ConfigObject { double getEntrySize(); @Deprecated - abstract ConfigObjectImpl.General getGeneral(); + ConfigObjectImpl.General getGeneral(); boolean isUsingCompactTabs(); diff --git a/src/main/java/me/shedaniel/rei/api/DisplayVisibilityHandler.java b/src/main/java/me/shedaniel/rei/api/DisplayVisibilityHandler.java index 5e6cde696..3f5ed9dfa 100644 --- a/src/main/java/me/shedaniel/rei/api/DisplayVisibilityHandler.java +++ b/src/main/java/me/shedaniel/rei/api/DisplayVisibilityHandler.java @@ -10,7 +10,7 @@ import net.minecraft.util.ActionResult; public interface DisplayVisibilityHandler { /** - * Gets the priority of the handler + * Gets the priority of the handler, the higher the priority, the earlier this is called. * * @return the priority */ diff --git a/src/main/java/me/shedaniel/rei/api/EntryRegistry.java b/src/main/java/me/shedaniel/rei/api/EntryRegistry.java index 01539e374..a658f5f27 100644 --- a/src/main/java/me/shedaniel/rei/api/EntryRegistry.java +++ b/src/main/java/me/shedaniel/rei/api/EntryRegistry.java @@ -9,6 +9,7 @@ import me.shedaniel.rei.RoughlyEnoughItemsCore; import me.shedaniel.rei.utils.CollectionUtils; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import org.jetbrains.annotations.ApiStatus; import java.util.Arrays; import java.util.Collection; @@ -60,6 +61,7 @@ public interface EntryRegistry { * @param checkAlreadyContains whether the list should check if it is already on the list */ @Deprecated + @ApiStatus.Internal void registerEntryAfter(EntryStack afterEntry, EntryStack stack, boolean checkAlreadyContains); diff --git a/src/main/java/me/shedaniel/rei/api/EntryStack.java b/src/main/java/me/shedaniel/rei/api/EntryStack.java index 65c0ccd2b..d35e07693 100644 --- a/src/main/java/me/shedaniel/rei/api/EntryStack.java +++ b/src/main/java/me/shedaniel/rei/api/EntryStack.java @@ -8,7 +8,6 @@ package me.shedaniel.rei.api; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import me.shedaniel.math.api.Rectangle; -import me.shedaniel.rei.api.annotations.Internal; import me.shedaniel.rei.gui.widget.QueuedTooltip; import me.shedaniel.rei.impl.EmptyEntryStack; import me.shedaniel.rei.impl.FluidEntryStack; @@ -22,8 +21,9 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.StringNbtReader; import net.minecraft.util.Identifier; import net.minecraft.util.registry.Registry; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.util.Collections; import java.util.List; import java.util.Optional; @@ -53,8 +53,7 @@ public interface EntryStack { return new ItemEntryStack(new ItemStack(item)); } - @Internal - @Deprecated + @ApiStatus.Internal static EntryStack readFromJson(JsonElement jsonElement) { try { JsonObject obj = jsonElement.getAsJsonObject(); @@ -74,8 +73,7 @@ public interface EntryStack { } } - @Internal - @Deprecated + @ApiStatus.Internal @Nullable default JsonElement toJson() { try { @@ -86,9 +84,12 @@ public interface EntryStack { obj1.addProperty("nbt", getItemStack().toTag(new CompoundTag()).toString()); return obj1; case FLUID: + Optional optionalIdentifier = getIdentifier(); + if (!optionalIdentifier.isPresent()) + throw new NullPointerException("Invalid Fluid: " + toString()); JsonObject obj2 = new JsonObject(); obj2.addProperty("type", "fluid"); - obj2.addProperty("id", getIdentifier().get().toString()); + obj2.addProperty("id", optionalIdentifier.get().toString()); return obj2; case EMPTY: JsonObject obj3 = new JsonObject(); @@ -173,8 +174,7 @@ public interface EntryStack { T get(Settings settings); - @Nullable - QueuedTooltip getTooltip(int mouseX, int mouseY); + @Nullable QueuedTooltip getTooltip(int mouseX, int mouseY); void render(Rectangle bounds, int mouseX, int mouseY, float delta); @@ -193,8 +193,8 @@ public interface EntryStack { public static final Settings> TOOLTIP_ENABLED = new Settings<>(TRUE); public static final Settings> TOOLTIP_APPEND_MOD = new Settings<>(TRUE); public static final Settings> RENDER_COUNTS = new Settings<>(TRUE); - public static final Settings>> TOOLTIP_APPEND_EXTRA = new Settings>>(stack -> Collections.emptyList()); - public static final Settings> COUNTS = new Settings>(stack -> null); + public static final Settings>> TOOLTIP_APPEND_EXTRA = new Settings<>(stack -> Collections.emptyList()); + public static final Settings> COUNTS = new Settings<>(stack -> null); private T defaultValue; @@ -208,7 +208,7 @@ public interface EntryStack { public static class Item { public static final Settings> RENDER_ENCHANTMENT_GLINT = new Settings<>(TRUE); - @Deprecated public static final Settings> RENDER_OVERLAY = RENDER_ENCHANTMENT_GLINT; + @Deprecated @ApiStatus.ScheduledForRemoval public static final Settings> RENDER_OVERLAY = RENDER_ENCHANTMENT_GLINT; private Item() { } @@ -216,7 +216,7 @@ public interface EntryStack { public static class Fluid { // Return null to disable - public static final Settings> AMOUNT_TOOLTIP = new Settings>(stack -> I18n.translate("tooltip.rei.fluid_amount", stack.getAmount())); + public static final Settings> AMOUNT_TOOLTIP = new Settings<>(stack -> I18n.translate("tooltip.rei.fluid_amount", stack.getAmount())); private Fluid() { } diff --git a/src/main/java/me/shedaniel/rei/api/ItemStackHook.java b/src/main/java/me/shedaniel/rei/api/ItemStackHook.java index 545bd8f46..8d869d910 100644 --- a/src/main/java/me/shedaniel/rei/api/ItemStackHook.java +++ b/src/main/java/me/shedaniel/rei/api/ItemStackHook.java @@ -5,10 +5,9 @@ package me.shedaniel.rei.api; -import me.shedaniel.rei.api.annotations.Internal; +import org.jetbrains.annotations.ApiStatus; -@Internal -@Deprecated +@ApiStatus.Internal public interface ItemStackHook { void rei_setRenderEnchantmentGlint(boolean b); } diff --git a/src/main/java/me/shedaniel/rei/api/ObjectHolder.java b/src/main/java/me/shedaniel/rei/api/ObjectHolder.java index bf1dd3b5d..2e6c42a51 100644 --- a/src/main/java/me/shedaniel/rei/api/ObjectHolder.java +++ b/src/main/java/me/shedaniel/rei/api/ObjectHolder.java @@ -6,6 +6,7 @@ package me.shedaniel.rei.api; import me.shedaniel.rei.impl.ObjectHolderImpl; +import org.jetbrains.annotations.ApiStatus; public interface ObjectHolder { @SuppressWarnings("deprecation") @@ -14,31 +15,37 @@ public interface ObjectHolder { } @Deprecated + @ApiStatus.ScheduledForRemoval default int intValue() { return (int) (Object) value(); } @Deprecated + @ApiStatus.ScheduledForRemoval default long longValue() { return (long) (Object) value(); } @Deprecated + @ApiStatus.ScheduledForRemoval default boolean booleanValue() { return (boolean) (Object) value(); } @Deprecated + @ApiStatus.ScheduledForRemoval default float floatValue() { return (float) (Object) value(); } @Deprecated + @ApiStatus.ScheduledForRemoval default double doubleValue() { return (double) (Object) value(); } @Deprecated + @ApiStatus.ScheduledForRemoval default String stringValue() { return (String) value(); } diff --git a/src/main/java/me/shedaniel/rei/api/OptimalEntryStack.java b/src/main/java/me/shedaniel/rei/api/OptimalEntryStack.java index 0a98ccf72..4563b9dd3 100644 --- a/src/main/java/me/shedaniel/rei/api/OptimalEntryStack.java +++ b/src/main/java/me/shedaniel/rei/api/OptimalEntryStack.java @@ -6,10 +6,9 @@ package me.shedaniel.rei.api; import me.shedaniel.math.api.Rectangle; -import me.shedaniel.rei.api.annotations.Internal; +import org.jetbrains.annotations.ApiStatus; -@Internal -@Deprecated +@ApiStatus.Internal public interface OptimalEntryStack { default void optimisedRenderStart(float delta) { } diff --git a/src/main/java/me/shedaniel/rei/api/REIPluginEntry.java b/src/main/java/me/shedaniel/rei/api/REIPluginEntry.java index cdc5574cf..df7a21a17 100644 --- a/src/main/java/me/shedaniel/rei/api/REIPluginEntry.java +++ b/src/main/java/me/shedaniel/rei/api/REIPluginEntry.java @@ -8,12 +8,14 @@ package me.shedaniel.rei.api; import net.fabricmc.loader.api.SemanticVersion; import net.fabricmc.loader.util.version.VersionParsingException; import net.minecraft.util.Identifier; +import org.jetbrains.annotations.ApiStatus; /** * Get base class of a REI plugin. */ public interface REIPluginEntry { + @ApiStatus.OverrideOnly default SemanticVersion getMinimumVersion() throws VersionParsingException { return null; } diff --git a/src/main/java/me/shedaniel/rei/api/RecipeCategory.java b/src/main/java/me/shedaniel/rei/api/RecipeCategory.java index 7378fb862..1c1fa26c7 100644 --- a/src/main/java/me/shedaniel/rei/api/RecipeCategory.java +++ b/src/main/java/me/shedaniel/rei/api/RecipeCategory.java @@ -15,6 +15,7 @@ import me.shedaniel.rei.gui.widget.Widget; import me.shedaniel.rei.impl.ScreenHelper; import net.minecraft.client.gui.DrawableHelper; import net.minecraft.util.Identifier; +import org.jetbrains.annotations.ApiStatus; import java.util.Collections; import java.util.List; @@ -52,7 +53,7 @@ public interface RecipeCategory { * @param recipe the recipe to render * @return the recipe renderer */ - @SuppressWarnings("unchecked") + @ApiStatus.OverrideOnly default RecipeEntry getSimpleRenderer(T recipe) { return SimpleRecipeEntry.create(recipe::getInputEntries, recipe::getOutputEntries); } @@ -61,9 +62,10 @@ public interface RecipeCategory { * Setup the widgets for displaying the recipe * * @param recipeDisplaySupplier the supplier for getting the recipe - * @param bounds the bounds of the display, configurable with overriding {@link RecipeCategory#getDisplaySettings()} + * @param bounds the bounds of the display, configurable with overriding the width, height methods. * @return the list of widgets */ + @ApiStatus.OverrideOnly default List setupDisplay(Supplier recipeDisplaySupplier, Rectangle bounds) { return Collections.singletonList(new RecipeBaseWidget(bounds)); } @@ -76,6 +78,7 @@ public interface RecipeCategory { * @param mouseY the y coordinates for the mouse * @param delta the delta */ + @ApiStatus.OverrideOnly default void drawCategoryBackground(Rectangle bounds, int mouseX, int mouseY, float delta) { PanelWidget.render(bounds, -1); if (ScreenHelper.isDarkModeEnabled()) { @@ -131,6 +134,7 @@ public interface RecipeCategory { * @deprecated no longer used */ @Deprecated + @ApiStatus.ScheduledForRemoval default boolean checkTags() { return false; } diff --git a/src/main/java/me/shedaniel/rei/api/RecipeDisplay.java b/src/main/java/me/shedaniel/rei/api/RecipeDisplay.java index 328d28973..5258f8337 100644 --- a/src/main/java/me/shedaniel/rei/api/RecipeDisplay.java +++ b/src/main/java/me/shedaniel/rei/api/RecipeDisplay.java @@ -40,7 +40,7 @@ public interface RecipeDisplay { Identifier getRecipeCategory(); /** - * Gets the recipe location from datapack + * Gets the recipe location from datapack. * * @return the recipe location */ diff --git a/src/main/java/me/shedaniel/rei/api/RecipeHelper.java b/src/main/java/me/shedaniel/rei/api/RecipeHelper.java index 9c50febba..d86c99586 100644 --- a/src/main/java/me/shedaniel/rei/api/RecipeHelper.java +++ b/src/main/java/me/shedaniel/rei/api/RecipeHelper.java @@ -11,6 +11,7 @@ import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; import net.minecraft.recipe.Recipe; import net.minecraft.recipe.RecipeManager; import net.minecraft.util.Identifier; +import org.jetbrains.annotations.ApiStatus; import java.util.List; import java.util.Map; @@ -90,7 +91,7 @@ public interface RecipeHelper { */ Map, List> getRecipesFor(EntryStack stack); - RecipeCategory getCategory(Identifier identifier); + RecipeCategory getCategory(Identifier identifier); /** * Gets the vanilla recipe manager @@ -210,6 +211,7 @@ public interface RecipeHelper { List getScreenClickAreas(); + @ApiStatus.Internal boolean arePluginsLoading(); interface ScreenClickArea { diff --git a/src/main/java/me/shedaniel/rei/api/TransferRecipeCategory.java b/src/main/java/me/shedaniel/rei/api/TransferRecipeCategory.java index 093a9d365..1bac297ab 100644 --- a/src/main/java/me/shedaniel/rei/api/TransferRecipeCategory.java +++ b/src/main/java/me/shedaniel/rei/api/TransferRecipeCategory.java @@ -8,9 +8,11 @@ package me.shedaniel.rei.api; import it.unimi.dsi.fastutil.ints.IntList; import me.shedaniel.math.api.Rectangle; import me.shedaniel.rei.gui.widget.Widget; +import org.jetbrains.annotations.ApiStatus; import java.util.List; public interface TransferRecipeCategory extends RecipeCategory { + @ApiStatus.OverrideOnly void renderRedSlots(List widgets, Rectangle bounds, T display, IntList redSlots); } diff --git a/src/main/java/me/shedaniel/rei/api/annotations/Experimental.java b/src/main/java/me/shedaniel/rei/api/annotations/Experimental.java deleted file mode 100644 index e1c3f73f4..000000000 --- a/src/main/java/me/shedaniel/rei/api/annotations/Experimental.java +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Roughly Enough Items by Danielshe. - * Licensed under the MIT License. - */ - -package me.shedaniel.rei.api.annotations; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import static java.lang.annotation.ElementType.*; - -@Retention(RetentionPolicy.RUNTIME) -@Target(value = {CONSTRUCTOR, FIELD, LOCAL_VARIABLE, METHOD, PACKAGE, PARAMETER, TYPE}) -public @interface Experimental {} diff --git a/src/main/java/me/shedaniel/rei/api/annotations/Internal.java b/src/main/java/me/shedaniel/rei/api/annotations/Internal.java deleted file mode 100644 index 137286971..000000000 --- a/src/main/java/me/shedaniel/rei/api/annotations/Internal.java +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Roughly Enough Items by Danielshe. - * Licensed under the MIT License. - */ - -package me.shedaniel.rei.api.annotations; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import static java.lang.annotation.ElementType.*; - -@Retention(RetentionPolicy.RUNTIME) -@Target(value = {CONSTRUCTOR, FIELD, LOCAL_VARIABLE, METHOD, PACKAGE, PARAMETER, TYPE}) -public @interface Internal {} diff --git a/src/main/java/me/shedaniel/rei/api/annotations/ToBeRemoved.java b/src/main/java/me/shedaniel/rei/api/annotations/ToBeRemoved.java deleted file mode 100644 index 88be1932e..000000000 --- a/src/main/java/me/shedaniel/rei/api/annotations/ToBeRemoved.java +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Roughly Enough Items by Danielshe. - * Licensed under the MIT License. - */ - -package me.shedaniel.rei.api.annotations; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import static java.lang.annotation.ElementType.*; - -@Retention(RetentionPolicy.RUNTIME) -@Target(value = {CONSTRUCTOR, FIELD, LOCAL_VARIABLE, METHOD, PACKAGE, PARAMETER, TYPE}) -public @interface ToBeRemoved {} diff --git a/src/main/java/me/shedaniel/rei/api/plugins/REIPluginV0.java b/src/main/java/me/shedaniel/rei/api/plugins/REIPluginV0.java index 708bab589..e0776ba5e 100644 --- a/src/main/java/me/shedaniel/rei/api/plugins/REIPluginV0.java +++ b/src/main/java/me/shedaniel/rei/api/plugins/REIPluginV0.java @@ -9,7 +9,9 @@ import me.shedaniel.rei.api.DisplayHelper; import me.shedaniel.rei.api.EntryRegistry; import me.shedaniel.rei.api.REIPluginEntry; import me.shedaniel.rei.api.RecipeHelper; +import org.jetbrains.annotations.ApiStatus; +@ApiStatus.OverrideOnly public interface REIPluginV0 extends REIPluginEntry { /** @@ -17,6 +19,7 @@ public interface REIPluginV0 extends REIPluginEntry { * * @param entryRegistry the helper class */ + @ApiStatus.OverrideOnly default void registerEntries(EntryRegistry entryRegistry) { } @@ -25,6 +28,7 @@ public interface REIPluginV0 extends REIPluginEntry { * * @param recipeHelper the helper class */ + @ApiStatus.OverrideOnly default void registerPluginCategories(RecipeHelper recipeHelper) { } @@ -33,6 +37,7 @@ public interface REIPluginV0 extends REIPluginEntry { * * @param recipeHelper the helper class */ + @ApiStatus.OverrideOnly default void registerRecipeDisplays(RecipeHelper recipeHelper) { } @@ -41,6 +46,7 @@ public interface REIPluginV0 extends REIPluginEntry { * * @param displayHelper the helper class */ + @ApiStatus.OverrideOnly default void registerBounds(DisplayHelper displayHelper) { } @@ -49,12 +55,15 @@ public interface REIPluginV0 extends REIPluginEntry { * * @param recipeHelper the helper class */ + @ApiStatus.OverrideOnly default void registerOthers(RecipeHelper recipeHelper) { } + @ApiStatus.OverrideOnly default void preRegister() { } + @ApiStatus.OverrideOnly default void postRegister() { } diff --git a/src/main/java/me/shedaniel/rei/gui/ConfigReloadingScreen.java b/src/main/java/me/shedaniel/rei/gui/ConfigReloadingScreen.java index 696e8f25b..5dd22b06a 100644 --- a/src/main/java/me/shedaniel/rei/gui/ConfigReloadingScreen.java +++ b/src/main/java/me/shedaniel/rei/gui/ConfigReloadingScreen.java @@ -6,14 +6,13 @@ package me.shedaniel.rei.gui; import me.shedaniel.rei.api.RecipeHelper; -import me.shedaniel.rei.api.annotations.Internal; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.resource.language.I18n; import net.minecraft.client.util.NarratorManager; import net.minecraft.util.Util; +import org.jetbrains.annotations.ApiStatus; -@Deprecated -@Internal +@ApiStatus.Internal public class ConfigReloadingScreen extends Screen { private Screen parent; diff --git a/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java b/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java index 576f74ee6..ebf883e5f 100644 --- a/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java +++ b/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java @@ -37,10 +37,12 @@ import net.minecraft.util.ActionResult; import net.minecraft.util.Identifier; import net.minecraft.world.GameMode; import org.apache.logging.log4j.util.TriConsumer; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.util.*; +@ApiStatus.Internal public class ContainerScreenOverlay extends WidgetWithBounds { private static final Identifier CHEST_GUI_TEXTURE = new Identifier("roughlyenoughitems", "textures/gui/recipecontainer.png"); @@ -118,9 +120,7 @@ public class ContainerScreenOverlay extends WidgetWithBounds { } ScreenHelper.getSearchField().getBounds().setBounds(getTextFieldArea()); this.widgets.add(ScreenHelper.getSearchField()); - ScreenHelper.getSearchField().setChangedListener(s -> { - ENTRY_LIST_WIDGET.updateSearch(s); - }); + ScreenHelper.getSearchField().setChangedListener(ENTRY_LIST_WIDGET::updateSearch); if (!ConfigObject.getInstance().isEntryListWidgetScrolled()) { widgets.add(buttonLeft = new ButtonWidget(new Rectangle(rectangle.x, rectangle.y + (ConfigObject.getInstance().getSearchFieldLocation() == SearchFieldLocation.TOP_SIDE ? 24 : 0) + 5, 16, 16), I18n.translate("text.rei.left_arrow")) { @Override diff --git a/src/main/java/me/shedaniel/rei/gui/OverlaySearchField.java b/src/main/java/me/shedaniel/rei/gui/OverlaySearchField.java index 31b4a5d7b..6c039597e 100644 --- a/src/main/java/me/shedaniel/rei/gui/OverlaySearchField.java +++ b/src/main/java/me/shedaniel/rei/gui/OverlaySearchField.java @@ -9,7 +9,6 @@ import com.google.common.collect.Lists; import com.mojang.blaze3d.systems.RenderSystem; import me.shedaniel.math.api.Point; import me.shedaniel.math.impl.PointHelper; -import me.shedaniel.rei.api.annotations.Internal; import me.shedaniel.rei.gui.widget.TextFieldWidget; import me.shedaniel.rei.impl.ScreenHelper; import net.minecraft.client.MinecraftClient; @@ -18,11 +17,11 @@ import net.minecraft.client.sound.PositionedSoundInstance; import net.minecraft.client.util.InputUtil; import net.minecraft.sound.SoundEvents; import net.minecraft.util.Pair; +import org.jetbrains.annotations.ApiStatus; import java.util.List; -@Internal -@Deprecated +@ApiStatus.Internal public class OverlaySearchField extends TextFieldWidget { public static boolean isSearching = false; @@ -43,8 +42,7 @@ public class OverlaySearchField extends TextFieldWidget { super.setFocused(boolean_1); } - @Deprecated - @Internal + @ApiStatus.Internal public void addToHistory(String text) { if (!text.isEmpty()) { history.removeIf(str -> str.equalsIgnoreCase(text)); @@ -54,7 +52,6 @@ public class OverlaySearchField extends TextFieldWidget { } } - @SuppressWarnings("deprecation") public void laterRender(int int_1, int int_2, float float_1) { RenderSystem.disableDepthTest(); setEditableColor(ContainerScreenOverlay.getEntryListWidget().getAllStacks().isEmpty() && !getText().isEmpty() ? 16733525 : isSearching ? -852212 : (containsMouse(PointHelper.fromMouse()) || isFocused()) ? (ScreenHelper.isDarkModeEnabled() ? -17587 : -1) : -6250336); @@ -71,7 +68,6 @@ public class OverlaySearchField extends TextFieldWidget { this.font.drawWithShadow(this.font.trimToWidth(this.getSuggestion(), this.getWidth()), x, y, -6250336); } - @SuppressWarnings("deprecation") @Override public void renderBorder() { boolean hasError = ContainerScreenOverlay.getEntryListWidget().getAllStacks().isEmpty() && !getText().isEmpty(); diff --git a/src/main/java/me/shedaniel/rei/gui/PreRecipeViewingScreen.java b/src/main/java/me/shedaniel/rei/gui/PreRecipeViewingScreen.java index 1220a4df2..1bc99288b 100644 --- a/src/main/java/me/shedaniel/rei/gui/PreRecipeViewingScreen.java +++ b/src/main/java/me/shedaniel/rei/gui/PreRecipeViewingScreen.java @@ -11,7 +11,6 @@ import me.shedaniel.clothconfig2.gui.widget.DynamicNewSmoothScrollingEntryListWi import me.shedaniel.clothconfig2.impl.EasingMethod; import me.shedaniel.math.api.Point; import me.shedaniel.math.api.Rectangle; -import me.shedaniel.rei.api.annotations.Internal; import me.shedaniel.rei.gui.config.RecipeScreenType; import me.shedaniel.rei.gui.widget.ButtonWidget; import me.shedaniel.rei.gui.widget.LabelWidget; @@ -27,16 +26,18 @@ import net.minecraft.text.TranslatableText; import net.minecraft.util.Formatting; import net.minecraft.util.Identifier; import net.minecraft.util.math.MathHelper; +import org.jetbrains.annotations.ApiStatus; import java.util.Collections; import java.util.List; -@Internal -@Deprecated +@ApiStatus.Internal public class PreRecipeViewingScreen extends Screen { private static final Identifier IDENTIFIER = new Identifier("roughlyenoughitems", "textures/gui/screenshot.png"); private final List widgets; + protected long start; + protected long duration; private boolean isSet; private boolean original; private double frame = 0; @@ -44,8 +45,6 @@ public class PreRecipeViewingScreen extends Screen { private BooleanConsumer callback; private Screen parent; private boolean showTips; - protected long start; - protected long duration; public PreRecipeViewingScreen(Screen parent, RecipeScreenType type, boolean showTips, BooleanConsumer callback) { super(new TranslatableText("text.rei.recipe_screen_type.selection")); diff --git a/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java b/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java index e4fa346be..d9fab6dca 100644 --- a/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java +++ b/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java @@ -11,7 +11,6 @@ import me.shedaniel.math.api.Point; import me.shedaniel.math.api.Rectangle; import me.shedaniel.math.impl.PointHelper; import me.shedaniel.rei.api.*; -import me.shedaniel.rei.api.annotations.Internal; import me.shedaniel.rei.gui.widget.*; import me.shedaniel.rei.impl.ScreenHelper; import me.shedaniel.rei.utils.CollectionUtils; @@ -26,17 +25,16 @@ import net.minecraft.text.LiteralText; import net.minecraft.util.Formatting; import net.minecraft.util.Identifier; import net.minecraft.util.math.MathHelper; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.util.*; import java.util.function.Supplier; -@Deprecated -@Internal +@ApiStatus.Internal public class RecipeViewingScreen extends Screen { public static final Identifier CHEST_GUI_TEXTURE = new Identifier("roughlyenoughitems", "textures/gui/recipecontainer.png"); - private int tabsPerPage = 5; private final List preWidgets; private final List widgets; private final List tabs; @@ -48,6 +46,7 @@ public class RecipeViewingScreen extends Screen { public int largestWidth, largestHeight; public boolean choosePageActivated; public RecipeChoosePageWidget recipeChoosePageWidget; + private int tabsPerPage = 5; private Rectangle bounds; @Nullable private CategoryBaseWidget workingStationsBaseWidget; private RecipeCategory selectedCategory; @@ -72,6 +71,23 @@ public class RecipeViewingScreen extends Screen { this.choosePageActivated = false; } + static void transformNotice(List setupDisplay, EntryStack mainStackToNotice) { + if (mainStackToNotice.isEmpty()) + return; + for (Widget widget : setupDisplay) { + if (widget instanceof EntryWidget) { + EntryWidget entry = (EntryWidget) widget; + if (entry.entries().size() > 1) { + EntryStack stack = CollectionUtils.firstOrNullEqualsAll(entry.entries(), mainStackToNotice); + if (stack != null) { + entry.clearStacks(); + entry.entry(stack); + } + } + } + } + } + public void addMainStackToNotice(EntryStack stack) { this.mainStackToNotice = stack; } @@ -343,36 +359,6 @@ public class RecipeViewingScreen extends Screen { children.addAll(preWidgets); } - static void transformNotice(List setupDisplay, EntryStack mainStackToNotice) { - if (mainStackToNotice.isEmpty()) - return; - for (Widget widget : setupDisplay) { - if (widget instanceof EntryWidget) { - EntryWidget entry = (EntryWidget) widget; - if (entry.entries().size() > 1) { - EntryStack stack = CollectionUtils.firstOrNullEqualsAll(entry.entries(), mainStackToNotice); - if (stack != null) { - entry.clearStacks(); - entry.entry(stack); - } - } - } - } - } - - public static class WorkstationSlotWidget extends EntryWidget { - public WorkstationSlotWidget(int x, int y, List widgets) { - super(new Point(x, y)); - entries(widgets); - noBackground(); - } - - @Override - public boolean containsMouse(double mouseX, double mouseY) { - return getInnerBounds().contains(mouseX, mouseY); - } - } - public List getWidgets() { return widgets; } @@ -398,7 +384,6 @@ public class RecipeViewingScreen extends Screen { return categoryPages; } - @SuppressWarnings("deprecation") private int getRecipesPerPage() { if (selectedCategory.getFixedRecipesPerPage() > 0) return selectedCategory.getFixedRecipesPerPage() - 1; @@ -534,4 +519,17 @@ public class RecipeViewingScreen extends Screen { return super.getFocused(); } + public static class WorkstationSlotWidget extends EntryWidget { + public WorkstationSlotWidget(int x, int y, List widgets) { + super(new Point(x, y)); + entries(widgets); + noBackground(); + } + + @Override + public boolean containsMouse(double mouseX, double mouseY) { + return getInnerBounds().contains(mouseX, mouseY); + } + } + } diff --git a/src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java b/src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java index f12f7e8d1..1e2cb1c53 100644 --- a/src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java +++ b/src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java @@ -14,7 +14,6 @@ import me.shedaniel.math.api.Point; import me.shedaniel.math.api.Rectangle; import me.shedaniel.math.impl.PointHelper; import me.shedaniel.rei.api.*; -import me.shedaniel.rei.api.annotations.Internal; import me.shedaniel.rei.gui.entries.RecipeEntry; import me.shedaniel.rei.gui.widget.*; import me.shedaniel.rei.impl.ScreenHelper; @@ -32,17 +31,16 @@ import net.minecraft.text.LiteralText; import net.minecraft.text.TranslatableText; import net.minecraft.util.Formatting; import net.minecraft.util.math.MathHelper; +import org.jetbrains.annotations.ApiStatus; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Optional; -@Deprecated -@Internal +@ApiStatus.Internal public class VillagerRecipeViewingScreen extends Screen { - private int tabsPerPage = 8; private final Map, List> categoryMap; private final List> categories; private final List widgets; @@ -50,6 +48,7 @@ public class VillagerRecipeViewingScreen extends Screen { private final List recipeRenderers; private final List tabs; public Rectangle bounds, scrollListBounds; + private int tabsPerPage = 8; private int selectedCategoryIndex, selectedRecipeIndex; private double scroll; private double target; @@ -244,14 +243,6 @@ public class VillagerRecipeViewingScreen extends Screen { ScreenHelper.getLastOverlay().init(); } - private final double clamp(double v) { - return clamp(v, 200); - } - - private final double clamp(double v, double clampExtension) { - return MathHelper.clamp(v, -clampExtension, getMaxScroll() + clampExtension); - } - private double getMaxScroll() { return Math.max(0, this.getMaxScrollPosition() - (scrollListBounds.height - 2)); } @@ -289,7 +280,7 @@ public class VillagerRecipeViewingScreen extends Screen { } public void scrollTo(double value, boolean animated, long duration) { - target = clamp(value); + target = ClothConfigInitializer.clamp(value, getMaxScroll()); if (animated) { start = System.currentTimeMillis(); @@ -366,8 +357,7 @@ public class VillagerRecipeViewingScreen extends Screen { ScreenHelper.getLastOverlay().render(mouseX, mouseY, delta); RenderSystem.pushMatrix(); ScissorsHandler.INSTANCE.scissor(new Rectangle(0, scrollListBounds.y + 1, width, scrollListBounds.height - 2)); - for (int i = 0; i < buttonWidgets.size(); i++) { - ButtonWidget buttonWidget = buttonWidgets.get(i); + for (ButtonWidget buttonWidget : buttonWidgets) { buttonWidget.getBounds().y = scrollListBounds.y + 1 + yOffset - (int) scroll; if (buttonWidget.getBounds().getMaxY() > scrollListBounds.getMinY() && buttonWidget.getBounds().getMinY() < scrollListBounds.getMaxY()) { buttonWidget.render(mouseX, mouseY, delta); diff --git a/src/main/java/me/shedaniel/rei/gui/config/ItemCheatingMode.java b/src/main/java/me/shedaniel/rei/gui/config/ItemCheatingMode.java index 6b5189193..6ddf86fe0 100644 --- a/src/main/java/me/shedaniel/rei/gui/config/ItemCheatingMode.java +++ b/src/main/java/me/shedaniel/rei/gui/config/ItemCheatingMode.java @@ -6,9 +6,11 @@ package me.shedaniel.rei.gui.config; import net.minecraft.client.resource.language.I18n; +import org.jetbrains.annotations.ApiStatus; import java.util.Locale; +@ApiStatus.Internal public enum ItemCheatingMode { REI_LIKE, JEI_LIKE; diff --git a/src/main/java/me/shedaniel/rei/gui/config/ItemListOrdering.java b/src/main/java/me/shedaniel/rei/gui/config/ItemListOrdering.java index dd584bc69..eafd09c0c 100644 --- a/src/main/java/me/shedaniel/rei/gui/config/ItemListOrdering.java +++ b/src/main/java/me/shedaniel/rei/gui/config/ItemListOrdering.java @@ -5,6 +5,9 @@ package me.shedaniel.rei.gui.config; +import org.jetbrains.annotations.ApiStatus; + +@ApiStatus.Internal public enum ItemListOrdering { registry("ordering.rei.registry"), diff --git a/src/main/java/me/shedaniel/rei/gui/config/ItemListOrderingConfig.java b/src/main/java/me/shedaniel/rei/gui/config/ItemListOrderingConfig.java index 9d4a46ec2..baf6cce39 100644 --- a/src/main/java/me/shedaniel/rei/gui/config/ItemListOrderingConfig.java +++ b/src/main/java/me/shedaniel/rei/gui/config/ItemListOrderingConfig.java @@ -6,7 +6,9 @@ package me.shedaniel.rei.gui.config; import net.minecraft.client.resource.language.I18n; +import org.jetbrains.annotations.ApiStatus; +@ApiStatus.Internal public enum ItemListOrderingConfig { REGISTRY_ASCENDING(ItemListOrdering.registry, true), NAME_ASCENDING(ItemListOrdering.name, true), diff --git a/src/main/java/me/shedaniel/rei/gui/config/RecipeScreenType.java b/src/main/java/me/shedaniel/rei/gui/config/RecipeScreenType.java index 0c9233867..e52de7afe 100644 --- a/src/main/java/me/shedaniel/rei/gui/config/RecipeScreenType.java +++ b/src/main/java/me/shedaniel/rei/gui/config/RecipeScreenType.java @@ -6,9 +6,11 @@ package me.shedaniel.rei.gui.config; import net.minecraft.client.resource.language.I18n; +import org.jetbrains.annotations.ApiStatus; import java.util.Locale; +@ApiStatus.Internal public enum RecipeScreenType { UNSET, ORIGINAL, diff --git a/src/main/java/me/shedaniel/rei/gui/config/SearchFieldLocation.java b/src/main/java/me/shedaniel/rei/gui/config/SearchFieldLocation.java index bf914a8de..505f70f59 100644 --- a/src/main/java/me/shedaniel/rei/gui/config/SearchFieldLocation.java +++ b/src/main/java/me/shedaniel/rei/gui/config/SearchFieldLocation.java @@ -6,9 +6,11 @@ package me.shedaniel.rei.gui.config; import net.minecraft.client.resource.language.I18n; +import org.jetbrains.annotations.ApiStatus; import java.util.Locale; +@ApiStatus.Internal public enum SearchFieldLocation { CENTER, BOTTOM_SIDE, diff --git a/src/main/java/me/shedaniel/rei/gui/credits/CreditsEntryListWidget.java b/src/main/java/me/shedaniel/rei/gui/credits/CreditsEntryListWidget.java index e76c9294e..253233e59 100644 --- a/src/main/java/me/shedaniel/rei/gui/credits/CreditsEntryListWidget.java +++ b/src/main/java/me/shedaniel/rei/gui/credits/CreditsEntryListWidget.java @@ -9,7 +9,9 @@ import me.shedaniel.clothconfig2.gui.widget.DynamicNewSmoothScrollingEntryListWi import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.DrawableHelper; import net.minecraft.text.Text; +import org.jetbrains.annotations.ApiStatus; +@ApiStatus.Internal public class CreditsEntryListWidget extends DynamicNewSmoothScrollingEntryListWidget { private boolean inFocus; diff --git a/src/main/java/me/shedaniel/rei/gui/credits/CreditsScreen.java b/src/main/java/me/shedaniel/rei/gui/credits/CreditsScreen.java index df4c59561..40bb551f0 100644 --- a/src/main/java/me/shedaniel/rei/gui/credits/CreditsScreen.java +++ b/src/main/java/me/shedaniel/rei/gui/credits/CreditsScreen.java @@ -15,10 +15,12 @@ import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; import net.minecraft.client.gui.widget.AbstractPressableButtonWidget; import net.minecraft.client.resource.language.I18n; import net.minecraft.text.LiteralText; +import org.jetbrains.annotations.ApiStatus; import java.util.List; import java.util.stream.Collectors; +@ApiStatus.Internal public class CreditsScreen extends Screen { private Screen parent; diff --git a/src/main/java/me/shedaniel/rei/gui/entries/RecipeEntry.java b/src/main/java/me/shedaniel/rei/gui/entries/RecipeEntry.java index 42e93f467..b4303e787 100644 --- a/src/main/java/me/shedaniel/rei/gui/entries/RecipeEntry.java +++ b/src/main/java/me/shedaniel/rei/gui/entries/RecipeEntry.java @@ -7,7 +7,9 @@ package me.shedaniel.rei.gui.entries; import me.shedaniel.rei.gui.widget.QueuedTooltip; import me.shedaniel.rei.impl.RenderingEntry; +import org.jetbrains.annotations.ApiStatus; +@ApiStatus.OverrideOnly public abstract class RecipeEntry extends RenderingEntry { public abstract QueuedTooltip getTooltip(int mouseX, int mouseY); diff --git a/src/main/java/me/shedaniel/rei/gui/entries/SimpleRecipeEntry.java b/src/main/java/me/shedaniel/rei/gui/entries/SimpleRecipeEntry.java index c9fe5c05d..93ca6093c 100644 --- a/src/main/java/me/shedaniel/rei/gui/entries/SimpleRecipeEntry.java +++ b/src/main/java/me/shedaniel/rei/gui/entries/SimpleRecipeEntry.java @@ -15,8 +15,9 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.util.Identifier; import net.minecraft.util.Pair; import net.minecraft.util.math.MathHelper; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.util.Comparator; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; @@ -30,6 +31,7 @@ public class SimpleRecipeEntry extends RecipeEntry { private List inputWidgets; private EntryWidget outputWidget; + @ApiStatus.Internal protected SimpleRecipeEntry(List> input, List output) { List, AtomicInteger>> newList = Lists.newArrayList(); List, Integer>> a = CollectionUtils.map(input, stacks -> new Pair<>(stacks, stacks.stream().map(EntryStack::getAmount).max(Integer::compareTo).orElse(1))); diff --git a/src/main/java/me/shedaniel/rei/gui/toast/CopyRecipeIdentifierToast.java b/src/main/java/me/shedaniel/rei/gui/toast/CopyRecipeIdentifierToast.java index 7169e13d6..c256f4c3d 100644 --- a/src/main/java/me/shedaniel/rei/gui/toast/CopyRecipeIdentifierToast.java +++ b/src/main/java/me/shedaniel/rei/gui/toast/CopyRecipeIdentifierToast.java @@ -10,9 +10,10 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.toast.Toast; import net.minecraft.client.toast.ToastManager; import net.minecraft.util.Identifier; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; - +@ApiStatus.Internal public class CopyRecipeIdentifierToast implements Toast { protected static final Identifier TOASTS_TEX = new Identifier("roughlyenoughitems", "textures/gui/toasts.png"); diff --git a/src/main/java/me/shedaniel/rei/gui/widget/AutoCraftingButtonWidget.java b/src/main/java/me/shedaniel/rei/gui/widget/AutoCraftingButtonWidget.java index 0fe31025b..c0d37da28 100644 --- a/src/main/java/me/shedaniel/rei/gui/widget/AutoCraftingButtonWidget.java +++ b/src/main/java/me/shedaniel/rei/gui/widget/AutoCraftingButtonWidget.java @@ -11,7 +11,6 @@ import me.shedaniel.math.api.Point; import me.shedaniel.math.api.Rectangle; import me.shedaniel.math.impl.PointHelper; import me.shedaniel.rei.api.*; -import me.shedaniel.rei.api.annotations.Internal; import me.shedaniel.rei.gui.toast.CopyRecipeIdentifierToast; import me.shedaniel.rei.impl.ScreenHelper; import net.minecraft.client.MinecraftClient; @@ -20,6 +19,7 @@ import net.minecraft.client.resource.language.I18n; import net.minecraft.util.Formatting; import net.minecraft.util.Identifier; import net.minecraft.util.Lazy; +import org.jetbrains.annotations.ApiStatus; import java.time.LocalDateTime; import java.util.List; @@ -28,11 +28,10 @@ import java.util.UUID; import java.util.function.Supplier; import java.util.stream.Collectors; -@Internal -@Deprecated +@ApiStatus.Internal public class AutoCraftingButtonWidget extends ButtonWidget { - private static final Lazy IS_YOG = new Lazy(() -> { + private static final Lazy IS_YOG = new Lazy<>(() -> { try { if (MinecraftClient.getInstance().getSession().getProfile().getId().equals(UUID.fromString("f9546389-9415-4358-9c29-2c26b25bff5b"))) return true; @@ -54,7 +53,7 @@ public class AutoCraftingButtonWidget extends ButtonWidget { public AutoCraftingButtonWidget(Rectangle displayBounds, Rectangle rectangle, String text, Supplier displaySupplier, List setupDisplay, RecipeCategory recipeCategory) { super(rectangle, text); this.displayBounds = displayBounds; - this.displaySupplier = () -> displaySupplier.get(); + this.displaySupplier = displaySupplier; Optional recipe = displaySupplier.get().getRecipeLocation(); extraTooltip = recipe.isPresent() ? I18n.translate("text.rei.recipe_id", Formatting.GRAY.toString(), recipe.get().toString()) : ""; this.containerScreen = ScreenHelper.getLastContainerScreen(); @@ -124,7 +123,7 @@ public class AutoCraftingButtonWidget extends ButtonWidget { errorTooltip = error == null || error.isEmpty() ? null : Lists.newArrayList(); if (errorTooltip != null) { for (String s : error) { - if (!errorTooltip.stream().anyMatch(ss -> ss.equalsIgnoreCase(s))) + if (errorTooltip.stream().noneMatch(ss -> ss.equalsIgnoreCase(s))) errorTooltip.add(s); } } @@ -150,7 +149,7 @@ public class AutoCraftingButtonWidget extends ButtonWidget { @Override protected int getTextureId(boolean boolean_1) { - return !visible ? 0 : boolean_1 && enabled ? (ConfigObject.getInstance().isLighterButtonHover() ? 4 : 3) : 1; + return !visible ? 0 : boolean_1 && enabled ? 4 : 1; } @Override diff --git a/src/main/java/me/shedaniel/rei/gui/widget/ButtonWidget.java b/src/main/java/me/shedaniel/rei/gui/widget/ButtonWidget.java index 2599e906e..2254ee10f 100644 --- a/src/main/java/me/shedaniel/rei/gui/widget/ButtonWidget.java +++ b/src/main/java/me/shedaniel/rei/gui/widget/ButtonWidget.java @@ -8,8 +8,6 @@ package me.shedaniel.rei.gui.widget; import com.mojang.blaze3d.systems.RenderSystem; import me.shedaniel.math.api.Point; import me.shedaniel.math.api.Rectangle; -import me.shedaniel.rei.api.ConfigObject; -import me.shedaniel.rei.api.annotations.Internal; import me.shedaniel.rei.impl.ScreenHelper; import net.minecraft.client.gui.Element; import net.minecraft.client.sound.PositionedSoundInstance; @@ -23,8 +21,6 @@ import java.util.List; import java.util.Objects; import java.util.Optional; -@Internal -@Deprecated public abstract class ButtonWidget extends WidgetWithBounds { protected static final Identifier BUTTON_LOCATION = new Identifier("roughlyenoughitems", "textures/gui/button.png"); @@ -61,7 +57,7 @@ public abstract class ButtonWidget extends WidgetWithBounds { if (!this.enabled) { int_1 = 0; } else if (boolean_1) { - int_1 = ConfigObject.getInstance().isLighterButtonHover() ? 4 : 3; // 2 is the old blue highlight, 3 is the 1.15 outline, 4 is the 1.15 online + light hover + 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; diff --git a/src/main/java/me/shedaniel/rei/gui/widget/ClickableActionedLabelWidget.java b/src/main/java/me/shedaniel/rei/gui/widget/ClickableActionedLabelWidget.java index 85adca39e..8c2f50bc6 100644 --- a/src/main/java/me/shedaniel/rei/gui/widget/ClickableActionedLabelWidget.java +++ b/src/main/java/me/shedaniel/rei/gui/widget/ClickableActionedLabelWidget.java @@ -6,12 +6,11 @@ package me.shedaniel.rei.gui.widget; import me.shedaniel.math.api.Point; -import me.shedaniel.rei.api.annotations.Internal; +import org.jetbrains.annotations.ApiStatus; import java.util.function.Consumer; -@Deprecated -@Internal +@ApiStatus.Internal public class ClickableActionedLabelWidget extends ClickableLabelWidget { private Consumer onClicked; diff --git a/src/main/java/me/shedaniel/rei/gui/widget/ClickableLabelWidget.java b/src/main/java/me/shedaniel/rei/gui/widget/ClickableLabelWidget.java index f6304a985..c8c55beb5 100644 --- a/src/main/java/me/shedaniel/rei/gui/widget/ClickableLabelWidget.java +++ b/src/main/java/me/shedaniel/rei/gui/widget/ClickableLabelWidget.java @@ -7,6 +7,7 @@ package me.shedaniel.rei.gui.widget; import me.shedaniel.math.api.Point; import me.shedaniel.rei.impl.ScreenHelper; +import org.jetbrains.annotations.ApiStatus; public abstract class ClickableLabelWidget extends LabelWidget { @@ -14,23 +15,23 @@ public abstract class ClickableLabelWidget extends LabelWidget { private boolean clickable = true; private int hoveredColor; - @Deprecated + @ApiStatus.Internal public ClickableLabelWidget(int x, int y, String text, boolean clickable) { this(new Point(x, y), text, clickable); } - @Deprecated + @ApiStatus.Internal public ClickableLabelWidget(int x, int y, String text)