diff options
Diffstat (limited to 'src/main/java')
43 files changed, 227 insertions, 595 deletions
diff --git a/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java b/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java index c81beb237..f007f5008 100644 --- a/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java +++ b/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java @@ -22,7 +22,7 @@ import net.fabricmc.loader.api.ModContainer; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.Element; import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; +import net.minecraft.client.gui.screen.ingame.ContainerScreen; import net.minecraft.client.gui.screen.ingame.CraftingTableScreen; import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen; import net.minecraft.client.gui.screen.ingame.InventoryScreen; @@ -90,9 +90,8 @@ public class RoughlyEnoughItemsCore implements ClientModInitializer { * * @param plugin the plugin instance * @return the plugin itself - * @deprecated Check REI wiki */ - @Deprecated + @ApiStatus.Internal public static REIPluginEntry registerPlugin(REIPluginEntry plugin) { plugins.put(plugin.getPluginIdentifier(), plugin); RoughlyEnoughItemsCore.LOGGER.debug("[REI] Registered plugin %s from %s", plugin.getPluginIdentifier().toString(), plugin.getClass().getSimpleName()); @@ -226,22 +225,21 @@ public class RoughlyEnoughItemsCore implements ClientModInitializer { } } - @SuppressWarnings("deprecation") private void registerClothEvents() { final Identifier recipeButtonTex = new Identifier("textures/gui/recipe_button.png"); AtomicLong lastSync = new AtomicLong(-1); ClothClientHooks.SYNC_RECIPES.register((minecraftClient, recipeManager, synchronizeRecipesS2CPacket) -> syncRecipes(lastSync)); ClothClientHooks.SCREEN_ADD_BUTTON.register((minecraftClient, screen, abstractButtonWidget) -> { - if (ConfigObject.getInstance().doesDisableRecipeBook() && screen instanceof AbstractContainerScreen && abstractButtonWidget instanceof TexturedButtonWidget) + if (ConfigObject.getInstance().doesDisableRecipeBook() && screen instanceof ContainerScreen && abstractButtonWidget instanceof TexturedButtonWidget) if (((RecipeBookButtonWidgetHooks) abstractButtonWidget).rei_getTexture().equals(recipeButtonTex)) return ActionResult.FAIL; return ActionResult.PASS; }); ClothClientHooks.SCREEN_INIT_POST.register((minecraftClient, screen, screenHooks) -> { - if (screen instanceof AbstractContainerScreen) { + if (screen instanceof ContainerScreen) { if (screen instanceof InventoryScreen && minecraftClient.interactionManager.hasCreativeInventory()) return; - ScreenHelper.setLastContainerScreen((AbstractContainerScreen<?>) screen); + ScreenHelper.setLastContainerScreen((ContainerScreen<?>) screen); boolean alreadyAdded = false; for (Element element : Lists.newArrayList(screenHooks.cloth_getInputListeners())) if (ContainerScreenOverlay.class.isAssignableFrom(element.getClass())) @@ -254,11 +252,11 @@ public class RoughlyEnoughItemsCore implements ClientModInitializer { } }); ClothClientHooks.SCREEN_RENDER_POST.register((minecraftClient, screen, i, i1, v) -> { - if (screen instanceof AbstractContainerScreen) + if (screen instanceof ContainerScreen) ScreenHelper.getLastOverlay().render(i, i1, v); }); ClothClientHooks.SCREEN_MOUSE_DRAGGED.register((minecraftClient, screen, v, v1, i, v2, v3) -> { - if (screen instanceof AbstractContainerScreen) + if (screen instanceof ContainerScreen) if (ScreenHelper.isOverlayVisible() && ScreenHelper.getLastOverlay().mouseDragged(v, v1, i, v2, v3)) return ActionResult.SUCCESS; return ActionResult.PASS; @@ -274,13 +272,13 @@ public class RoughlyEnoughItemsCore implements ClientModInitializer { return ActionResult.PASS; }); ClothClientHooks.SCREEN_MOUSE_SCROLLED.register((minecraftClient, screen, v, v1, v2) -> { - if (screen instanceof AbstractContainerScreen) + if (screen instanceof ContainerScreen) if (ScreenHelper.isOverlayVisible() && ScreenHelper.getLastOverlay().mouseScrolled(v, v1, v2)) return ActionResult.SUCCESS; return ActionResult.PASS; }); ClothClientHooks.SCREEN_CHAR_TYPED.register((minecraftClient, screen, character, keyCode) -> { - if (screen instanceof AbstractContainerScreen) + if (screen instanceof ContainerScreen) if (ScreenHelper.getLastOverlay().charTyped(character, keyCode)) return ActionResult.SUCCESS; return ActionResult.PASS; @@ -288,16 +286,16 @@ public class RoughlyEnoughItemsCore implements ClientModInitializer { ClothClientHooks.SCREEN_LATE_RENDER.register((minecraftClient, screen, i, i1, v) -> { if (!ScreenHelper.isOverlayVisible()) return; - if (screen instanceof AbstractContainerScreen) + if (screen instanceof ContainerScreen) ScreenHelper.getLastOverlay().lateRender(i, i1, v); }); ClothClientHooks.SCREEN_KEY_PRESSED.register((minecraftClient, screen, i, i1, i2) -> { if (screen.getFocused() != null && screen.getFocused() instanceof TextFieldWidget || (screen.getFocused() instanceof RecipeBookWidget && ((RecipeBookGuiHooks) screen.getFocused()).rei_getSearchField() != null && ((RecipeBookGuiHooks) screen.getFocused()).rei_getSearchField().isFocused())) return ActionResult.PASS; - if (screen instanceof AbstractContainerScreen) + if (screen instanceof ContainerScreen) if (ScreenHelper.getLastOverlay().keyPressed(i, i1, i2)) return ActionResult.SUCCESS; - if (screen instanceof AbstractContainerScreen && configManager.getConfig().doesDisableRecipeBook() && configManager.getConfig().doesFixTabCloseContainer()) + if (screen instanceof ContainerScreen && ConfigObject.getInstance().doesDisableRecipeBook() && ConfigObject.getInstance().doesFixTabCloseContainer()) if (i == 258 && minecraftClient.options.keyInventory.matchesKey(i, i1)) { minecraftClient.player.closeContainer(); return ActionResult.SUCCESS; diff --git a/src/main/java/me/shedaniel/rei/api/AutoTransferHandler.java b/src/main/java/me/shedaniel/rei/api/AutoTransferHandler.java index e1477a6d4..19b863a38 100644 --- a/src/main/java/me/shedaniel/rei/api/AutoTransferHandler.java +++ b/src/main/java/me/shedaniel/rei/api/AutoTransferHandler.java @@ -10,7 +10,7 @@ import it.unimi.dsi.fastutil.ints.IntList; import me.shedaniel.rei.gui.ContainerScreenOverlay; import me.shedaniel.rei.impl.ScreenHelper; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; +import net.minecraft.client.gui.screen.ingame.ContainerScreen; import net.minecraft.container.Container; import java.util.function.Supplier; @@ -63,7 +63,7 @@ public interface AutoTransferHandler { } interface Context { - static Context create(boolean actuallyCrafting, AbstractContainerScreen<?> containerScreen, RecipeDisplay recipeDisplay) { + static Context create(boolean actuallyCrafting, ContainerScreen<?> containerScreen, RecipeDisplay recipeDisplay) { return new ContextImpl(actuallyCrafting, containerScreen, () -> recipeDisplay); } @@ -73,7 +73,7 @@ public interface AutoTransferHandler { boolean isActuallyCrafting(); - AbstractContainerScreen<?> getContainerScreen(); + ContainerScreen<?> getContainerScreen(); RecipeDisplay getRecipe(); @@ -139,10 +139,10 @@ public interface AutoTransferHandler { final class ContextImpl implements Context { boolean actuallyCrafting; - AbstractContainerScreen<?> containerScreen; + ContainerScreen<?> containerScreen; Supplier<RecipeDisplay> recipeDisplaySupplier; - private ContextImpl(boolean actuallyCrafting, AbstractContainerScreen<?> containerScreen, Supplier<RecipeDisplay> recipeDisplaySupplier) { + private ContextImpl(boolean actuallyCrafting, ContainerScreen<?> containerScreen, Supplier<RecipeDisplay> recipeDisplaySupplier) { this.actuallyCrafting = actuallyCrafting; this.containerScreen = containerScreen; this.recipeDisplaySupplier = recipeDisplaySupplier; @@ -154,7 +154,7 @@ public interface AutoTransferHandler { } @Override - public AbstractContainerScreen<?> getContainerScreen() { + public ContainerScreen<?> getContainerScreen() { return containerScreen; } diff --git a/src/main/java/me/shedaniel/rei/api/BaseBoundsHandler.java b/src/main/java/me/shedaniel/rei/api/BaseBoundsHandler.java index 15d46e4de..1bd251725 100644 --- a/src/main/java/me/shedaniel/rei/api/BaseBoundsHandler.java +++ b/src/main/java/me/shedaniel/rei/api/BaseBoundsHandler.java @@ -5,14 +5,10 @@ package me.shedaniel.rei.api; -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; import java.util.function.Supplier; public interface BaseBoundsHandler extends DisplayHelper.DisplayBoundsHandler<Screen> { @@ -20,21 +16,12 @@ public interface BaseBoundsHandler extends DisplayHelper.DisplayBoundsHandler<Sc * Gets the exclusion zones by the screen class * * @param currentScreenClass the current screen class - * @param isOnRightSide whether the user has set the overlay to the right * @return the list of exclusion zones */ - @Deprecated - @ApiStatus.ScheduledForRemoval - default List<Rectangle> getCurrentExclusionZones(Class<?> currentScreenClass, boolean isOnRightSide) { + default List<Rectangle> getExclusionZones(Class<?> currentScreenClass) { return getExclusionZones(currentScreenClass, false); } - @Deprecated - @ApiStatus.ScheduledForRemoval - default List<Rectangle> getCurrentExclusionZones(Class<?> currentScreenClass, boolean isOnRightSide, boolean sort) { - return getExclusionZones(currentScreenClass, sort); - } - List<Rectangle> getExclusionZones(Class<?> currentScreenClass, boolean sort); int supplierSize(); @@ -43,24 +30,6 @@ public interface BaseBoundsHandler extends DisplayHelper.DisplayBoundsHandler<Sc * Register an exclusion zone * * @param screenClass the screen - * @param supplier the exclusion zone supplier, isOnRightSide -> the list of exclusion zones - * @see #registerExclusionZones(Class, Supplier) for non deprecated version - */ - @Deprecated - @ApiStatus.ScheduledForRemoval - default void registerExclusionZones(Class<?> screenClass, Function<Boolean, List<Rectangle>> supplier) { - RoughlyEnoughItemsCore.LOGGER.warn("[REI] Someone is registering exclusion zones with the deprecated method: " + supplier.getClass().getName()); - registerExclusionZones(screenClass, () -> { - List<Rectangle> zones = Lists.newArrayList(supplier.apply(false)); - zones.addAll(supplier.apply(true)); - return zones; - }); - } - - /** - * Register an exclusion zone - * - * @param screenClass the screen * @param supplier the exclusion zone supplier, returns the list of exclusion zones */ void registerExclusionZones(Class<?> screenClass, Supplier<List<Rectangle>> supplier); diff --git a/src/main/java/me/shedaniel/rei/api/ConfigManager.java b/src/main/java/me/shedaniel/rei/api/ConfigManager.java index c2b785571..3f0da4e93 100644 --- a/src/main/java/me/shedaniel/rei/api/ConfigManager.java +++ b/src/main/java/me/shedaniel/rei/api/ConfigManager.java @@ -8,13 +8,11 @@ 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; public interface ConfigManager { - @SuppressWarnings("deprecation") static ConfigManager getInstance() { return RoughlyEnoughItemsCore.getConfigManager(); } @@ -27,16 +25,6 @@ public interface ConfigManager { void saveConfig(); /** - * Gets the config instance - * - * @return the config instance - * @deprecated Use {@link ConfigObject#getInstance()} - */ - @Deprecated - @ApiStatus.ScheduledForRemoval - ConfigObject getConfig(); - - /** * Gets if craftable only filter is enabled * * @return whether craftable only filter is enabled diff --git a/src/main/java/me/shedaniel/rei/api/ConfigObject.java b/src/main/java/me/shedaniel/rei/api/ConfigObject.java index fb2ca2650..c45ae56c9 100644 --- a/src/main/java/me/shedaniel/rei/api/ConfigObject.java +++ b/src/main/java/me/shedaniel/rei/api/ConfigObject.java @@ -9,8 +9,8 @@ import me.shedaniel.clothconfig2.api.ModifierKeyCode; import me.shedaniel.rei.gui.config.ItemListOrdering; import me.shedaniel.rei.gui.config.RecipeScreenType; import me.shedaniel.rei.gui.config.SearchFieldLocation; +import me.shedaniel.rei.impl.ConfigManagerImpl; import me.shedaniel.rei.impl.ConfigObjectImpl; -import net.minecraft.client.util.InputUtil; import org.jetbrains.annotations.ApiStatus; import java.lang.annotation.ElementType; @@ -20,15 +20,10 @@ import java.lang.annotation.Target; public interface ConfigObject { - @SuppressWarnings("deprecation") static ConfigObject getInstance() { - return ConfigManager.getInstance().getConfig(); + return ((ConfigManagerImpl) ConfigManager.getInstance()).getConfig(); } - @Deprecated - @ApiStatus.ScheduledForRemoval - boolean isLighterButtonHover(); - boolean isOverlayVisible(); void setOverlayVisible(boolean overlayVisible); @@ -45,11 +40,6 @@ public interface ConfigObject { boolean isToastDisplayedOnCopyIdentifier(); - @Deprecated - default boolean doesRenderEntryExtraOverlay() { - return doesRenderEntryEnchantmentGlint(); - } - boolean doesRenderEntryEnchantmentGlint(); boolean isEntryListWidgetScrolled(); @@ -104,11 +94,6 @@ public interface ConfigObject { boolean doSearchFavorites(); - @Deprecated - default InputUtil.KeyCode getFavoriteKeybind() { - return getFavoriteKeyCode().getKeyCode(); - } - ModifierKeyCode getFavoriteKeyCode(); ModifierKeyCode getRecipeKeybind(); diff --git a/src/main/java/me/shedaniel/rei/api/DisplayHelper.java b/src/main/java/me/shedaniel/rei/api/DisplayHelper.java index 8df0c9c4f..2e1a174b1 100644 --- a/src/main/java/me/shedaniel/rei/api/DisplayHelper.java +++ b/src/main/java/me/shedaniel/rei/api/DisplayHelper.java @@ -17,7 +17,6 @@ import static net.minecraft.util.ActionResult.PASS; public interface DisplayHelper { - @SuppressWarnings("deprecation") static DisplayHelper getInstance() { return RoughlyEnoughItemsCore.getDisplayHelper(); } @@ -100,36 +99,6 @@ public interface DisplayHelper { } /** - * Checks if item slot can fit the screen - * - * @param isOnRightSide whether the user has set the overlay to the right - * @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 - * @deprecated use {@link #canItemSlotWidgetFit(int, int, Object, Rectangle)} - */ - @Deprecated - default ActionResult canItemSlotWidgetFit(boolean isOnRightSide, int left, int top, T screen, Rectangle fullBounds) { - return canItemSlotWidgetFit(left, top, screen, fullBounds); - } - - /** - * Checks if mouse is inside the overlay - * - * @param isOnRightSide whether the user has set the overlay to the right - * @param mouseX mouse's x coordinates - * @param mouseY mouse's y coordinates - * @return whether mouse is inside the overlay - * @deprecated use {@link #isInZone(double, double)} - */ - @Deprecated - default ActionResult isInZone(boolean isOnRightSide, double mouseX, double mouseY) { - return isInZone(mouseX, mouseY); - } - - /** * Checks if mouse is inside the overlay * * @param mouseX mouse's x coordinates diff --git a/src/main/java/me/shedaniel/rei/api/EntryRegistry.java b/src/main/java/me/shedaniel/rei/api/EntryRegistry.java index bff5aebb5..39af13fec 100644 --- a/src/main/java/me/shedaniel/rei/api/EntryRegistry.java +++ b/src/main/java/me/shedaniel/rei/api/EntryRegistry.java @@ -17,7 +17,6 @@ import java.util.List; public interface EntryRegistry { - @SuppressWarnings("deprecation") static EntryRegistry getInstance() { return RoughlyEnoughItemsCore.getEntryRegistry(); } @@ -59,6 +58,7 @@ public interface EntryRegistry { * @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.Internal diff --git a/src/main/java/me/shedaniel/rei/api/EntryStack.java b/src/main/java/me/shedaniel/rei/api/EntryStack.java index 61f9e3d71..9d36a0550 100644 --- a/src/main/java/me/shedaniel/rei/api/EntryStack.java +++ b/src/main/java/me/shedaniel/rei/api/EntryStack.java @@ -167,11 +167,6 @@ public interface EntryStack { return setting(settings, value); } - @Deprecated - default <T> ObjectHolder<T> getSetting(Settings<T> settings) { - return ObjectHolder.of(get(settings)); - } - <T> T get(Settings<T> settings); @Nullable QueuedTooltip getTooltip(int mouseX, int mouseY); @@ -208,7 +203,6 @@ public interface EntryStack { public static class Item { public static final Settings<Supplier<Boolean>> RENDER_ENCHANTMENT_GLINT = new Settings<>(TRUE); - @Deprecated @ApiStatus.ScheduledForRemoval public static final Settings<Supplier<Boolean>> RENDER_OVERLAY = RENDER_ENCHANTMENT_GLINT; private Item() { } diff --git a/src/main/java/me/shedaniel/rei/api/ObjectHolder.java b/src/main/java/me/shedaniel/rei/api/ObjectHolder.java deleted file mode 100644 index cb074d9a9..000000000 --- a/src/main/java/me/shedaniel/rei/api/ObjectHolder.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2018, 2019, 2020 shedaniel - * Licensed under the MIT License (the "License"). - */ - -package me.shedaniel.rei.api; - -import me.shedaniel.rei.impl.ObjectHolderImpl; -import org.jetbrains.annotations.ApiStatus; - -public interface ObjectHolder<T> { - @SuppressWarnings("deprecation") - static <T> ObjectHolder<T> of(T o) { - return new ObjectHolderImpl<>(o); - } - - @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(); - } - - T value(); -}
\ No newline at end of file diff --git a/src/main/java/me/shedaniel/rei/api/REIPluginEntry.java b/src/main/java/me/shedaniel/rei/api/REIPluginEntry.java index e7f90fd04..fbe31ba94 100644 --- a/src/main/java/me/shedaniel/rei/api/REIPluginEntry.java +++ b/src/main/java/me/shedaniel/rei/api/REIPluginEntry.java @@ -15,7 +15,8 @@ import org.jetbrains.annotations.ApiStatus; */ public interface REIPluginEntry { - @ApiStatus.OverrideOnly + @ApiStatus.ScheduledForRemoval + @Deprecated 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 485e5d207..347957d63 100644 --- a/src/main/java/me/shedaniel/rei/api/RecipeCategory.java +++ b/src/main/java/me/shedaniel/rei/api/RecipeCategory.java @@ -127,16 +127,4 @@ public interface RecipeCategory<T extends RecipeDisplay> { return -1; } - /** - * Gets whether the category will check tags, useful for potions - * - * @return whether the category will check tags - * @deprecated no longer used - */ - @Deprecated - @ApiStatus.ScheduledForRemoval - default boolean checkTags() { - return false; - } - } diff --git a/src/main/java/me/shedaniel/rei/api/RecipeHelper.java b/src/main/java/me/shedaniel/rei/api/RecipeHelper.java index ee2243068..4e8a07f21 100644 --- a/src/main/java/me/shedaniel/rei/api/RecipeHelper.java +++ b/src/main/java/me/shedaniel/rei/api/RecipeHelper.java @@ -7,7 +7,7 @@ package me.shedaniel.rei.api; import me.shedaniel.math.api.Rectangle; import me.shedaniel.rei.RoughlyEnoughItemsCore; -import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; +import net.minecraft.client.gui.screen.ingame.ContainerScreen; import net.minecraft.re |
