瀏覽代碼

stuff

Signed-off-by: shedaniel <daniel@shedaniel.me>
shedaniel 5 年之前
父節點
當前提交
9318f51bb0
共有 35 個文件被更改,包括 113 次插入119 次删除
  1. 2 2
      .github/workflows/curseforge.yml
  2. 4 0
      src/main/java/me/shedaniel/rei/api/AutoTransferHandler.java
  3. 1 0
      src/main/java/me/shedaniel/rei/api/BaseBoundsHandler.java
  4. 1 0
      src/main/java/me/shedaniel/rei/api/ClientHelper.java
  5. 7 0
      src/main/java/me/shedaniel/rei/api/ConfigManager.java
  6. 3 0
      src/main/java/me/shedaniel/rei/api/ConfigObject.java
  7. 6 1
      src/main/java/me/shedaniel/rei/api/DisplayHelper.java
  8. 3 0
      src/main/java/me/shedaniel/rei/api/EntryRegistry.java
  9. 3 0
      src/main/java/me/shedaniel/rei/api/LiveRecipeGenerator.java
  10. 9 0
      src/main/java/me/shedaniel/rei/api/REIHelper.java
  11. 6 6
      src/main/java/me/shedaniel/rei/api/REIPluginEntry.java
  12. 3 0
      src/main/java/me/shedaniel/rei/api/RecipeHelper.java
  13. 6 0
      src/main/java/me/shedaniel/rei/api/TransferRecipeDisplay.java
  14. 1 1
      src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java
  15. 2 2
      src/main/java/me/shedaniel/rei/gui/OverlaySearchField.java
  16. 3 3
      src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java
  17. 3 3
      src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java
  18. 2 2
      src/main/java/me/shedaniel/rei/gui/config/entry/FilteringEntry.java
  19. 3 3
      src/main/java/me/shedaniel/rei/gui/widget/AutoCraftingButtonWidget.java
  20. 2 3
      src/main/java/me/shedaniel/rei/gui/widget/ButtonWidget.java
  21. 2 3
      src/main/java/me/shedaniel/rei/gui/widget/ClickableLabelWidget.java
  22. 1 1
      src/main/java/me/shedaniel/rei/gui/widget/DraggableWidget.java
  23. 3 3
      src/main/java/me/shedaniel/rei/gui/widget/EntryListWidget.java
  24. 3 3
      src/main/java/me/shedaniel/rei/gui/widget/EntryWidget.java
  25. 3 3
      src/main/java/me/shedaniel/rei/gui/widget/FavoritesListWidget.java
  26. 1 2
      src/main/java/me/shedaniel/rei/gui/widget/LabelWidget.java
  27. 7 2
      src/main/java/me/shedaniel/rei/gui/widget/QueuedTooltip.java
  28. 2 3
      src/main/java/me/shedaniel/rei/gui/widget/TabWidget.java
  29. 1 1
      src/main/java/me/shedaniel/rei/gui/widget/TextFieldWidget.java
  30. 4 0
      src/main/java/me/shedaniel/rei/impl/ClientHelperImpl.java
  31. 14 0
      src/main/java/me/shedaniel/rei/impl/ScreenHelper.java
  32. 0 35
      src/main/java/me/shedaniel/rei/impl/compat/ModelHasDepth1151Compat.java
  33. 0 35
      src/main/java/me/shedaniel/rei/impl/compat/ModelSideLit1152Compat.java
  34. 1 1
      src/main/java/me/shedaniel/rei/plugin/beacon/DefaultBeaconBaseCategory.java
  35. 1 1
      src/main/java/me/shedaniel/rei/plugin/information/DefaultInformationCategory.java

+ 2 - 2
.github/workflows/curseforge.yml

@@ -1,4 +1,4 @@
-name: Java CI
+name: CF CI
 
 on:
   push:
@@ -18,4 +18,4 @@ jobs:
       - name: Upload to CurseForge
         run: ./gradlew clean build curseforge --refresh-dependencies --stacktrace
         env:
-          CF_API_KEY: ${{ secrets.CF_API_KEY }}
+          danielshe_curse_api_key: ${{ secrets.CF_API_KEY }}

+ 4 - 0
src/main/java/me/shedaniel/rei/api/AutoTransferHandler.java

@@ -30,6 +30,8 @@ import me.shedaniel.rei.impl.ScreenHelper;
 import net.minecraft.client.MinecraftClient;
 import net.minecraft.client.gui.screen.ingame.ContainerScreen;
 import net.minecraft.container.Container;
+import org.jetbrains.annotations.ApiStatus;
+import org.spongepowered.asm.mixin.injection.Inject;
 
 import java.util.function.Supplier;
 
@@ -104,6 +106,7 @@ public interface AutoTransferHandler {
         }
     }
     
+    @ApiStatus.Internal
     final class ResultImpl implements Result {
         private boolean successful, applicable;
         private String errorKey;
@@ -155,6 +158,7 @@ public interface AutoTransferHandler {
         }
     }
     
+    @ApiStatus.Internal
     final class ContextImpl implements Context {
         boolean actuallyCrafting;
         ContainerScreen<?> containerScreen;

+ 1 - 0
src/main/java/me/shedaniel/rei/api/BaseBoundsHandler.java

@@ -31,6 +31,7 @@ import java.util.function.Supplier;
 
 public interface BaseBoundsHandler extends DisplayHelper.DisplayBoundsHandler<Screen> {
     
+    @SuppressWarnings("deprecation")
     static BaseBoundsHandler getInstance() {
         return DisplayHelper.getInstance().getBaseBoundsHandler();
     }

+ 1 - 0
src/main/java/me/shedaniel/rei/api/ClientHelper.java

@@ -33,6 +33,7 @@ import java.util.List;
 import java.util.Map;
 
 public interface ClientHelper {
+    
     /**
      * @return the api instance of {@link ClientHelperImpl}
      */

+ 7 - 0
src/main/java/me/shedaniel/rei/api/ConfigManager.java

@@ -32,10 +32,17 @@ import java.util.List;
 
 public interface ConfigManager {
     
+    /**
+     * @return the api instance of {@link me.shedaniel.rei.impl.ConfigManagerImpl}
+     */
     static ConfigManager getInstance() {
         return RoughlyEnoughItemsCore.getConfigManager();
     }
     
+    /**
+     * @return the list of favourites
+     * @deprecated {@link ConfigObject#getFavorites()}
+     */
     @ApiStatus.ScheduledForRemoval
     @Deprecated
     default List<EntryStack> getFavorites() {

+ 3 - 0
src/main/java/me/shedaniel/rei/api/ConfigObject.java

@@ -36,6 +36,9 @@ import java.util.List;
 
 public interface ConfigObject {
     
+    /**
+     * @return the api instance of {@link me.shedaniel.rei.impl.ConfigObjectImpl}
+     */
     static ConfigObject getInstance() {
         return ((ConfigManagerImpl) ConfigManager.getInstance()).getConfig();
     }

+ 6 - 1
src/main/java/me/shedaniel/rei/api/DisplayHelper.java

@@ -37,6 +37,9 @@ import static net.minecraft.util.ActionResult.PASS;
 
 public interface DisplayHelper {
     
+    /**
+     * @return the api instance of {@link me.shedaniel.rei.impl.DisplayHelperImpl}
+     */
     static DisplayHelper getInstance() {
         return RoughlyEnoughItemsCore.getDisplayHelper();
     }
@@ -101,9 +104,11 @@ public interface DisplayHelper {
      * Gets the base bounds handler api for exclusion zones
      *
      * @return the base bounds handler
-     * @see BaseBoundsHandler#getInstance()
+     * @deprecated {@link BaseBoundsHandler#getInstance()}
      */
     @ApiStatus.Internal
+    @Deprecated
+    @ApiStatus.ScheduledForRemoval
     BaseBoundsHandler getBaseBoundsHandler();
     
     interface DisplayBoundsHandler<T> extends OverlayDecider {

+ 3 - 0
src/main/java/me/shedaniel/rei/api/EntryRegistry.java

@@ -35,6 +35,9 @@ import java.util.List;
 
 public interface EntryRegistry {
     
+    /**
+     * @return the api instance of {@link me.shedaniel.rei.impl.EntryRegistryImpl}
+     */
     static EntryRegistry getInstance() {
         return RoughlyEnoughItemsCore.getEntryRegistry();
     }

+ 3 - 0
src/main/java/me/shedaniel/rei/api/LiveRecipeGenerator.java

@@ -30,6 +30,9 @@ import java.util.Optional;
 
 public interface LiveRecipeGenerator<T extends RecipeDisplay> {
     
+    /**
+     * @return the identifier of the category the recipes goes to.
+     */
     Identifier getCategoryIdentifier();
     
     default Optional<List<T>> getRecipeFor(EntryStack entry) {

+ 9 - 0
src/main/java/me/shedaniel/rei/api/REIHelper.java

@@ -23,13 +23,19 @@
 
 package me.shedaniel.rei.api;
 
+import me.shedaniel.rei.gui.widget.QueuedTooltip;
 import me.shedaniel.rei.gui.widget.TextFieldWidget;
 import me.shedaniel.rei.impl.ScreenHelper;
 import net.minecraft.item.ItemStack;
+import org.jetbrains.annotations.Nullable;
 
 import java.util.List;
 
 public interface REIHelper {
+    
+    /**
+     * @return the instance of {@link REIHelper}
+     */
     static REIHelper getInstance() {
         return ScreenHelper.getInstance();
     }
@@ -39,4 +45,7 @@ public interface REIHelper {
     TextFieldWidget getSearchTextField();
     
     List<ItemStack> getInventoryStacks();
+    
+    void addTooltip(@Nullable QueuedTooltip tooltip);
+    
 }

+ 6 - 6
src/main/java/me/shedaniel/rei/api/REIPluginEntry.java

@@ -33,6 +33,10 @@ import org.jetbrains.annotations.ApiStatus;
  */
 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 {
@@ -40,18 +44,14 @@ public interface REIPluginEntry {
     }
     
     /**
-     * Gets the priority of the plugin.
-     *
-     * @return the priority
+     * @return the priority of the plugin, the smaller the number, the earlier it is called.
      */
     default int getPriority() {
         return 0;
     }
     
     /**
-     * Get the identifier of the plugin
-     *
-     * @return the identifier
+     * @return the unique identifier of the plugin.
      */
     Identifier getPluginIdentifier();
     

+ 3 - 0
src/main/java/me/shedaniel/rei/api/RecipeHelper.java

@@ -39,6 +39,9 @@ import java.util.function.Predicate;
 
 public interface RecipeHelper {
     
+    /**
+     * @return the api instance of {@link me.shedaniel.rei.impl.RecipeHelperImpl}
+     */
     static RecipeHelper getInstance() {
         return RoughlyEnoughItemsCore.getRecipeHelper();
     }

+ 6 - 0
src/main/java/me/shedaniel/rei/api/TransferRecipeDisplay.java

@@ -30,8 +30,14 @@ import java.util.List;
 
 public interface TransferRecipeDisplay extends RecipeDisplay {
     
+    /**
+     * @return the width of the crafting grid.
+     */
     int getWidth();
     
+    /**
+     * @return the height of the crafting grid.
+     */
     int getHeight();
     
     List<List<EntryStack>> getOrganisedInputEntries(ContainerInfo<Container> containerInfo, Container container);

+ 1 - 1
src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java

@@ -503,7 +503,7 @@ public class ContainerScreenOverlay extends WidgetWithBounds {
     public boolean mouseScrolled(double i, double j, double amount) {
         if (!ScreenHelper.isOverlayVisible())
             return false;
-        if (isInside(PointHelper.fromMouse())) {
+        if (isInside(PointHelper.ofMouse())) {
             if (!ConfigObject.getInstance().isEntryListWidgetScrolled()) {
                 if (amount > 0 && leftButton.enabled)
                     leftButton.onPressed();

+ 2 - 2
src/main/java/me/shedaniel/rei/gui/OverlaySearchField.java

@@ -74,7 +74,7 @@ public class OverlaySearchField extends TextFieldWidget {
     
     public void laterRender(int int_1, int int_2, float float_1) {
         RenderSystem.disableDepthTest();
-        setEditableColor(isMain && ContainerScreenOverlay.getEntryListWidget().getAllStacks().isEmpty() && !getText().isEmpty() ? 16733525 : isSearching && isMain ? -852212 : (containsMouse(PointHelper.fromMouse()) || isFocused()) ? (REIHelper.getInstance().isDarkThemeEnabled() ? -17587 : -1) : -6250336);
+        setEditableColor(isMain && ContainerScreenOverlay.getEntryListWidget().getAllStacks().isEmpty() && !getText().isEmpty() ? 16733525 : isSearching && isMain ? -852212 : (containsMouse(PointHelper.ofMouse()) || isFocused()) ? (REIHelper.getInstance().isDarkThemeEnabled() ? -17587 : -1) : -6250336);
         setSuggestion(!isFocused() && getText().isEmpty() ? I18n.translate("text.rei.search.field.suggestion") : null);
         super.render(int_1, int_2, float_1);
         RenderSystem.enableDepthTest();
@@ -82,7 +82,7 @@ public class OverlaySearchField extends TextFieldWidget {
     
     @Override
     protected void renderSuggestion(int x, int y) {
-        if (containsMouse(PointHelper.fromMouse()) || isFocused())
+        if (containsMouse(PointHelper.ofMouse()) || isFocused())
             this.font.drawWithShadow(this.font.trimToWidth(this.getSuggestion(), this.getWidth()), x, y, REIHelper.getInstance().isDarkThemeEnabled() ? 0xccddaa3d : 0xddeaeaea);
         else
             this.font.drawWithShadow(this.font.trimToWidth(this.getSuggestion(), this.getWidth()), x, y, -6250336);

+ 3 - 3
src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java

@@ -458,7 +458,7 @@ public class RecipeViewingScreen extends Screen implements RecipeScreen {
         if (export.matchesKey(keyCode, scanCode)) {
             for (Map.Entry<Rectangle, List<Widget>> entry : recipeBounds.entrySet()) {
                 Rectangle bounds = entry.getKey();
-                if (bounds.contains(PointHelper.fromMouse())) {
+                if (bounds.contains(PointHelper.ofMouse())) {
                     RecipeDisplayExporter.exportRecipeDisplay(bounds, entry.getValue());
                     break;
                 }
@@ -507,13 +507,13 @@ public class RecipeViewingScreen extends Screen implements RecipeScreen {
         for (Element listener : children())
             if (listener.mouseScrolled(i, j, amount))
                 return true;
-        if (getBounds().contains(PointHelper.fromMouse())) {
+        if (getBounds().contains(PointHelper.ofMouse())) {
             if (amount > 0 && recipeBack.enabled)
                 recipeBack.onPressed();
             else if (amount < 0 && recipeNext.enabled)
                 recipeNext.onPressed();
         }
-        if ((new Rectangle(bounds.x, bounds.y - 28, bounds.width, 28)).contains(PointHelper.fromMouse())) {
+        if ((new Rectangle(bounds.x, bounds.y - 28, bounds.width, 28)).contains(PointHelper.ofMouse())) {
             if (amount > 0 && categoryBack.enabled)
                 categoryBack.onPressed();
             else if (amount < 0 && categoryNext.enabled)

+ 3 - 3
src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java

@@ -327,7 +327,7 @@ public class VillagerRecipeViewingScreen extends Screen implements RecipeScreen
         for (Element listener : children())
             if (listener.mouseScrolled(double_1, double_2, double_3))
                 return true;
-        if (bounds.contains(PointHelper.fromMouse())) {
+        if (bounds.contains(PointHelper.ofMouse())) {
             if (double_3 < 0 && categoryMap.get(categories.get(selectedCategoryIndex)).size() > 1) {
                 selectedRecipeIndex++;
                 if (selectedRecipeIndex >= categoryMap.get(categories.get(selectedCategoryIndex)).size())
@@ -392,7 +392,7 @@ public class VillagerRecipeViewingScreen extends Screen implements RecipeScreen
             if (buttonWidgets.get(i).getBounds().getMaxY() > scrollListBounds.getMinY() && buttonWidgets.get(i).getBounds().getMinY() < scrollListBounds.getMaxY()) {
                 recipeRenderers.get(i).setZ(1);
                 recipeRenderers.get(i).render(buttonWidgets.get(i).getBounds(), mouseX, mouseY, delta);
-                ScreenHelper.getLastOverlay().addTooltip(recipeRenderers.get(i).getTooltip(mouseX, mouseY));
+                REIHelper.getInstance().addTooltip(recipeRenderers.get(i).getTooltip(mouseX, mouseY));
             }
         }
         double maxScroll = getMaxScrollPosition();
@@ -405,7 +405,7 @@ public class VillagerRecipeViewingScreen extends Screen implements RecipeScreen
             height = Math.max(10, height);
             int minY = (int) Math.min(Math.max((int) scrollAmount * (scrollListBounds.height - 2 - height) / getMaxScroll() + scrollListBounds.y + 1, scrollListBounds.y + 1), scrollListBounds.getMaxY() - 1 - height);
             int scrollbarPositionMinX = scrollListBounds.getMaxX() - 6, scrollbarPositionMaxX = scrollListBounds.getMaxX() - 1;
-            boolean hovered = (new Rectangle(scrollbarPositionMinX, minY, scrollbarPositionMaxX - scrollbarPositionMinX, height)).contains(PointHelper.fromMouse());
+            boolean hovered = (new Rectangle(scrollbarPositionMinX, minY, scrollbarPositionMaxX - scrollbarPositionMinX, height)).contains(PointHelper.ofMouse());
             float bottomC = (hovered ? .67f : .5f) * (REIHelper.getInstance().isDarkThemeEnabled() ? 0.8f : 1f);
             float topC = (hovered ? .87f : .67f) * (REIHelper.getInstance().isDarkThemeEnabled() ? 0.8f : 1f);
             RenderSystem.disableTexture();

+ 2 - 2
src/main/java/me/shedaniel/rei/gui/config/entry/FilteringEntry.java

@@ -223,7 +223,7 @@ public class FilteringEntry extends AbstractConfigListEntry<List<EntryStack>> {
         if (selectionPoint != null) {
             Point p = secondPoint;
             if (p == null) {
-                p = PointHelper.fromMouse();
+                p = PointHelper.ofMouse();
                 p.translate(0, (int) scroll);
             }
             int left = Math.min(p.x, selectionPoint.x);
@@ -272,7 +272,7 @@ public class FilteringEntry extends AbstractConfigListEntry<List<EntryStack>> {
             
             int scrollbarPositionMinX = getScrollbarMinX();
             int scrollbarPositionMaxX = scrollbarPositionMinX + 6;
-            boolean hovered = (new Rectangle(scrollbarPositionMinX, minY, scrollbarPositionMaxX - scrollbarPositionMinX, height)).contains(PointHelper.fromMouse());
+            boolean hovered = (new Rectangle(scrollbarPositionMinX, minY, scrollbarPositionMaxX - scrollbarPositionMinX, height)).contains(PointHelper.ofMouse());
             float bottomC = (hovered ? .67f : .5f) * (REIHelper.getInstance().isDarkThemeEnabled() ? 0.8f : 1f);
             float topC = (hovered ? .87f : .67f) * (REIHelper.getInstance().isDarkThemeEnabled() ? 0.8f : 1f);
             

+ 3 - 3
src/main/java/me/shedaniel/rei/gui/widget/AutoCraftingButtonWidget.java

@@ -148,9 +148,9 @@ public class AutoCraftingButtonWidget extends ButtonWidget {
         
         if (getTooltips().isPresent())
             if (!focused && containsMouse(mouseX, mouseY))
-                ScreenHelper.getLastOverlay().addTooltip(QueuedTooltip.create(getTooltips().get().split("\n")));
+                REIHelper.getInstance().addTooltip(QueuedTooltip.create(getTooltips().get().split("\n")));
             else if (focused)
-                ScreenHelper.getLastOverlay().addTooltip(QueuedTooltip.create(new Point(x + width / 2, y + height / 2), getTooltips().get().split("\n")));
+                REIHelper.getInstance().addTooltip(QueuedTooltip.create(new Point(x + width / 2, y + height / 2), getTooltips().get().split("\n")));
     }
     
     @Override
@@ -179,7 +179,7 @@ public class AutoCraftingButtonWidget extends ButtonWidget {
     
     @Override
     public boolean keyPressed(int int_1, int int_2, int int_3) {
-        if (displaySupplier.get().getRecipeLocation().isPresent() && ConfigObject.getInstance().getCopyRecipeIdentifierKeybind().matchesKey(int_1, int_2) && containsMouse(PointHelper.fromMouse())) {
+        if (displaySupplier.get().getRecipeLocation().isPresent() && ConfigObject.getInstance().getCopyRecipeIdentifierKeybind().matchesKey(int_1, int_2) && containsMouse(PointHelper.ofMouse())) {
             minecraft.keyboard.setClipboard(displaySupplier.get().getRecipeLocation().get().toString());
             if (ConfigObject.getInstance().isToastDisplayedOnCopyIdentifier()) {
                 CopyRecipeIdentifierToast.addToast(I18n.translate("msg.rei.copied_recipe_id"), I18n.translate("msg.rei.recipe_id_details", displaySupplier.get().getRecipeLocation().get().toString()));

+ 2 - 3
src/main/java/me/shedaniel/rei/gui/widget/ButtonWidget.java

@@ -27,7 +27,6 @@ import com.mojang.blaze3d.systems.RenderSystem;
 import me.shedaniel.math.api.Point;
 import me.shedaniel.math.api.Rectangle;
 import me.shedaniel.rei.api.REIHelper;
-import me.shedaniel.rei.impl.ScreenHelper;
 import net.minecraft.client.gui.Element;
 import net.minecraft.client.sound.PositionedSoundInstance;
 import net.minecraft.sound.SoundEvents;
@@ -155,9 +154,9 @@ public abstract class ButtonWidget extends WidgetWithBounds {
         
         if (getTooltips().isPresent())
             if (!focused && containsMouse(mouseX, mouseY))
-                ScreenHelper.getLastOverlay().addTooltip(QueuedTooltip.create(getTooltips().get().split("\n")));
+                REIHelper.getInstance().addTooltip(QueuedTooltip.create(getTooltips().get().split("\n")));
             else if (focused)
-                ScreenHelper.getLastOverlay().addTooltip(QueuedTooltip.create(new Point(x + width / 2, y + height / 2), getTooltips().get().split("\n")));
+                REIHelper.getInstance().addTooltip(QueuedTooltip.create(new Point(x + width / 2, y + height / 2), getTooltips().get().split("\n")));
     }
     
     public boolean isHovered(int mouseX, int mouseY) {

+ 2 - 3
src/main/java/me/shedaniel/rei/gui/widget/ClickableLabelWidget.java

@@ -25,7 +25,6 @@ package me.shedaniel.rei.gui.widget;
 
 import me.shedaniel.math.api.Point;
 import me.shedaniel.rei.api.REIHelper;
-import me.shedaniel.rei.impl.ScreenHelper;
 import org.jetbrains.annotations.ApiStatus;
 
 public abstract class ClickableLabelWidget extends LabelWidget {
@@ -79,9 +78,9 @@ public abstract class ClickableLabelWidget extends LabelWidget {
     protected void drawTooltips(int mouseX, int mouseY) {
         if (isClickable() && getTooltips().isPresent())
             if (!focused && containsMouse(mouseX, mouseY))
-                ScreenHelper.getLastOverlay().addTooltip(QueuedTooltip.create(getTooltips().get().split("\n")));
+                REIHelper.getInstance().addTooltip(QueuedTooltip.create(getTooltips().get().split("\n")));
             else if (focused)
-                ScreenHelper.getLastOverlay().addTooltip(QueuedTooltip.create(getPosition(), getTooltips().get().split("\n")));
+                REIHelper.getInstance().addTooltip(QueuedTooltip.create(getPosition(), getTooltips().get().split("\n")));
     }
     
     public int getHoveredColor() {

+ 1 - 1
src/main/java/me/shedaniel/rei/gui/widget/DraggableWidget.java

@@ -60,7 +60,7 @@ public abstract class DraggableWidget extends WidgetWithBounds {
     
     @Override
     public boolean mouseDragged(double double_1, double double_2, int int_1, double double_3, double double_4) {
-        Point mouse = PointHelper.fromMouse();
+        Point mouse = PointHelper.ofMouse();
         if (int_1 == 0) {
             if (!dragged) {
                 if (getGrabBounds().contains(mouse)) {

+ 3 - 3
src/main/java/me/shedaniel/rei/gui/widget/EntryListWidget.java

@@ -459,7 +459,7 @@ public class EntryListWidget extends WidgetWithBounds {
             }
         }
         if (containsMouse(mouseX, mouseY) && ClientHelper.getInstance().isCheating() && !minecraft.player.inventory.getCursorStack().isEmpty() && RoughlyEnoughItemsCore.hasPermissionToUsePackets())
-            ScreenHelper.getLastOverlay().addTooltip(QueuedTooltip.create(I18n.translate("text.rei.delete_items")));
+            REIHelper.getInstance().addTooltip(QueuedTooltip.create(I18n.translate("text.rei.delete_items")));
     }
     
     private int getScrollbarMinX() {
@@ -500,7 +500,7 @@ public class EntryListWidget extends WidgetWithBounds {
             
             int scrollbarPositionMinX = getScrollbarMinX();
             int scrollbarPositionMaxX = scrollbarPositionMinX + 6;
-            boolean hovered = (new Rectangle(scrollbarPositionMinX, minY, scrollbarPositionMaxX - scrollbarPositionMinX, height)).contains(PointHelper.fromMouse());
+            boolean hovered = (new Rectangle(scrollbarPositionMinX, minY, scrollbarPositionMaxX - scrollbarPositionMinX, height)).contains(PointHelper.ofMouse());
             float bottomC = (hovered ? .67f : .5f) * (REIHelper.getInstance().isDarkThemeEnabled() ? 0.8f : 1f);
             float topC = (hovered ? .87f : .67f) * (REIHelper.getInstance().isDarkThemeEnabled() ? 0.8f : 1f);
             
@@ -545,7 +545,7 @@ public class EntryListWidget extends WidgetWithBounds {
     
     @Override
     public boolean keyPressed(int int_1, int int_2, int int_3) {
-        if (containsMouse(PointHelper.fromMouse()))
+        if (containsMouse(PointHelper.ofMouse()))
             for (Widget widget : widgets)
                 if (widget.keyPressed(int_1, int_2, int_3))
                     return true;

+ 3 - 3
src/main/java/me/shedaniel/rei/gui/widget/EntryWidget.java

@@ -221,7 +221,7 @@ public class EntryWidget extends WidgetWithBounds {
                 else
                     tooltip.getText().addAll(Arrays.asList(I18n.translate("text.rei.favorites_tooltip", name).split("\n")));
             }
-            ScreenHelper.getLastOverlay().addTooltip(tooltip);
+            REIHelper.getInstance().addTooltip(tooltip);
         }
     }
     
@@ -267,8 +267,8 @@ public class EntryWidget extends WidgetWithBounds {
     public boolean keyPressed(int int_1, int int_2, int int_3) {
         if (!interactable)
             return false;
-        if (containsMouse(PointHelper.fromMouse())) {
-            if (interactableFavorites && ConfigObject.getInstance().isFavoritesEnabled() && containsMouse(PointHelper.fromMouse()) && !getCurrentEntry().isEmpty()) {
+        if (containsMouse(PointHelper.ofMouse())) {
+            if (interactableFavorites && ConfigObject.getInstance().isFavoritesEnabled() && containsMouse(PointHelper.ofMouse()) && !getCurrentEntry().isEmpty()) {
                 ModifierKeyCode keyCode = ConfigObject.getInstance().getFavoriteKeyCode();
                 EntryStack entry = getCurrentEntry().copy();
                 entry.setAmount(127);

+ 3 - 3
src/main/java/me/shedaniel/rei/gui/widget/FavoritesListWidget.java

@@ -153,7 +153,7 @@ public class FavoritesListWidget extends WidgetWithBounds {
         ScissorsHandler.INSTANCE.removeLastScissor();
         renderScrollbar();
         if (containsMouse(mouseX, mouseY) && ClientHelper.getInstance().isCheating() && !minecraft.player.inventory.getCursorStack().isEmpty() && RoughlyEnoughItemsCore.hasPermissionToUsePackets())
-            ScreenHelper.getLastOverlay().addTooltip(QueuedTooltip.create(I18n.translate("text.rei.delete_items")));
+            REIHelper.getInstance().addTooltip(QueuedTooltip.create(I18n.translate("text.rei.delete_items")));
     }
     
     private int getScrollbarMinX() {
@@ -194,7 +194,7 @@ public class FavoritesListWidget extends WidgetWithBounds {
             
             int scrollbarPositionMinX = getScrollbarMinX();
             int scrollbarPositionMaxX = scrollbarPositionMinX + 6;
-            boolean hovered = (new Rectangle(scrollbarPositionMinX, minY, scrollbarPositionMaxX - scrollbarPositionMinX, height)).contains(PointHelper.fromMouse());
+            boolean hovered = (new Rectangle(scrollbarPositionMinX, minY, scrollbarPositionMaxX - scrollbarPositionMinX, height)).contains(PointHelper.ofMouse());
             float bottomC = (hovered ? .67f : .5f) * (REIHelper.getInstance().isDarkThemeEnabled() ? 0.8f : 1f);
             float topC = (hovered ? .87f : .67f) * (REIHelper.getInstance().isDarkThemeEnabled() ? 0.8f : 1f);
             
@@ -239,7 +239,7 @@ public class FavoritesListWidget extends WidgetWithBounds {
     
     @Override
     public boolean keyPressed(int int_1, int int_2, int int_3) {
-        if (containsMouse(PointHelper.fromMouse()))
+        if (containsMouse(PointHelper.ofMouse()))
             for (Widget widget : children())
                 if (widget.keyPressed(int_1, int_2, int_3))
                     return true;

+ 1 - 2
src/main/java/me/shedaniel/rei/gui/widget/LabelWidget.java

@@ -26,7 +26,6 @@ package me.shedaniel.rei.gui.widget;
 import me.shedaniel.math.api.Point;
 import me.shedaniel.math.api.Rectangle;
 import me.shedaniel.rei.api.REIHelper;
-import me.shedaniel.rei.impl.ScreenHelper;
 import net.minecraft.client.gui.Element;
 import org.jetbrains.annotations.ApiStatus;
 
@@ -172,6 +171,6 @@ public class LabelWidget extends WidgetWithBounds {
     protected void drawTooltips(int mouseX, int mouseY) {
         if (getTooltips().isPresent())
             if (containsMouse(mouseX, mouseY))
-                ScreenHelper.getLastOverlay().addTooltip(QueuedTooltip.create(getTooltips().get().split("\n")));
+                REIHelper.getInstance().addTooltip(QueuedTooltip.create(getTooltips().get().split("\n")));
     }
 }

+ 7 - 2
src/main/java/me/shedaniel/rei/gui/widget/QueuedTooltip.java

@@ -27,6 +27,7 @@ package me.shedaniel.rei.gui.widget;
 import com.google.common.collect.Lists;
 import me.shedaniel.math.api.Point;
 import me.shedaniel.math.impl.PointHelper;
+import me.shedaniel.rei.api.REIHelper;
 import org.jetbrains.annotations.ApiStatus;
 
 import java.util.List;
@@ -52,11 +53,11 @@ public class QueuedTooltip {
     }
     
     public static QueuedTooltip create(List<String> text) {
-        return QueuedTooltip.create(PointHelper.fromMouse(), text);
+        return QueuedTooltip.create(PointHelper.ofMouse(), text);
     }
     
     public static QueuedTooltip create(String... text) {
-        return QueuedTooltip.create(PointHelper.fromMouse(), text);
+        return QueuedTooltip.create(PointHelper.ofMouse(), text);
     }
     
     @ApiStatus.Internal
@@ -86,4 +87,8 @@ public class QueuedTooltip {
         return text;
     }
     
+    public void queue() {
+        REIHelper.getInstance().addTooltip(this);
+    }
+    
 }

+ 2 - 3
src/main/java/me/shedaniel/rei/gui/widget/TabWidget.java

@@ -28,7 +28,6 @@ import me.shedaniel.rei.api.ClientHelper;
 import me.shedaniel.rei.api.EntryStack;
 import me.shedaniel.rei.api.REIHelper;
 import me.shedaniel.rei.api.RecipeCategory;
-import me.shedaniel.rei.impl.ScreenHelper;
 import net.minecraft.util.Formatting;
 import net.minecraft.util.Identifier;
 import org.jetbrains.annotations.ApiStatus;
@@ -117,9 +116,9 @@ public class TabWidget extends WidgetWithBounds {
     
     private void drawTooltip() {
         if (this.minecraft.options.advancedItemTooltips)
-            ScreenHelper.getLastOverlay().addTooltip(QueuedTooltip.create(categoryName, Formatting.DARK_GRAY.toString() + category.getIdentifier().toString(), ClientHelper.getInstance().getFormattedModFromIdentifier(category.getIdentifier())));
+            REIHelper.getInstance().addTooltip(QueuedTooltip.create(categoryName, Formatting.DARK_GRAY.toString() + category.getIdentifier().toString(), ClientHelper.getInstance().getFormattedModFromIdentifier(category.getIdentifier())));
         else
-            ScreenHelper.getLastOverlay().addTooltip(QueuedTooltip.create(categoryName, ClientHelper.getInstance().getFormattedModFromIdentifier(category.getIdentifier())));
+            REIHelper.getInstance().addTooltip(QueuedTooltip.create(categoryName, ClientHelper.getInstance().getFormattedModFromIdentifier(category.getIdentifier())));
     }
     
     @Override

+ 1 - 1
src/main/java/me/shedaniel/rei/gui/widget/TextFieldWidget.java

@@ -404,7 +404,7 @@ public class TextFieldWidget extends WidgetWithBounds implements Tickable {
     
     public void renderBorder() {
         if (this.hasBorder()) {
-            if (containsMouse(PointHelper.fromMouse()) || focused)
+            if (containsMouse(PointHelper.ofMouse()) || focused)
                 fill(this.bounds.x - 1, this.bounds.y - 1, this.bounds.x + this.bounds.width + 1, this.bounds.y + this.bounds.height + 1, REIHelper.getInstance().isDarkThemeEnabled() ? -17587 : -1);
             else
                 fill(this.bounds.x - 1, this.bounds.y - 1, this.bounds.x + this.bounds.width + 1, this.bounds.y + this.bounds.height + 1, -6250336);

+ 4 - 0
src/main/java/me/shedaniel/rei/impl/ClientHelperImpl.java

@@ -89,6 +89,10 @@ public class ClientHelperImpl implements ClientHelper, ClientModInitializer {
     });
     private final Map<String, String> modNameCache = Maps.newHashMap();
     
+    /**
+     * @return the instance of {@link ClientHelperImpl}
+     * @see ClientHelper#getInstance()
+     */
     @ApiStatus.Internal
     public static ClientHelperImpl getInstance() {
         return instance;

+ 14 - 0
src/main/java/me/shedaniel/rei/impl/ScreenHelper.java

@@ -33,6 +33,7 @@ import me.shedaniel.rei.api.REIHelper;
 import me.shedaniel.rei.gui.ContainerScreenOverlay;
 import me.shedaniel.rei.gui.OverlaySearchField;
 import me.shedaniel.rei.gui.RecipeScreen;
+import me.shedaniel.rei.gui.widget.QueuedTooltip;
 import me.shedaniel.rei.gui.widget.TextFieldWidget;
 import me.shedaniel.rei.listeners.ContainerScreenHooks;
 import net.fabricmc.api.ClientModInitializer;
@@ -45,6 +46,7 @@ import net.minecraft.item.ItemStack;
 import net.minecraft.util.ActionResult;
 import org.apache.logging.log4j.util.TriConsumer;
 import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.Nullable;
 
 import java.util.LinkedHashSet;
 import java.util.List;
@@ -61,10 +63,22 @@ public class ScreenHelper implements ClientModInitializer, REIHelper {
     private static LinkedHashSet<RecipeScreen> lastRecipeScreen = Sets.newLinkedHashSetWithExpectedSize(5);
     private static ScreenHelper instance;
     
+    /**
+     * @return the instance of screen helper
+     * @see REIHelper#getInstance()
+     */
+    @ApiStatus.Internal
     public static ScreenHelper getInstance() {
         return instance;
     }
     
+    @Override
+    public void addTooltip(@Nullable QueuedTooltip tooltip) {
+        if (overlay != null && tooltip != null) {
+            overlay.addTooltip(tooltip);
+        }
+    }
+    
     @Override
     public TextFieldWidget getSearchTextField() {
         return searchField;

+ 0 - 35
src/main/java/me/shedaniel/rei/impl/compat/ModelHasDepth1151Compat.java

@@ -1,35 +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.impl.compat;
-
-import net.minecraft.client.render.model.BakedModel;
-
-import java.util.function.Predicate;
-
-public class ModelHasDepth1151Compat implements Predicate<BakedModel> {
-    @Override
-    public boolean test(BakedModel bakedModel) {
-        return bakedModel.hasDepth();
-    }
-}

+ 0 - 35
src/main/java/me/shedaniel/rei/impl/compat/ModelSideLit1152Compat.java

@@ -1,35 +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.impl.compat;
-
-import net.minecraft.client.render.model.BakedModel;
-
-import java.util.function.Predicate;
-
-public class ModelSideLit1152Compat implements Predicate<BakedModel> {
-    @Override
-    public boolean test(BakedModel bakedModel) {
-        return bakedModel.isSideLit();
-    }
-}

+ 1 - 1
src/main/java/me/shedaniel/rei/plugin/beacon/DefaultBeaconBaseCategory.java

@@ -214,7 +214,7 @@ public class DefaultBeaconBaseCategory implements RecipeCategory<DefaultBeaconBa
                 height = Math.max(10, height);
                 int minY = Math.min(Math.max((int) scroll * (this.getBounds().height - 2 - height) / maxScroll + getBounds().y + 1, getBounds().y + 1), getBounds().getMaxY() - 1 - height);
                 
-                boolean hovered = new Rectangle(scrollbarPositionMinX, minY, scrollbarPositionMaxX - scrollbarPositionMinX, height).contains(PointHelper.fromMouse());
+                boolean hovered = new Rectangle(scrollbarPositionMinX, minY, scrollbarPositionMaxX - scrollbarPositionMinX, height).contains(PointHelper.ofMouse());
                 int bottomC = hovered ? 168 : 128;
                 int topC = hovered ? 222 : 172;
                 

+ 1 - 1
src/main/java/me/shedaniel/rei/plugin/information/DefaultInformationCategory.java

@@ -246,7 +246,7 @@ public class DefaultInformationCategory implements RecipeCategory<DefaultInforma
                 height = Math.max(10, height);
                 int minY = Math.min(Math.max((int) scroll * (this.getBounds().height - 2 - height) / maxScroll + getBounds().y + 1, getBounds().y + 1), getBounds().getMaxY() - 1 - height);
                 
-                boolean hovered = new Rectangle(scrollbarPositionMinX, minY, scrollbarPositionMaxX - scrollbarPositionMinX, height).contains(PointHelper.fromMouse());
+                boolean hovered = new Rectangle(scrollbarPositionMinX, minY, scrollbarPositionMaxX - scrollbarPositionMinX, height).contains(PointHelper.ofMouse());
                 int bottomC = hovered ? 168 : 128;
                 int topC = hovered ? 222 : 172;