Parcourir la source

5.x - 20w30a

Signed-off-by: shedaniel <daniel@shedaniel.me>
shedaniel il y a 4 ans
Parent
commit
4be9951291
100 fichiers modifiés avec 695 ajouts et 275 suppressions
  1. 1 0
      .github/workflows/curseforge.yml
  2. 7 7
      .github/workflows/gradle.yml
  3. 10 10
      .github/workflows/stale.yml
  4. 8 7
      .gitignore
  5. 0 2
      .travis.yml
  6. 1 3
      LICENSE
  7. 1 0
      RoughlyEnoughItems-api/build.gradle
  8. 0 0
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/AutoTransferHandler.java
  9. 1 3
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/BaseBoundsHandler.java
  10. 0 0
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/ButtonAreaSupplier.java
  11. 13 22
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/ClientHelper.java
  12. 5 3
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/ConfigManager.java
  13. 4 6
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/ConfigObject.java
  14. 6 3
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/DisplayHelper.java
  15. 0 0
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/DisplayVisibilityHandler.java
  16. 0 0
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/DrawableConsumer.java
  17. 3 3
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/EntryRegistry.java
  18. 30 16
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/EntryStack.java
  19. 0 0
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/FocusedStackProvider.java
  20. 0 0
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/LiveRecipeGenerator.java
  21. 0 0
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/OverlayDecider.java
  22. 4 2
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/REIHelper.java
  23. 0 0
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/REIOverlay.java
  24. 0 0
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/REIPluginEntry.java
  25. 3 1
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/RecipeCategory.java
  26. 0 0
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/RecipeDisplay.java
  27. 3 3
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/RecipeHelper.java
  28. 0 0
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/TextRepresentable.java
  29. 0 0
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/TextTest.java
  30. 0 0
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/TransferRecipeCategory.java
  31. 1 0
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/TransferRecipeDisplay.java
  32. 21 2
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/fluid/FluidSupportProvider.java
  33. 186 0
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/fractions/Fraction.java
  34. 0 0
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/plugins/REIPluginV0.java
  35. 41 2
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/subsets/SubsetsRegistry.java
  36. 0 0
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/widgets/Arrow.java
  37. 0 0
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/widgets/BaseWidget.java
  38. 0 0
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/widgets/BurningFire.java
  39. 0 0
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/widgets/Button.java
  40. 21 2
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/widgets/Label.java
  41. 0 0
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/widgets/Panel.java
  42. 0 0
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/widgets/Slot.java
  43. 12 12
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/widgets/Tooltip.java
  44. 17 16
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/widgets/Widgets.java
  45. 3 0
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/gui/config/AppearanceTheme.java
  46. 3 0
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/gui/config/ConfigButtonPosition.java
  47. 0 0
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/gui/config/DisplayPanelLocation.java
  48. 0 4
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/gui/config/EntryPanelOrdering.java
  49. 3 2
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/gui/config/EntryPanelOrderingConfig.java
  50. 3 2
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/gui/config/ItemCheatingMode.java
  51. 0 0
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/gui/config/ItemCheatingStyle.java
  52. 3 0
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/gui/config/RecipeBorderType.java
  53. 3 0
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/gui/config/RecipeScreenType.java
  54. 3 2
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/gui/config/SearchFieldLocation.java
  55. 0 0
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/gui/entries/RecipeEntry.java
  56. 0 0
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/gui/entries/SimpleRecipeEntry.java
  57. 0 0
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/gui/widget/TextFieldWidget.java
  58. 0 0
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/gui/widget/Widget.java
  59. 0 0
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/gui/widget/WidgetWithBounds.java
  60. 161 0
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/impl/Internals.java
  61. 4 3
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/impl/RenderingEntry.java
  62. 0 0
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/server/ContainerInfo.java
  63. 0 0
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/server/ContainerInfoHandler.java
  64. 0 0
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/server/RecipeFinder.java
  65. 0 0
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/server/RecipeGridAligner.java
  66. 0 0
      RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/utils/CollectionUtils.java
  67. 20 0
      RoughlyEnoughItems-api/src/main/resources/fabric.mod.json
  68. BIN
      RoughlyEnoughItems-api/src/main/resources/icon.png
  69. 9 0
      RoughlyEnoughItems-default-plugin/build.gradle
  70. 24 83
      RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java
  71. 0 0
      RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/DefaultPotionEffectExclusionZones.java
  72. 5 3
      RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/DefaultRecipeBookExclusionZones.java
  73. 0 0
      RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/DefaultServerContainerPlugin.java
  74. 4 4
      RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/autocrafting/DefaultRecipeBookHandler.java
  75. 1 1
      RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/beacon/DefaultBeaconBaseCategory.java
  76. 0 0
      RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/beacon/DefaultBeaconBaseDisplay.java
  77. 0 0
      RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/blasting/DefaultBlastingDisplay.java
  78. 4 4
      RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/brewing/BrewingRecipe.java
  79. 5 1
      RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/brewing/DefaultBrewingCategory.java
  80. 2 0
      RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/brewing/DefaultBrewingDisplay.java
  81. 12 24
      RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/brewing/RegisteredBrewingRecipe.java
  82. 0 0
      RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/campfire/DefaultCampfireCategory.java
  83. 0 2
      RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/campfire/DefaultCampfireDisplay.java
  84. 4 1
      RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/composting/DefaultCompostingCategory.java
  85. 0 0
      RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/composting/DefaultCompostingDisplay.java
  86. 0 0
      RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/containers/CraftingContainerInfoWrapper.java
  87. 0 0
      RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/cooking/DefaultCookingCategory.java
  88. 0 0
      RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/cooking/DefaultCookingDisplay.java
  89. 0 0
      RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/crafting/DefaultCraftingCategory.java
  90. 0 0
      RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/crafting/DefaultCraftingDisplay.java
  91. 0 0
      RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/crafting/DefaultCustomDisplay.java
  92. 0 3
      RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/crafting/DefaultShapedDisplay.java
  93. 0 0
      RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/crafting/DefaultShapelessDisplay.java
  94. 7 2
      RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/fuel/DefaultFuelCategory.java
  95. 0 0
      RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/fuel/DefaultFuelDisplay.java
  96. 6 5
      RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/information/DefaultInformationCategory.java
  97. 0 0
      RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/information/DefaultInformationDisplay.java
  98. 7 4
      RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/mixin/MixinBrewingRecipeRegistry.java
  99. 0 0
      RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/smelting/DefaultSmeltingDisplay.java
  100. 0 0
      RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/smithing/DefaultSmithingCategory.java

+ 1 - 0
.github/workflows/curseforge.yml

@@ -6,6 +6,7 @@ on:
       - 3.x
       - 4.x-unstable
       - 4.x
+      - 5.x
 
 jobs:
   build:

+ 7 - 7
.github/workflows/gradle.yml

@@ -6,10 +6,10 @@ jobs:
   build:
     runs-on: ubuntu-latest
     steps:
-    - uses: actions/checkout@v1
-    - name: Set up JDK 1.8
-      uses: actions/setup-java@v1
-      with:
-        java-version: 1.8
-    - name: Build with Gradle
-      run: ./gradlew clean build --refresh-dependencies --stacktrace
+      - uses: actions/checkout@v1
+      - name: Set up JDK 1.8
+        uses: actions/setup-java@v1
+        with:
+          java-version: 1.8
+      - name: Build with Gradle
+        run: ./gradlew clean build --refresh-dependencies --stacktrace

+ 10 - 10
.github/workflows/stale.yml

@@ -2,19 +2,19 @@ name: Mark stale issues and pull requests
 
 on:
   schedule:
-  - cron: "0 0 * * *"
+    - cron: "0 0 * * *"
 
 jobs:
   stale:
 
     runs-on: ubuntu-latest
-    
+
     steps:
-    - uses: actions/stale@v1
-      with:
-        repo-token: ${{ secrets.GITHUB_TOKEN }}
-        stale-issue-message: 'This issue is marked with stale as this issue had no activity in 60 days. This issue will not be automatically closed.'
-        stale-pr-message: 'This pull request is marked with stale as this pull request had no activity in 60 days. This pull request will not be automatically closed.'
-        stale-issue-label: 'stale'
-        stale-pr-label: 'stale'
-        days-before-close: 1000000000
+      - uses: actions/stale@v1
+        with:
+          repo-token: ${{ secrets.GITHUB_TOKEN }}
+          stale-issue-message: 'This issue is marked with stale as this issue had no activity in 60 days. This issue will not be automatically closed.'
+          stale-pr-message: 'This pull request is marked with stale as this pull request had no activity in 60 days. This pull request will not be automatically closed.'
+          stale-issue-label: 'stale'
+          stale-pr-label: 'stale'
+          days-before-close: 1000000000

+ 8 - 7
.gitignore

@@ -1,12 +1,17 @@
 # Compiled nonsense that does not belong in *source* control
+*/build
 /build
 /bin
+*/bin
 /.gradle
+*/.gradle
 /minecraft
+*/minecraft
 /out
+*/run
+*/out
 /run
 /classes
-/old
 
 # IDE nonsense that could go in source control but really shouldn't
 .classpath
@@ -19,13 +24,9 @@
 *.ipr
 *.iws
 
-# Sekrit files
+# Sekrit files 
 private.properties
 
 # Files from bad operating systems :^)
 Thumbs.db
-.DS_Store
-
-secret\.properties
-
-local\.properties
+.DS_Store

+ 0 - 2
.travis.yml

@@ -1,2 +0,0 @@
-language: java
-script: ./gradlew clean build

+ 1 - 3
LICENSE

@@ -20,6 +20,4 @@ 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.
 
-Jetbrains Annotations is bundled with Roughly Enough Items, and is licensed under Apache License 2.0.
-Auto Config is bundled with Roughly Enough items, and is licensed under Apache License 2.0.
-Cloth Events and Cloth Config is bundled with Roughly Enough Items, and is licensed under The Unlicense.
+Auto Config is bundled with Roughly Enough items, and is licensed under Apache License 2.0.

+ 1 - 0
RoughlyEnoughItems-api/build.gradle

@@ -0,0 +1 @@
+archivesBaseName = "RoughlyEnoughItems-api"

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


+ 1 - 3
src/main/java/me/shedaniel/rei/api/BaseBoundsHandler.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/BaseBoundsHandler.java

@@ -24,10 +24,8 @@
 package me.shedaniel.rei.api;
 
 import me.shedaniel.math.Rectangle;
-import me.shedaniel.rei.impl.DisplayHelperImpl;
 import net.fabricmc.api.EnvType;
 import net.fabricmc.api.Environment;
-import net.minecraft.client.gui.screen.Screen;
 
 import java.util.List;
 import java.util.function.Supplier;
@@ -36,7 +34,7 @@ import java.util.function.Supplier;
 public interface BaseBoundsHandler extends OverlayDecider {
     
     static BaseBoundsHandler getInstance() {
-        return ((DisplayHelperImpl) DisplayHelper.getInstance()).getBaseBoundsHandler();
+        return DisplayHelper.getInstance().getBaseBoundsHandler();
     }
     
     /**

+ 0 - 0
src/main/java/me/shedaniel/rei/api/ButtonAreaSupplier.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/ButtonAreaSupplier.java


+ 13 - 22
src/main/java/me/shedaniel/rei/api/ClientHelper.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/ClientHelper.java

@@ -23,13 +23,10 @@
 
 package me.shedaniel.rei.api;
 
-import me.shedaniel.rei.gui.RecipeScreen;
-import me.shedaniel.rei.impl.ClientHelperImpl;
+import me.shedaniel.rei.impl.Internals;
 import me.shedaniel.rei.utils.CollectionUtils;
 import net.fabricmc.api.EnvType;
 import net.fabricmc.api.Environment;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.gui.screen.Screen;
 import net.minecraft.item.Item;
 import net.minecraft.item.ItemStack;
 import net.minecraft.text.Text;
@@ -47,10 +44,10 @@ import java.util.Set;
 public interface ClientHelper {
     
     /**
-     * @return the api instance of {@link ClientHelperImpl}
+     * @return the instance of {@link me.shedaniel.rei.api.ClientHelper}
      */
     static ClientHelper getInstance() {
-        return ClientHelperImpl.getInstance();
+        return Internals.getClientHelper();
     }
     
     /**
@@ -204,9 +201,11 @@ public interface ClientHelper {
     
     boolean openView(ViewSearchBuilder builder);
     
+    boolean canUseMovePackets();
+    
     interface ViewSearchBuilder {
         static ViewSearchBuilder builder() {
-            return new ClientHelperImpl.ViewSearchBuilder();
+            return Internals.createViewSearchBuilder();
         }
         
         ViewSearchBuilder addCategory(Identifier category);
@@ -216,31 +215,23 @@ public interface ClientHelper {
         default ViewSearchBuilder addAllCategories() {
             return addCategories(CollectionUtils.map(RecipeHelper.getInstance().getAllCategories(), RecipeCategory::getIdentifier));
         }
-    
+        
         @NotNull Set<Identifier> getCategories();
-    
+        
         ViewSearchBuilder addRecipesFor(EntryStack stack);
-    
+        
         @NotNull List<EntryStack> getRecipesFor();
-    
+        
         ViewSearchBuilder addUsagesFor(EntryStack stack);
-    
+        
         @NotNull List<EntryStack> getUsagesFor();
-    
+        
         ViewSearchBuilder setPreferredOpenedCategory(@Nullable Identifier category);
         
         @Nullable
         Identifier getPreferredOpenedCategory();
         
-        default ViewSearchBuilder fillPreferredOpenedCategory() {
-            if (getPreferredOpenedCategory() == null) {
-                Screen currentScreen = MinecraftClient.getInstance().currentScreen;
-                if (currentScreen instanceof RecipeScreen) {
-                    setPreferredOpenedCategory(((RecipeScreen) currentScreen).getCurrentCategory());
-                }
-            }
-            return this;
-        }
+        ViewSearchBuilder fillPreferredOpenedCategory();
         
         ViewSearchBuilder setInputNotice(@Nullable EntryStack stack);
         

+ 5 - 3
src/main/java/me/shedaniel/rei/api/ConfigManager.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/ConfigManager.java

@@ -23,7 +23,7 @@
 
 package me.shedaniel.rei.api;
 
-import me.shedaniel.rei.RoughlyEnoughItemsCore;
+import me.shedaniel.rei.impl.Internals;
 import net.fabricmc.api.EnvType;
 import net.fabricmc.api.Environment;
 import net.minecraft.client.MinecraftClient;
@@ -34,11 +34,11 @@ import org.jetbrains.annotations.NotNull;
 public interface ConfigManager {
     
     /**
-     * @return the api instance of {@link me.shedaniel.rei.impl.ConfigManagerImpl}
+     * @return the instance of {@link me.shedaniel.rei.api.ConfigManager}
      */
     @NotNull
     static ConfigManager getInstance() {
-        return RoughlyEnoughItemsCore.getConfigManager();
+        return Internals.getConfigManager();
     }
     
     /**
@@ -75,4 +75,6 @@ public interface ConfigManager {
      */
     Screen getConfigScreen(Screen parent);
     
+    ConfigObject getConfig();
+    
 }

+ 4 - 6
src/main/java/me/shedaniel/rei/api/ConfigObject.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/ConfigObject.java

@@ -25,8 +25,6 @@ package me.shedaniel.rei.api;
 
 import me.shedaniel.clothconfig2.api.ModifierKeyCode;
 import me.shedaniel.rei.gui.config.*;
-import me.shedaniel.rei.impl.ConfigManagerImpl;
-import me.shedaniel.rei.impl.filtering.FilteringRule;
 import net.fabricmc.api.EnvType;
 import net.fabricmc.api.Environment;
 import org.jetbrains.annotations.ApiStatus;
@@ -37,10 +35,10 @@ import java.util.List;
 public interface ConfigObject {
     
     /**
-     * @return the api instance of {@link me.shedaniel.rei.impl.ConfigObjectImpl}
+     * @return the instance of {@link me.shedaniel.rei.api.ConfigObject}
      */
     static ConfigObject getInstance() {
-        return ((ConfigManagerImpl) ConfigManager.getInstance()).getConfig();
+        return ConfigManager.getInstance().getConfig();
     }
     
     boolean isOverlayVisible();
@@ -71,6 +69,8 @@ public interface ConfigObject {
     
     void setRecipeScreenType(RecipeScreenType recipeScreenType);
     
+    @Deprecated
+    @ApiStatus.ScheduledForRemoval
     boolean isLoadingDefaultPlugin();
     
     SearchFieldLocation getSearchFieldLocation();
@@ -151,8 +151,6 @@ public interface ConfigObject {
     
     List<EntryStack> getFilteredStacks();
     
-    List<FilteringRule<?>> getFilteringRules();
-    
     @ApiStatus.Experimental
     boolean shouldAsyncSearch();
     

+ 6 - 3
src/main/java/me/shedaniel/rei/api/DisplayHelper.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/DisplayHelper.java

@@ -24,9 +24,9 @@
 package me.shedaniel.rei.api;
 
 import me.shedaniel.math.Rectangle;
-import me.shedaniel.rei.RoughlyEnoughItemsCore;
 import me.shedaniel.rei.gui.config.DisplayPanelLocation;
 import me.shedaniel.rei.gui.config.SearchFieldLocation;
+import me.shedaniel.rei.impl.Internals;
 import net.fabricmc.api.EnvType;
 import net.fabricmc.api.Environment;
 import net.minecraft.util.ActionResult;
@@ -42,11 +42,11 @@ import static net.minecraft.util.ActionResult.PASS;
 public interface DisplayHelper {
     
     /**
-     * @return the api instance of {@link me.shedaniel.rei.impl.DisplayHelperImpl}
+     * @return the instance of {@link me.shedaniel.rei.api.DisplayHelper}
      */
     @NotNull
     static DisplayHelper getInstance() {
-        return RoughlyEnoughItemsCore.getDisplayHelper();
+        return Internals.getDisplayHelper();
     }
     
     /**
@@ -102,6 +102,9 @@ public interface DisplayHelper {
     @ApiStatus.Experimental
     void resetCache();
     
+    @ApiStatus.Internal
+    BaseBoundsHandler getBaseBoundsHandler();
+    
     interface DisplayBoundsProvider<T> extends OverlayDecider {
         /**
          * @param screen the screen

+ 0 - 0
src/main/java/me/shedaniel/rei/api/DisplayVisibilityHandler.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/DisplayVisibilityHandler.java


+ 0 - 0
src/main/java/me/shedaniel/rei/api/DrawableConsumer.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/DrawableConsumer.java


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

@@ -23,7 +23,7 @@
 
 package me.shedaniel.rei.api;
 
-import me.shedaniel.rei.RoughlyEnoughItemsCore;
+import me.shedaniel.rei.impl.Internals;
 import net.fabricmc.api.EnvType;
 import net.fabricmc.api.Environment;
 import net.minecraft.item.Item;
@@ -43,11 +43,11 @@ import java.util.stream.Stream;
 public interface EntryRegistry {
     
     /**
-     * @return the api instance of {@link me.shedaniel.rei.impl.EntryRegistryImpl}
+     * @return the instance of {@link me.shedaniel.rei.api.EntryRegistry}
      */
     @NotNull
     static EntryRegistry getInstance() {
-        return RoughlyEnoughItemsCore.getEntryRegistry();
+        return Internals.getEntryRegistry();
     }
     
     /**

+ 30 - 16
src/main/java/me/shedaniel/rei/api/EntryStack.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/EntryStack.java

@@ -28,10 +28,9 @@ import com.google.gson.JsonObject;
 import me.shedaniel.math.Point;
 import me.shedaniel.math.Rectangle;
 import me.shedaniel.rei.api.fluid.FluidSupportProvider;
+import me.shedaniel.rei.api.fractions.Fraction;
 import me.shedaniel.rei.api.widgets.Tooltip;
-import me.shedaniel.rei.impl.EmptyEntryStack;
-import me.shedaniel.rei.impl.FluidEntryStack;
-import me.shedaniel.rei.impl.ItemEntryStack;
+import me.shedaniel.rei.impl.Internals;
 import net.fabricmc.api.EnvType;
 import net.fabricmc.api.Environment;
 import net.minecraft.client.resource.language.I18n;
@@ -45,7 +44,6 @@ import net.minecraft.nbt.StringNbtReader;
 import net.minecraft.recipe.Ingredient;
 import net.minecraft.text.Text;
 import net.minecraft.util.Identifier;
-import net.minecraft.util.math.MathHelper;
 import net.minecraft.util.registry.Registry;
 import org.jetbrains.annotations.ApiStatus;
 import org.jetbrains.annotations.Nullable;
@@ -55,27 +53,30 @@ import java.util.function.Function;
 import java.util.function.Supplier;
 
 @Environment(EnvType.CLIENT)
-@SuppressWarnings("deprecation")
 public interface EntryStack extends TextRepresentable {
     
     static EntryStack empty() {
-        return EmptyEntryStack.EMPTY;
+        return Internals.getEntryStackProvider().empty();
     }
     
     static EntryStack create(Fluid fluid) {
-        return new FluidEntryStack(fluid);
+        return Internals.getEntryStackProvider().fluid(fluid);
     }
     
     static EntryStack create(Fluid fluid, int amount) {
-        return new FluidEntryStack(fluid, amount);
+        return create(fluid, Fraction.ofWhole(amount));
     }
     
     static EntryStack create(Fluid fluid, double amount) {
-        return new FluidEntryStack(fluid, amount);
+        return create(fluid, Fraction.from(amount));
+    }
+    
+    static EntryStack create(Fluid fluid, Fraction amount) {
+        return Internals.getEntryStackProvider().fluid(fluid, amount);
     }
     
     static EntryStack create(ItemStack stack) {
-        return new ItemEntryStack(stack);
+        return Internals.getEntryStackProvider().item(stack);
     }
     
     static EntryStack create(ItemConvertible item) {
@@ -207,7 +208,7 @@ public interface EntryStack extends TextRepresentable {
     }
     
     static EntryStack copyItemToFluid(EntryStack stack) {
-        return FluidSupportProvider.INSTANCE.itemToFluid(stack);
+        return FluidSupportProvider.getInstance().itemToFluid(stack);
     }
     
     Optional<Identifier> getIdentifier();
@@ -215,16 +216,24 @@ public interface EntryStack extends TextRepresentable {
     EntryStack.Type getType();
     
     default int getAmount() {
-        return MathHelper.floor(getFloatingAmount());
+        return getAccurateAmount().intValue();
     }
     
-    double getFloatingAmount();
+    Fraction getAccurateAmount();
+    
+    default double getFloatingAmount() {
+        return getAccurateAmount().doubleValue();
+    }
     
     default void setAmount(int amount) {
-        setFloatingAmount(amount);
+        setAmount(Fraction.ofWhole(amount));
     }
     
-    void setFloatingAmount(double amount);
+    default void setFloatingAmount(double amount) {
+        setAmount(Fraction.from(amount));
+    }
+    
+    void setAmount(Fraction amount);
     
     boolean isEmpty();
     
@@ -349,10 +358,15 @@ public interface EntryStack extends TextRepresentable {
         
         public static class Fluid {
             // Return null to disable
-            public static final Settings<Function<EntryStack, String>> AMOUNT_TOOLTIP = new Settings<>(stack -> I18n.translate("tooltip.rei.fluid_amount", stack.getAmount()));
+            public static final Settings<Function<EntryStack, String>> AMOUNT_TOOLTIP = new Settings<>(stack -> I18n.translate("tooltip.rei.fluid_amount", stack.simplifyAmount().getAccurateAmount()));
             
             private Fluid() {
             }
         }
     }
+    
+    default EntryStack simplifyAmount() {
+        setAmount(getAccurateAmount().simplify());
+        return this;
+    }
 }

+ 0 - 0
src/main/java/me/shedaniel/rei/api/FocusedStackProvider.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/FocusedStackProvider.java


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


+ 0 - 0
src/main/java/me/shedaniel/rei/api/OverlayDecider.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/OverlayDecider.java


+ 4 - 2
src/main/java/me/shedaniel/rei/api/REIHelper.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/REIHelper.java

@@ -25,11 +25,12 @@ package me.shedaniel.rei.api;
 
 import me.shedaniel.rei.api.widgets.Tooltip;
 import me.shedaniel.rei.gui.widget.TextFieldWidget;
-import me.shedaniel.rei.impl.ScreenHelper;
+import me.shedaniel.rei.impl.Internals;
 import net.fabricmc.api.EnvType;
 import net.fabricmc.api.Environment;
 import net.minecraft.client.gui.screen.ingame.ContainerScreen;
 import net.minecraft.item.ItemStack;
+import net.minecraft.util.Identifier;
 import org.jetbrains.annotations.ApiStatus;
 import org.jetbrains.annotations.Nullable;
 
@@ -43,7 +44,7 @@ public interface REIHelper {
      * @return the instance of {@link REIHelper}
      */
     static REIHelper getInstance() {
-        return ScreenHelper.getInstance();
+        return Internals.getREIHelper();
     }
     
     @ApiStatus.Experimental
@@ -64,4 +65,5 @@ public interface REIHelper {
     
     void queueTooltip(@Nullable Tooltip tooltip);
     
+    Identifier getDefaultDisplayTexture();
 }

+ 0 - 0
src/main/java/me/shedaniel/rei/api/REIOverlay.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/REIOverlay.java


+ 0 - 0
src/main/java/me/shedaniel/rei/api/REIPluginEntry.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/REIPluginEntry.java


+ 3 - 1
src/main/java/me/shedaniel/rei/api/RecipeCategory.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/RecipeCategory.java

@@ -28,13 +28,15 @@ import me.shedaniel.rei.api.widgets.Widgets;
 import me.shedaniel.rei.gui.entries.RecipeEntry;
 import me.shedaniel.rei.gui.entries.SimpleRecipeEntry;
 import me.shedaniel.rei.gui.widget.Widget;
+import net.fabricmc.api.EnvType;
+import net.fabricmc.api.Environment;
 import net.minecraft.util.Identifier;
 import org.jetbrains.annotations.ApiStatus;
 
 import java.util.Collections;
 import java.util.List;
 
-
+@Environment(EnvType.CLIENT)
 public interface RecipeCategory<T extends RecipeDisplay> {
     
     /**

+ 0 - 0
src/main/java/me/shedaniel/rei/api/RecipeDisplay.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/RecipeDisplay.java


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

@@ -24,7 +24,7 @@
 package me.shedaniel.rei.api;
 
 import me.shedaniel.math.Rectangle;
-import me.shedaniel.rei.RoughlyEnoughItemsCore;
+import me.shedaniel.rei.impl.Internals;
 import net.fabricmc.api.EnvType;
 import net.fabricmc.api.Environment;
 import net.minecraft.client.gui.screen.Screen;
@@ -46,11 +46,11 @@ import java.util.function.Predicate;
 public interface RecipeHelper {
     
     /**
-     * @return the api instance of {@link me.shedaniel.rei.impl.RecipeHelperImpl}
+     * @return the instance of {@link me.shedaniel.rei.api.RecipeHelper}
      */
     @NotNull
     static RecipeHelper getInstance() {
-        return RoughlyEnoughItemsCore.getRecipeHelper();
+        return Internals.getRecipeHelper();
     }
     
     AutoTransferHandler registerAutoCraftingHandler(AutoTransferHandler handler);

+ 0 - 0
src/main/java/me/shedaniel/rei/api/TextRepresentable.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/TextRepresentable.java


+ 0 - 0
src/main/java/me/shedaniel/rei/api/TextTest.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/TextTest.java


+ 0 - 0
src/main/java/me/shedaniel/rei/api/TransferRecipeCategory.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/TransferRecipeCategory.java


+ 1 - 0
src/main/java/me/shedaniel/rei/api/TransferRecipeDisplay.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/TransferRecipeDisplay.java

@@ -25,6 +25,7 @@ package me.shedaniel.rei.api;
 
 import me.shedaniel.rei.server.ContainerInfo;
 import net.minecraft.container.Container;
+
 import java.util.List;
 
 public interface TransferRecipeDisplay extends RecipeDisplay {

+ 21 - 2
src/main/java/me/shedaniel/rei/api/fluid/FluidSupportProvider.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/fluid/FluidSupportProvider.java

@@ -24,7 +24,9 @@
 package me.shedaniel.rei.api.fluid;
 
 import me.shedaniel.rei.api.EntryStack;
-import me.shedaniel.rei.impl.FluidSupportProviderImpl;
+import me.shedaniel.rei.impl.Internals;
+import net.fabricmc.api.EnvType;
+import net.fabricmc.api.Environment;
 import org.jetbrains.annotations.ApiStatus;
 import org.jetbrains.annotations.NotNull;
 
@@ -32,8 +34,25 @@ import org.jetbrains.annotations.NotNull;
  * Experimental library, scheduled to change if needed.
  */
 @ApiStatus.Experimental
+@Environment(EnvType.CLIENT)
 public interface FluidSupportProvider {
-    FluidSupportProvider INSTANCE = new FluidSupportProviderImpl();
+    @Deprecated
+    @ApiStatus.ScheduledForRemoval
+    FluidSupportProvider INSTANCE = new FluidSupportProvider() {
+        @Override
+        public void registerFluidProvider(@NotNull FluidProvider provider) {
+            getInstance().registerFluidProvider(provider);
+        }
+        
+        @Override
+        public @NotNull EntryStack itemToFluid(@NotNull EntryStack itemStack) {
+            return getInstance().itemToFluid(itemStack);
+        }
+    };
+    
+    static FluidSupportProvider getInstance() {
+        return Internals.getFluidSupportProvider();
+    }
     
     void registerFluidProvider(@NotNull FluidProvider provider);
     

+ 186 - 0
RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/fractions/Fraction.java

@@ -0,0 +1,186 @@
+/*
+ * This file is licensed under the MIT License, part of Roughly Enough Items.
+ * Copyright (c) 2018, 2019, 2020 shedaniel
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package me.shedaniel.rei.api.fractions;
+
+import com.google.common.math.LongMath;
+import org.jetbrains.annotations.NotNull;
+
+import java.text.DecimalFormat;
+
+public final class Fraction extends Number implements Comparable<Fraction> {
+    private static final Fraction EMPTY = ofWhole(0);
+    private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("###.###");
+    private final long numerator;
+    private final long denominator;
+    private final boolean integer;
+    private boolean simplified;
+    
+    private Fraction(long numerator, long denominator) {
+        if (denominator > 0) {
+            this.numerator = numerator;
+            this.denominator = denominator;
+        } else if (denominator < 0) {
+            this.numerator = -numerator;
+            this.denominator = -denominator;
+        } else {
+            throw new ArithmeticException("/ by zero");
+        }
+        this.integer = intValue() == doubleValue();
+        this.simplified = (this.numerator >= -1 && this.numerator <= 1) || this.denominator == 1;
+    }
+    
+    public static Fraction empty() {
+        return EMPTY;
+    }
+    
+    public static Fraction ofWhole(long whole) {
+        return new Fraction(whole, 1);
+    }
+    
+    public static Fraction of(long numerator, long denominator) {
+        return new Fraction(numerator, denominator);
+    }
+    
+    public static Fraction of(long whole, long numerator, long denominator) {
+        return of(numerator + whole * denominator, denominator);
+    }
+    
+    public static Fraction from(double value) {
+        int whole = (int) value;
+        double part = value - whole;
+        int i = 1;
+        
+        while (true) {
+            double tem = part / (1D / i);
+            long numerator = Math.round(tem);
+            if (Math.abs(tem - numerator) < 0.00001) {
+                return of(whole, numerator, i);
+            }
+            i++;
+        }
+    }
+    
+    public long getNumerator() {
+        return numerator;
+    }
+    
+    public long getDenominator() {
+        return denominator;
+    }
+    
+    public Fraction add(Fraction other) {
+        if (other.numerator == 0) return this;
+        return of(numerator * other.denominator + other.numerator * denominator, denominator * other.denominator);
+    }
+    
+    public Fraction minus(Fraction other) {
+        if (other.numerator == 0) return this;
+        return of(numerator * other.denominator - other.numerator * denominator, denominator * other.denominator);
+    }
+    
+    public Fraction multiply(Fraction other) {
+        if (other.numerator == other.denominator) return this;
+        return of(numerator * other.numerator, denominator * other.denominator);
+    }
+    
+    public Fraction divide(Fraction other) {
+        if (other.numerator == other.denominator) return this;
+        return of(numerator * other.denominator, denominator * other.numerator);
+    }
+    
+    public Fraction inverse() {
+        if (numerator == denominator)
+            return this;
+        Fraction fraction = of(denominator, numerator);
+        fraction.simplified = fraction.simplified && simplified;
+        return fraction;
+    }
+    
+    public Fraction simplify() {
+        if (simplified)
+            return this;
+        if (numerator == 0)
+            return ofWhole(0);
+        long gcd = LongMath.gcd(Math.abs(numerator), denominator);
+        Fraction fraction = of(numerator / gcd, denominator / gcd);
+        fraction.simplified = true;
+        return fraction;
+    }
+    
+    public boolean isGreaterThan(Fraction fraction) {
+        return compareTo(fraction) > 0;
+    }
+    
+    public boolean isLessThan(Fraction fraction) {
+        return compareTo(fraction) < 0;
+    }
+    
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        Fraction fraction = (Fraction) o;
+        return numerator * fraction.denominator == denominator * fraction.numerator;
+    }
+    
+    @Override
+    public int hashCode() {
+        return Double.hashCode(doubleValue());
+    }
+    
+    @Override
+    public int compareTo(@NotNull Fraction fraction) {
+        return Long.compare(numerator * fraction.denominator, denominator * fraction.numerator);
+    }
+    
+    @Override
+    public int intValue() {
+        return (int) longValue();
+    }
+    
+    @Override
+    public long longValue() {
+        return numerator / denominator;
+    }
+    
+    @Override
+    public float floatValue() {
+        return (float) numerator / denominator;
+    }
+    
+    @Override
+    public double doubleValue() {
+        return (double) numerator / denominator;
+    }
+    
+    public String toDecimalString() {
+        return DECIMAL_FORMAT.format(doubleValue());
+    }
+    
+    @Override
+    public String toString() {
+        if (integer) return toDecimalString();
+        return String.format("%s (%d/%d)", toDecimalString(), numerator, denominator);
+    }
+}

+ 0 - 0
src/main/java/me/shedaniel/rei/api/plugins/REIPluginV0.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/plugins/REIPluginV0.java


+ 41 - 2
src/main/java/me/shedaniel/rei/api/subsets/SubsetsRegistry.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/subsets/SubsetsRegistry.java

@@ -24,7 +24,9 @@
 package me.shedaniel.rei.api.subsets;
 
 import me.shedaniel.rei.api.EntryStack;
-import me.shedaniel.rei.impl.subsets.SubsetsRegistryImpl;
+import me.shedaniel.rei.impl.Internals;
+import net.fabricmc.api.EnvType;
+import net.fabricmc.api.Environment;
 import org.jetbrains.annotations.ApiStatus;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -35,8 +37,45 @@ import java.util.List;
 import java.util.Set;
 
 @ApiStatus.Experimental
+@Environment(EnvType.CLIENT)
 public interface SubsetsRegistry {
-    SubsetsRegistry INSTANCE = new SubsetsRegistryImpl();
+    @Deprecated
+    @ApiStatus.ScheduledForRemoval
+    SubsetsRegistry INSTANCE = new SubsetsRegistry() {
+        @Override
+        public @NotNull List<String> getEntryPaths(@NotNull EntryStack stack) {
+            return getInstance().getEntryPaths(stack);
+        }
+        
+        @Override
+        public @Nullable Set<EntryStack> getPathEntries(@NotNull String path) {
+            return getInstance().getPathEntries(path);
+        }
+        
+        @Override
+        public @NotNull Set<EntryStack> getOrCreatePathEntries(@NotNull String path) {
+            return getInstance().getOrCreatePathEntries(path);
+        }
+        
+        @Override
+        public @NotNull Set<String> getPaths() {
+            return getInstance().getPaths();
+        }
+        
+        @Override
+        public void registerPathEntry(@NotNull String path, @NotNull EntryStack stack) {
+            getInstance().registerPathEntry(path, stack);
+        }
+        
+        @Override
+        public void registerPathEntries(@NotNull String path, @NotNull Collection<EntryStack> stacks) {
+            getInstance().registerPathEntries(path, stacks);
+        }
+    };
+    
+    static SubsetsRegistry getInstance() {
+        return Internals.getSubsetsRegistry();
+    }
     
     /**
      * Gets all paths an entry is in, note that this is a really slow call as it looks through all paths.

+ 0 - 0
src/main/java/me/shedaniel/rei/api/widgets/Arrow.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/widgets/Arrow.java


+ 0 - 0
src/main/java/me/shedaniel/rei/api/widgets/BaseWidget.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/widgets/BaseWidget.java


+ 0 - 0
src/main/java/me/shedaniel/rei/api/widgets/BurningFire.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/widgets/BurningFire.java


+ 0 - 0
src/main/java/me/shedaniel/rei/api/widgets/Button.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/widgets/Button.java


+ 21 - 2
src/main/java/me/shedaniel/rei/api/widgets/Label.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/widgets/Label.java

@@ -27,7 +27,10 @@ import me.shedaniel.math.Point;
 import me.shedaniel.rei.api.REIHelper;
 import me.shedaniel.rei.gui.widget.WidgetWithBounds;
 import net.minecraft.client.util.math.MatrixStack;
+import net.minecraft.text.LiteralText;
+import net.minecraft.text.StringRenderable;
 import net.minecraft.text.Text;
+import org.jetbrains.annotations.ApiStatus;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -294,13 +297,29 @@ public abstract class Label extends WidgetWithBounds {
     }
     
     @NotNull
-    public abstract Text getText();
+    @ApiStatus.ScheduledForRemoval
+    @Deprecated
+    public Text getText() {
+        return new LiteralText("");
+    }
+    
+    public abstract StringRenderable getMessage();
+    
+    public final void setText(@NotNull Text text) {
+        setMessage(text);
+    }
     
-    public abstract void setText(@NotNull Text text);
+    public abstract void setMessage(@NotNull StringRenderable message);
     
     @NotNull
     public final Label text(@NotNull Text text) {
         setText(text);
         return this;
     }
+    
+    @NotNull
+    public final Label message(@NotNull StringRenderable message) {
+        setMessage(message);
+        return this;
+    }
 }

+ 0 - 0
src/main/java/me/shedaniel/rei/api/widgets/Panel.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/widgets/Panel.java


+ 0 - 0
src/main/java/me/shedaniel/rei/api/widgets/Slot.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/widgets/Slot.java


+ 12 - 12
src/main/java/me/shedaniel/rei/api/widgets/Tooltip.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/widgets/Tooltip.java

@@ -24,37 +24,37 @@
 package me.shedaniel.rei.api.widgets;
 
 import me.shedaniel.math.Point;
+import me.shedaniel.math.api.Executor;
 import me.shedaniel.rei.api.REIHelper;
-import me.shedaniel.rei.gui.widget.QueuedTooltip;
+import me.shedaniel.rei.impl.Internals;
+import net.fabricmc.api.EnvType;
 import net.minecraft.text.Text;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
 
 public interface Tooltip {
-    @SuppressWarnings("deprecation")
     @NotNull
-    static Tooltip create(Point point, Collection<Text> texts) {
-        return QueuedTooltip.create(point, texts);
+    static Tooltip create(@Nullable Point point, Collection<Text> texts) {
+        return Internals.createTooltip(point, texts);
     }
     
-    @SuppressWarnings("deprecation")
     @NotNull
-    static Tooltip create(Point point, Text... texts) {
-        return QueuedTooltip.create(point, texts);
+    static Tooltip create(@Nullable Point point, Text... texts) {
+        return create(point, Arrays.asList(texts));
     }
     
-    @SuppressWarnings("deprecation")
     @NotNull
     static Tooltip create(Collection<Text> texts) {
-        return QueuedTooltip.create(texts);
+        return create(null, texts);
     }
     
-    @SuppressWarnings("deprecation")
     @NotNull
     static Tooltip create(Text... texts) {
-        return QueuedTooltip.create(texts);
+        return create(Arrays.asList(texts));
     }
     
     int getX();
@@ -64,6 +64,6 @@ public interface Tooltip {
     List<Text> getText();
     
     default void queue() {
-        REIHelper.getInstance().queueTooltip(this);
+        Executor.runIfEnv(EnvType.CLIENT, () -> () -> REIHelper.getInstance().queueTooltip(this));
     }
 }

+ 17 - 16
src/main/java/me/shedaniel/rei/api/widgets/Widgets.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/widgets/Widgets.java

@@ -28,9 +28,10 @@ import me.shedaniel.math.Point;
 import me.shedaniel.math.Rectangle;
 import me.shedaniel.rei.api.ConfigObject;
 import me.shedaniel.rei.api.DrawableConsumer;
-import me.shedaniel.rei.gui.widget.EntryWidget;
 import me.shedaniel.rei.gui.widget.Widget;
-import me.shedaniel.rei.impl.widgets.*;
+import me.shedaniel.rei.impl.Internals;
+import net.fabricmc.api.EnvType;
+import net.fabricmc.api.Environment;
 import net.minecraft.client.MinecraftClient;
 import net.minecraft.client.gui.Drawable;
 import net.minecraft.client.gui.DrawableHelper;
@@ -48,12 +49,13 @@ import java.util.List;
 import java.util.Objects;
 import java.util.function.Consumer;
 
+@Environment(EnvType.CLIENT)
 public final class Widgets {
     private Widgets() {}
     
     @NotNull
     public static Widget createDrawableWidget(@NotNull DrawableConsumer drawable) {
-        return new DrawableWidget(drawable);
+        return Internals.getWidgetsProvider().createDrawableWidget(drawable);
     }
     
     @NotNull
@@ -119,32 +121,32 @@ public final class Widgets {
     
     @NotNull
     public static Widget createTexturedWidget(@NotNull Identifier identifier, int x, int y, float u, float v, int width, int height, int uWidth, int vHeight, int textureWidth, int textureHeight) {
-        return createDrawableWidget(new TexturedDrawableConsumer(identifier, x, y, width, height, u, v, uWidth, vHeight, textureWidth, textureHeight));
+        return createDrawableWidget(Internals.getWidgetsProvider().createTexturedConsumer(identifier, x, y, width, height, u, v, uWidth, vHeight, textureWidth, textureHeight));
     }
     
     @NotNull
     public static Widget createFilledRectangle(@NotNull Rectangle rectangle, int color) {
-        return createDrawableWidget(new FillRectangleDrawableConsumer(rectangle, color));
+        return createDrawableWidget(Internals.getWidgetsProvider().createFillRectangleConsumer(rectangle, color));
     }
     
     @NotNull
     public static Label createLabel(@NotNull Point point, @NotNull Text text) {
-        return new LabelWidget(point, text);
+        return Internals.getWidgetsProvider().createLabel(point, text);
     }
     
     @NotNull
     public static Label createClickableLabel(@NotNull Point point, @NotNull Text text, @Nullable Consumer<Label> onClick) {
-        return new LabelWidget(point, text).clickable().onClick(onClick);
+        return createLabel(point, text).clickable().onClick(onClick);
     }
     
     @NotNull
     public static Arrow createArrow(@NotNull Point point) {
-        return new ArrowWidget(new Rectangle(point, new Dimension(24, 17)));
+        return Internals.getWidgetsProvider().createArrow(new Rectangle(point, new Dimension(24, 17)));
     }
     
     @NotNull
     public static BurningFire createBurningFire(@NotNull Point point) {
-        return new BurningFireWidget(new Rectangle(point, new Dimension(14, 14)));
+        return Internals.getWidgetsProvider().createBurningFire(new Rectangle(point, new Dimension(14, 14)));
     }
     
     @NotNull
@@ -159,16 +161,16 @@ public final class Widgets {
     
     @NotNull
     public static Panel createRecipeBase(@NotNull Rectangle rectangle) {
-        return new PanelWidget(rectangle).yTextureOffset(ConfigObject.getInstance().getRecipeBorderType().getYOffset()).rendering(Widgets::shouldRecipeBaseRender);
+        return Internals.getWidgetsProvider().createPanelWidget(rectangle).yTextureOffset(ConfigObject.getInstance().getRecipeBorderType().getYOffset()).rendering(Widgets::shouldRecipeBaseRender);
     }
     
     @NotNull
     public static Panel createCategoryBase(@NotNull Rectangle rectangle) {
-        return new PanelWidget(rectangle).yTextureOffset(ConfigObject.getInstance().getRecipeBorderType().getYOffset()).rendering(Widgets::shouldSlotBaseRender);
+        return Internals.getWidgetsProvider().createPanelWidget(rectangle).yTextureOffset(ConfigObject.getInstance().getRecipeBorderType().getYOffset()).rendering(Widgets::shouldSlotBaseRender);
     }
     
     private static boolean shouldRecipeBaseRender(@NotNull Panel panel) {
-        return ConfigObject.getInstance().getRecipeBorderType().isRendering() && PanelWidget.isRendering(panel);
+        return ConfigObject.getInstance().getRecipeBorderType().isRendering() && Internals.getWidgetsProvider().isRenderingPanel(panel);
     }
     
     @NotNull
@@ -183,7 +185,7 @@ public final class Widgets {
     
     @NotNull
     public static Panel createSlotBase(@NotNull Rectangle rectangle) {
-        return new PanelWidget(rectangle).yTextureOffset(-66).rendering(Widgets::shouldSlotBaseRender);
+        return Internals.getWidgetsProvider().createPanelWidget(rectangle).yTextureOffset(-66).rendering(Widgets::shouldSlotBaseRender);
     }
     
     private static boolean shouldSlotBaseRender(@NotNull Panel panel) {
@@ -195,15 +197,14 @@ public final class Widgets {
         return createSlotBase(rectangle).color(color);
     }
     
-    @SuppressWarnings("deprecation")
     @NotNull
     public static Slot createSlot(@NotNull Point point) {
-        return EntryWidget.create(point.x, point.y);
+        return Internals.getWidgetsProvider().createSlot(point);
     }
     
     @NotNull
     public static Button createButton(@NotNull Rectangle bounds, @NotNull Text text) {
-        return new ButtonWidget(bounds, text);
+        return Internals.getWidgetsProvider().createButton(bounds, text);
     }
     
     public static void produceClickSound() {

+ 3 - 0
src/main/java/me/shedaniel/rei/gui/config/AppearanceTheme.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/gui/config/AppearanceTheme.java

@@ -24,11 +24,14 @@
 package me.shedaniel.rei.gui.config;
 
 import me.shedaniel.clothconfig2.gui.entries.SelectionListEntry;
+import net.fabricmc.api.EnvType;
+import net.fabricmc.api.Environment;
 import net.minecraft.client.resource.language.I18n;
 import org.jetbrains.annotations.NotNull;
 
 import java.util.Locale;
 
+@Environment(EnvType.CLIENT)
 public enum AppearanceTheme implements SelectionListEntry.Translatable {
     LIGHT,
     DARK;

+ 3 - 0
src/main/java/me/shedaniel/rei/gui/config/ConfigButtonPosition.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/gui/config/ConfigButtonPosition.java

@@ -24,11 +24,14 @@
 package me.shedaniel.rei.gui.config;
 
 import me.shedaniel.clothconfig2.gui.entries.SelectionListEntry;
+import net.fabricmc.api.EnvType;
+import net.fabricmc.api.Environment;
 import net.minecraft.client.resource.language.I18n;
 import org.jetbrains.annotations.NotNull;
 
 import java.util.Locale;
 
+@Environment(EnvType.CLIENT)
 public enum ConfigButtonPosition implements SelectionListEntry.Translatable {
     UPPER,
     LOWER;

+ 0 - 0
src/main/java/me/shedaniel/rei/gui/config/DisplayPanelLocation.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/gui/config/DisplayPanelLocation.java


+ 0 - 4
src/main/java/me/shedaniel/rei/gui/config/EntryPanelOrdering.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/gui/config/EntryPanelOrdering.java

@@ -23,11 +23,7 @@
 
 package me.shedaniel.rei.gui.config;
 
-import org.jetbrains.annotations.ApiStatus;
-
-@ApiStatus.Internal
 public enum EntryPanelOrdering {
-    
     REGISTRY("ordering.rei.registry"),
     NAME("ordering.rei.name"),
     GROUPS("ordering.rei.item_groups");

+ 3 - 2
src/main/java/me/shedaniel/rei/gui/config/EntryPanelOrderingConfig.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/gui/config/EntryPanelOrderingConfig.java

@@ -23,10 +23,11 @@
 
 package me.shedaniel.rei.gui.config;
 
+import net.fabricmc.api.EnvType;
+import net.fabricmc.api.Environment;
 import net.minecraft.client.resource.language.I18n;
-import org.jetbrains.annotations.ApiStatus;
 
-@ApiStatus.Internal
+@Environment(EnvType.CLIENT)
 public enum EntryPanelOrderingConfig {
     REGISTRY_ASCENDING(EntryPanelOrdering.REGISTRY, true),
     NAME_ASCENDING(EntryPanelOrdering.NAME, true),

+ 3 - 2
src/main/java/me/shedaniel/rei/gui/config/ItemCheatingMode.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/gui/config/ItemCheatingMode.java

@@ -23,12 +23,13 @@
 
 package me.shedaniel.rei.gui.config;
 
+import net.fabricmc.api.EnvType;
+import net.fabricmc.api.Environment;
 import net.minecraft.client.resource.language.I18n;
-import org.jetbrains.annotations.ApiStatus;
 
 import java.util.Locale;
 
-@ApiStatus.Internal
+@Environment(EnvType.CLIENT)
 public enum ItemCheatingMode {
     REI_LIKE,
     JEI_LIKE;

+ 0 - 0
src/main/java/me/shedaniel/rei/gui/config/ItemCheatingStyle.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/gui/config/ItemCheatingStyle.java


+ 3 - 0
src/main/java/me/shedaniel/rei/gui/config/RecipeBorderType.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/gui/config/RecipeBorderType.java

@@ -23,10 +23,13 @@
 
 package me.shedaniel.rei.gui.config;
 
+import net.fabricmc.api.EnvType;
+import net.fabricmc.api.Environment;
 import net.minecraft.client.resource.language.I18n;
 
 import java.util.Locale;
 
+@Environment(EnvType.CLIENT)
 public enum RecipeBorderType {
     DEFAULT(66),
     LIGHTER(0),

+ 3 - 0
src/main/java/me/shedaniel/rei/gui/config/RecipeScreenType.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/gui/config/RecipeScreenType.java

@@ -23,12 +23,15 @@
 
 package me.shedaniel.rei.gui.config;
 
+import net.fabricmc.api.EnvType;
+import net.fabricmc.api.Environment;
 import net.minecraft.client.resource.language.I18n;
 import org.jetbrains.annotations.ApiStatus;
 
 import java.util.Locale;
 
 @ApiStatus.Internal
+@Environment(EnvType.CLIENT)
 public enum RecipeScreenType {
     UNSET,
     ORIGINAL,

+ 3 - 2
src/main/java/me/shedaniel/rei/gui/config/SearchFieldLocation.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/gui/config/SearchFieldLocation.java

@@ -23,12 +23,13 @@
 
 package me.shedaniel.rei.gui.config;
 
+import net.fabricmc.api.EnvType;
+import net.fabricmc.api.Environment;
 import net.minecraft.client.resource.language.I18n;
-import org.jetbrains.annotations.ApiStatus;
 
 import java.util.Locale;
 
-@ApiStatus.Internal
+@Environment(EnvType.CLIENT)
 public enum SearchFieldLocation {
     CENTER,
     BOTTOM_SIDE,

+ 0 - 0
src/main/java/me/shedaniel/rei/gui/entries/RecipeEntry.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/gui/entries/RecipeEntry.java


+ 0 - 0
src/main/java/me/shedaniel/rei/gui/entries/SimpleRecipeEntry.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/gui/entries/SimpleRecipeEntry.java


+ 0 - 0
src/main/java/me/shedaniel/rei/gui/widget/TextFieldWidget.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/gui/widget/TextFieldWidget.java


+ 0 - 0
src/main/java/me/shedaniel/rei/gui/widget/Widget.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/gui/widget/Widget.java


+ 0 - 0
src/main/java/me/shedaniel/rei/gui/widget/WidgetWithBounds.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/gui/widget/WidgetWithBounds.java


+ 161 - 0
RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/impl/Internals.java

@@ -0,0 +1,161 @@
+/*
+ * 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;
+
+import me.shedaniel.math.Point;
+import me.shedaniel.math.Rectangle;
+import me.shedaniel.rei.api.*;
+import me.shedaniel.rei.api.fluid.FluidSupportProvider;
+import me.shedaniel.rei.api.fractions.Fraction;
+import me.shedaniel.rei.api.subsets.SubsetsRegistry;
+import me.shedaniel.rei.api.widgets.*;
+import me.shedaniel.rei.gui.widget.Widget;
+import net.fabricmc.api.EnvType;
+import net.fabricmc.api.Environment;
+import net.minecraft.fluid.Fluid;
+import net.minecraft.item.ItemStack;
+import net.minecraft.text.StringRenderable;
+import net.minecraft.text.Text;
+import net.minecraft.util.Identifier;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.Collection;
+import java.util.function.BiFunction;
+import java.util.function.Supplier;
+
+@ApiStatus.Internal
+public final class Internals {
+    private static Supplier<ConfigManager> configManager = Internals::throwNotSetup;
+    private static Supplier<ClientHelper> clientHelper = Internals::throwNotSetup;
+    private static Supplier<RecipeHelper> recipeHelper = Internals::throwNotSetup;
+    private static Supplier<REIHelper> reiHelper = Internals::throwNotSetup;
+    private static Supplier<FluidSupportProvider> fluidSupportProvider = Internals::throwNotSetup;
+    private static Supplier<EntryStackProvider> entryStackProvider = Internals::throwNotSetup;
+    private static Supplier<SubsetsRegistry> subsetsRegistry = Internals::throwNotSetup;
+    private static Supplier<EntryRegistry> entryRegistry = Internals::throwNotSetup;
+    private static Supplier<DisplayHelper> displayHelper = Internals::throwNotSetup;
+    private static Supplier<WidgetsProvider> widgetsProvider = Internals::throwNotSetup;
+    private static Supplier<ClientHelper.ViewSearchBuilder> viewSearchBuilder = Internals::throwNotSetup;
+    private static BiFunction<@Nullable Point, Collection<Text>, Tooltip> tooltipProvider = (point, texts) -> throwNotSetup();
+    
+    private static <T> T throwNotSetup() {
+        throw new AssertionError("REI Internals have not been initialized!");
+    }
+    
+    @NotNull
+    public static ConfigManager getConfigManager() {
+        return configManager.get();
+    }
+    
+    @NotNull
+    public static ClientHelper getClientHelper() {
+        return clientHelper.get();
+    }
+    
+    @NotNull
+    public static RecipeHelper getRecipeHelper() {
+        return recipeHelper.get();
+    }
+    
+    @NotNull
+    public static REIHelper getREIHelper() {
+        return reiHelper.get();
+    }
+    
+    @NotNull
+    @ApiStatus.Experimental
+    public static FluidSupportProvider getFluidSupportProvider() {
+        return fluidSupportProvider.get();
+    }
+    
+    @NotNull
+    public static EntryStackProvider getEntryStackProvider() {
+        return entryStackProvider.get();
+    }
+    
+    @NotNull
+    public static SubsetsRegistry getSubsetsRegistry() {
+        return subsetsRegistry.get();
+    }
+    
+    @NotNull
+    public static EntryRegistry getEntryRegistry() {
+        return entryRegistry.get();
+    }
+    
+    @NotNull
+    public static DisplayHelper getDisplayHelper() {
+        return displayHelper.get();
+    }
+    
+    @NotNull
+    public static WidgetsProvider getWidgetsProvider() {
+        return widgetsProvider.get();
+    }
+    
+    @NotNull
+    public static ClientHelper.ViewSearchBuilder createViewSearchBuilder() {
+        return viewSearchBuilder.get();
+    }
+    
+    @NotNull
+    public static Tooltip createTooltip(@Nullable Point point, Collection<Text> texts) {
+        return tooltipProvider.apply(point, texts);
+    }
+    
+    public interface EntryStackProvider {
+        EntryStack empty();
+        
+        EntryStack fluid(Fluid fluid);
+        
+        EntryStack fluid(Fluid fluid, Fraction amount);
+        
+        EntryStack item(ItemStack stack);
+    }
+    
+    @Environment(EnvType.CLIENT)
+    public interface WidgetsProvider {
+        boolean isRenderingPanel(Panel panel);
+        
+        Widget createDrawableWidget(DrawableConsumer drawable);
+        
+        Slot createSlot(Point point);
+        
+        Button createButton(Rectangle bounds, Text text);
+        
+        Panel createPanelWidget(Rectangle bounds);
+        
+        Label createLabel(Point point, StringRenderable text);
+        
+        Arrow createArrow(Rectangle rectangle);
+        
+        BurningFire createBurningFire(Rectangle rectangle);
+        
+        DrawableConsumer createTexturedConsumer(Identifier texture, int x, int y, int width, int height, float u, float v, int uWidth, int vHeight, int textureWidth, int textureHeight);
+        
+        DrawableConsumer createFillRectangleConsumer(Rectangle rectangle, int color);
+    }
+}

+ 4 - 3
src/main/java/me/shedaniel/rei/impl/RenderingEntry.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/impl/RenderingEntry.java

@@ -24,6 +24,7 @@
 package me.shedaniel.rei.impl;
 
 import me.shedaniel.rei.api.EntryStack;
+import me.shedaniel.rei.api.fractions.Fraction;
 import net.minecraft.client.gui.DrawableHelper;
 import net.minecraft.util.Identifier;
 import org.jetbrains.annotations.ApiStatus;
@@ -48,12 +49,12 @@ public abstract class RenderingEntry extends DrawableHelper implements EntryStac
     }
     
     @Override
-    public double getFloatingAmount() {
-        return 0;
+    public Fraction getAccurateAmount() {
+        return Fraction.empty();
     }
     
     @Override
-    public void setAmount(int amount) {
+    public void setAmount(Fraction amount) {
         
     }
     

+ 0 - 0
src/main/java/me/shedaniel/rei/server/ContainerInfo.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/server/ContainerInfo.java


+ 0 - 0
src/main/java/me/shedaniel/rei/server/ContainerInfoHandler.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/server/ContainerInfoHandler.java


+ 0 - 0
src/main/java/me/shedaniel/rei/server/RecipeFinder.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/server/RecipeFinder.java


+ 0 - 0
src/main/java/me/shedaniel/rei/server/RecipeGridAligner.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/server/RecipeGridAligner.java


+ 0 - 0
src/main/java/me/shedaniel/rei/utils/CollectionUtils.java → RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/utils/CollectionUtils.java


+ 20 - 0
RoughlyEnoughItems-api/src/main/resources/fabric.mod.json

@@ -0,0 +1,20 @@
+{
+  "schemaVersion": 1,
+  "id": "roughlyenoughitems-api",
+  "name": "REI (API)",
+  "description": "The api facing part of Roughly Enough Items.",
+  "version": "${version}",
+  "authors": [
+    "shedaniel"
+  ],
+  "contact": {
+    "homepage": "https://www.curseforge.com/minecraft/mc-mods/roughly-enough-items",
+    "sources": "https://github.com/shedaniel/RoughlyEnoughItems",
+    "issues": "https://github.com/shedaniel/RoughlyEnoughItems/issues"
+  },
+  "license": "MIT",
+  "icon": "icon.png",
+  "custom": {
+    "modmenu:parent": "roughlyenoughitems"
+  }
+}

BIN
RoughlyEnoughItems-api/src/main/resources/icon.png


+ 9 - 0
RoughlyEnoughItems-default-plugin/build.gradle

@@ -0,0 +1,9 @@
+archivesBaseName = "RoughlyEnoughItems-default-plugin"
+
+minecraft {
+    accessWidener = file("src/main/resources/roughlyenoughitems-default-plugin.accessWidener")
+}
+
+dependencies {
+    compile project(path: ':RoughlyEnoughItems-api', configuration: 'dev')
+}

+ 24 - 83
src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java → RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java

@@ -26,23 +26,17 @@ package me.shedaniel.rei.plugin;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import it.unimi.dsi.fastutil.objects.Object2FloatMap;
-import me.shedaniel.math.Point;
 import me.shedaniel.math.Rectangle;
-import me.shedaniel.rei.RoughlyEnoughItemsCore;
 import me.shedaniel.rei.api.*;
 import me.shedaniel.rei.api.fluid.FluidSupportProvider;
 import me.shedaniel.rei.api.plugins.REIPluginV0;
-import me.shedaniel.rei.api.widgets.Panel;
-import me.shedaniel.rei.api.widgets.Tooltip;
-import me.shedaniel.rei.gui.RecipeViewingScreen;
-import me.shedaniel.rei.gui.VillagerRecipeViewingScreen;
-import me.shedaniel.rei.impl.ClientHelperImpl;
-import me.shedaniel.rei.impl.RenderingEntry;
+import me.shedaniel.rei.plugin.autocrafting.DefaultRecipeBookHandler;
 import me.shedaniel.rei.plugin.beacon.DefaultBeaconBaseCategory;
 import me.shedaniel.rei.plugin.beacon.DefaultBeaconBaseDisplay;
 import me.shedaniel.rei.plugin.blasting.DefaultBlastingDisplay;
 import me.shedaniel.rei.plugin.brewing.DefaultBrewingCategory;
 import me.shedaniel.rei.plugin.brewing.DefaultBrewingDisplay;
+import me.shedaniel.rei.plugin.brewing.RegisteredBrewingRecipe;
 import me.shedaniel.rei.plugin.campfire.DefaultCampfireCategory;
 import me.shedaniel.rei.plugin.campfire.DefaultCampfireDisplay;
 import me.shedaniel.rei.plugin.composting.DefaultCompostingCategory;
@@ -73,7 +67,6 @@ import net.minecraft.block.entity.AbstractFurnaceBlockEntity;
 import net.minecraft.client.MinecraftClient;
 import net.minecraft.client.gui.screen.ingame.*;
 import net.minecraft.client.gui.screen.recipebook.RecipeBookProvider;
-import net.minecraft.client.util.math.MatrixStack;
 import net.minecraft.enchantment.Enchantment;
 import net.minecraft.enchantment.EnchantmentHelper;
 import net.minecraft.fluid.Fluid;
@@ -82,18 +75,20 @@ import net.minecraft.potion.PotionUtil;
 import net.minecraft.recipe.*;
 import net.minecraft.tag.BlockTags;
 import net.minecraft.tag.Tag;
-import net.minecraft.text.LiteralText;
 import net.minecraft.util.Identifier;
+import net.minecraft.util.Lazy;
 import net.minecraft.util.math.MathHelper;
 import net.minecraft.util.registry.Registry;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.jetbrains.annotations.ApiStatus;
 import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
 
 import java.util.*;
 
 @Environment(EnvType.CLIENT)
 public class DefaultPlugin implements REIPluginV0 {
-    
+    private static final Logger LOGGER = LogManager.getFormatterLogger("REI/DefaultPlugin");
     public static final Identifier CRAFTING = new Identifier("minecraft", "plugins/crafting");
     public static final Identifier SMELTING = new Identifier("minecraft", "plugins/smelting");
     public static final Identifier SMOKING = new Identifier("minecraft", "plugins/smoking");
@@ -110,15 +105,21 @@ public class DefaultPlugin implements REIPluginV0 {
     public static final Identifier INFO = new Identifier("roughlyenoughitems", "plugins/information");
     private static final Identifier DISPLAY_TEXTURE = new Identifier("roughlyenoughitems", "textures/gui/display.png");
     private static final Identifier DISPLAY_TEXTURE_DARK = new Identifier("roughlyenoughitems", "textures/gui/display_dark.png");
-    private static final List<DefaultBrewingDisplay> BREWING_DISPLAYS = Lists.newArrayList();
+    private static final List<Lazy<DefaultBrewingDisplay>> BREWING_DISPLAYS = Lists.newArrayList();
     private static final List<DefaultInformationDisplay> INFO_DISPLAYS = Lists.newArrayList();
     
     public static Identifier getDisplayTexture() {
-        return REIHelper.getInstance().isDarkThemeEnabled() ? DISPLAY_TEXTURE_DARK : DISPLAY_TEXTURE;
+        return REIHelper.getInstance().getDefaultDisplayTexture();
+    }
+    
+    @Deprecated
+    @ApiStatus.ScheduledForRemoval
+    public static void registerBrewingDisplay(DefaultBrewingDisplay recipe) {
+        BREWING_DISPLAYS.add(new Lazy<>(() -> recipe));
     }
     
-    public static void registerBrewingDisplay(DefaultBrewingDisplay display) {
-        BREWING_DISPLAYS.add(display);
+    public static void registerBrewingRecipe(RegisteredBrewingRecipe recipe) {
+        BREWING_DISPLAYS.add(new Lazy<>(() -> new DefaultBrewingDisplay(recipe.input, recipe.ingredient, recipe.output)));
     }
     
     public static void registerInfoDisplay(DefaultInformationDisplay display) {
@@ -137,9 +138,6 @@ public class DefaultPlugin implements REIPluginV0 {
     
     @Override
     public void registerEntries(EntryRegistry entryRegistry) {
-        if (!ConfigObject.getInstance().isLoadingDefaultPlugin()) {
-            return;
-        }
         for (Item item : Registry.ITEM) {
             List<ItemStack> stacks = null;
             try {
@@ -169,32 +167,10 @@ public class DefaultPlugin implements REIPluginV0 {
             if (!fluid.getDefaultState().isEmpty() && fluid.getDefaultState().isStill())
                 entryRegistry.registerEntry(EntryStack.create(fluid));
         }
-        entryRegistry.registerEntry(new RenderingEntry() {
-            private Identifier id = new Identifier("roughlyenoughitems", "textures/gui/kirb.png");
-            
-            @Override
-            public void render(MatrixStack matrices, Rectangle bounds, int mouseX, int mouseY, float delta) {
-                MinecraftClient.getInstance().getTextureManager().bindTexture(id);
-                drawTexturedQuad(matrices.peek().getModel(), bounds.x, bounds.getMaxX(), bounds.y, bounds.getMaxY(), getZOffset(), 0, 1, 0, 1);
-            }
-            
-            @Override
-            public boolean isEmpty() {
-                return !((ClientHelperImpl) ClientHelper.getInstance()).isAprilFools.get();
-            }
-            
-            @Override
-            public @Nullable Tooltip getTooltip(Point point) {
-                return Tooltip.create(new LiteralText("Kibby"));
-            }
-        });
     }
     
     @Override
     public void registerPluginCategories(RecipeHelper recipeHelper) {
-        if (!ConfigObject.getInstance().isLoadingDefaultPlugin()) {
-            return;
-        }
         recipeHelper.registerCategories(
                 new DefaultCraftingCategory(),
                 new DefaultCookingCategory(SMELTING, EntryStack.create(Items.FURNACE), "category.rei.smelting"),
@@ -213,9 +189,6 @@ public class DefaultPlugin implements REIPluginV0 {
     
     @Override
     public void registerRecipeDisplays(RecipeHelper recipeHelper) {
-        if (!ConfigObject.getInstance().isLoadingDefaultPlugin()) {
-            return;
-        }
         recipeHelper.registerRecipes(CRAFTING, ShapelessRecipe.class, DefaultShapelessDisplay::new);
         recipeHelper.registerRecipes(CRAFTING, ShapedRecipe.class, DefaultShapedDisplay::new);
         recipeHelper.registerRecipes(SMELTING, SmeltingRecipe.class, DefaultSmeltingDisplay::new);
@@ -224,8 +197,8 @@ public class DefaultPlugin implements REIPluginV0 {
         recipeHelper.registerRecipes(CAMPFIRE, CampfireCookingRecipe.class, DefaultCampfireDisplay::new);
         recipeHelper.registerRecipes(STONE_CUTTING, StonecuttingRecipe.class, DefaultStoneCuttingDisplay::new);
         recipeHelper.registerRecipes(SMITHING, SmithingRecipe.class, DefaultSmithingDisplay::new);
-        for (DefaultBrewingDisplay display : BREWING_DISPLAYS) {
-            recipeHelper.registerDisplay(display);
+        for (Lazy<DefaultBrewingDisplay> display : BREWING_DISPLAYS) {
+            recipeHelper.registerDisplay(display.get());
         }
         for (Map.Entry<Item, Integer> entry : AbstractFurnaceBlockEntity.createFuelTimeMap().entrySet()) {
             recipeHelper.registerDisplay(new DefaultFuelDisplay(EntryStack.create(entry.getKey()), entry.getValue()));
@@ -284,7 +257,7 @@ public class DefaultPlugin implements REIPluginV0 {
             }
         }
         time = System.currentTimeMillis() - time;
-        RoughlyEnoughItemsCore.LOGGER.info("Applied Check Tags for potion in %dms.", time);
+        LOGGER.info("Applied Check Tags for potion in %dms.", time);
     }
     
     private void applyPotionTransformer(EntryStack stack) {
@@ -294,18 +267,9 @@ public class DefaultPlugin implements REIPluginV0 {
     
     @Override
     public void registerBounds(DisplayHelper displayHelper) {
-        if (!ConfigObject.getInstance().isLoadingDefaultPlugin()) {
-            return;
-        }
         BaseBoundsHandler baseBoundsHandler = BaseBoundsHandler.getInstance();
         baseBoundsHandler.registerExclusionZones(AbstractInventoryScreen.class, new DefaultPotionEffectExclusionZones());
         baseBoundsHandler.registerExclusionZones(RecipeBookProvider.class, new DefaultRecipeBookExclusionZones());
-        baseBoundsHandler.registerExclusionZones(RecipeViewingScreen.class, () -> {
-            Panel widget = ((RecipeViewingScreen) MinecraftClient.getInstance().currentScreen).getWorkingStationsBaseWidget();
-            if (widget == null)
-                return Collections.emptyList();
-            return Collections.singletonList(widget.getBounds().clone());
-        });
         displayHelper.registerProvider(new DisplayHelper.DisplayBoundsProvider<ContainerScreen<?>>() {
             @Override
             public Rectangle getScreenBounds(ContainerScreen<?> screen) {
@@ -317,35 +281,12 @@ public class DefaultPlugin implements REIPluginV0 {
                 return ContainerScreen.class;
             }
         });
-        displayHelper.registerProvider(new DisplayHelper.DisplayBoundsProvider<RecipeViewingScreen>() {
-            @Override
-            public Rectangle getScreenBounds(RecipeViewingScreen screen) {
-                return screen.getBounds();
-            }
-            
-            @Override
-            public Class<?> getBaseSupportedClass() {
-                return RecipeViewingScreen.class;
-            }
-        });
-        displayHelper.registerProvider(new DisplayHelper.DisplayBoundsProvider<VillagerRecipeViewingScreen>() {
-            @Override
-            public Rectangle getScreenBounds(VillagerRecipeViewingScreen screen) {
-                return screen.bounds;
-            }
-            
-            @Override
-            public Class<?> getBaseSupportedClass() {
-                return VillagerRecipeViewingScreen.class;
-            }
-        });
     }
     
     @Override
     public void registerOthers(RecipeHelper recipeHelper) {
-        if (!ConfigObject.getInstance().isLoadingDefaultPlugin()) {
-            return;
-        }
+        recipeHelper.registerAutoCraftingHandler(new DefaultRecipeBookHandler());
+        
         recipeHelper.registerWorkingStations(CRAFTING, EntryStack.create(Items.CRAFTING_TABLE));
         recipeHelper.registerWorkingStations(SMELTING, EntryStack.create(Items.FURNACE));
         recipeHelper.registerWorkingStations(SMOKING, EntryStack.create(Items.SMOKER));
@@ -357,7 +298,7 @@ public class DefaultPlugin implements REIPluginV0 {
         recipeHelper.registerWorkingStations(COMPOSTING, EntryStack.create(Items.COMPOSTER));
         recipeHelper.registerWorkingStations(SMITHING, EntryStack.create(Items.SMITHING_TABLE));
         recipeHelper.registerWorkingStations(BEACON, EntryStack.create(Items.BEACON));
-        Tag<Item> axes = MinecraftClient.getInstance().getNetworkHandler().getTagManager().items().get(new Identifier("fabric", "axes"));
+        Tag<Item> axes = MinecraftClient.getInstance().getNetworkHandler().getTagManager().getItems().getTag(new Identifier("fabric", "axes"));
         if (axes != null) {
             for (Item item : axes.values()) {
                 recipeHelper.registerWorkingStations(STRIPPING, EntryStack.create(item));
@@ -373,7 +314,7 @@ public class DefaultPlugin implements REIPluginV0 {
         recipeHelper.registerScreenClickArea(new Rectangle(78, 32, 28, 23), FurnaceScreen.class, SMELTING);
         recipeHelper.registerScreenClickArea(new Rectangle(78, 32, 28, 23), SmokerScreen.class, SMOKING);
         recipeHelper.registerScreenClickArea(new Rectangle(78, 32, 28, 23), BlastFurnaceScreen.class, BLASTING);
-        FluidSupportProvider.INSTANCE.registerFluidProvider(new FluidSupportProvider.FluidProvider() {
+        FluidSupportProvider.getInstance().registerFluidProvider(new FluidSupportProvider.FluidProvider() {
             @Override
             public @NotNull EntryStack itemToFluid(@NotNull EntryStack itemStack) {
                 Item item = itemStack.getItem();

+ 0 - 0
src/main/java/me/shedaniel/rei/plugin/DefaultPotionEffectExclusionZones.java → RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/DefaultPotionEffectExclusionZones.java


+ 5 - 3
src/main/java/me/shedaniel/rei/plugin/DefaultRecipeBookExclusionZones.java → RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/DefaultRecipeBookExclusionZones.java

@@ -31,7 +31,7 @@ import net.fabricmc.api.Environment;
 import net.minecraft.client.MinecraftClient;
 import net.minecraft.client.gui.screen.ingame.ContainerScreen;
 import net.minecraft.client.gui.screen.recipebook.RecipeBookProvider;
-import net.minecraft.client.recipebook.ClientRecipeBook;
+import net.minecraft.client.gui.screen.recipebook.RecipeBookWidget;
 import net.minecraft.container.CraftingContainer;
 
 import java.util.Collections;
@@ -43,11 +43,13 @@ public class DefaultRecipeBookExclusionZones implements Supplier<List<Rectangle>
     
     @Override
     public List<Rectangle> get() {
-        if (!MinecraftClient.getInstance().player.getRecipeBook().isGuiOpen() || !(MinecraftClient.getInstance().currentScreen instanceof RecipeBookProvider) || !(REIHelper.getInstance().getPreviousContainerScreen().getContainer() instanceof CraftingContainer))
+        if (!(MinecraftClient.getInstance().currentScreen instanceof RecipeBookProvider) || !(REIHelper.getInstance().getPreviousContainerScreen().getContainer() instanceof CraftingContainer) ||
+            !MinecraftClient.getInstance().player.getRecipeBook().isGuiOpen(((CraftingContainer<?>) REIHelper.getInstance().getPreviousContainerScreen().getContainer()).getCategory()))
             return Collections.emptyList();
+        RecipeBookWidget recipeBookWidget = ((RecipeBookProvider) MinecraftClient.getInstance().currentScreen).getRecipeBookWidget();
         ContainerScreen<?> containerScreen = REIHelper.getInstance().getPreviousContainerScreen();
         List<Rectangle> l = Lists.newArrayList(new Rectangle(containerScreen.x - 4 - 145, containerScreen.y, 4 + 145 + 30, containerScreen.containerHeight));
-        int size = ClientRecipeBook.getGroupsForContainer((CraftingContainer<?>) REIHelper.getInstance().getPreviousContainerScreen().getContainer()).size();
+        int size = recipeBookWidget.tabButtons.size();
         if (size > 0)
             l.add(new Rectangle(containerScreen.x - 4 - 145 - 30, containerScreen.y, 30, size * 27));
         return l;

+ 0 - 0
src/main/java/me/shedaniel/rei/plugin/DefaultServerContainerPlugin.java → RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/DefaultServerContainerPlugin.java


+ 4 - 4
src/main/java/me/shedaniel/rei/plugin/autocrafting/DefaultRecipeBookHandler.java → RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/autocrafting/DefaultRecipeBookHandler.java

@@ -24,9 +24,9 @@
 package me.shedaniel.rei.plugin.autocrafting;
 
 import me.shedaniel.rei.api.AutoTransferHandler;
+import me.shedaniel.rei.api.ClientHelper;
 import me.shedaniel.rei.api.RecipeDisplay;
 import me.shedaniel.rei.api.TransferRecipeDisplay;
-import me.shedaniel.rei.impl.ScreenHelper;
 import me.shedaniel.rei.plugin.cooking.DefaultCookingDisplay;
 import me.shedaniel.rei.plugin.crafting.DefaultCraftingDisplay;
 import net.fabricmc.api.EnvType;
@@ -45,7 +45,7 @@ public class DefaultRecipeBookHandler implements AutoTransferHandler {
     @NotNull
     @Override
     public Result handle(@NotNull Context context) {
-        if (context.getRecipe() instanceof TransferRecipeDisplay && DefaultCategoryHandler.canUseMovePackets())
+        if (context.getRecipe() instanceof TransferRecipeDisplay && ClientHelper.getInstance().canUseMovePackets())
             return Result.createNotApplicable();
         RecipeDisplay display = context.getRecipe();
         if (!(context.getContainer() instanceof CraftingContainer))
@@ -75,7 +75,7 @@ public class DefaultRecipeBookHandler implements AutoTransferHandler {
                 if (context.getContainerScreen() instanceof RecipeBookProvider)
                     ((RecipeBookProvider) context.getContainerScreen()).getRecipeBookWidget().ghostSlots.reset();
                 context.getMinecraft().interactionManager.clickRecipe(container.syncId, recipe, Screen.hasShiftDown());
-                ScreenHelper.getLastOverlay().init();
+                return Result.createSuccessful();
             }
         } else if (display instanceof DefaultCookingDisplay) {
             DefaultCookingDisplay defaultDisplay = (DefaultCookingDisplay) display;
@@ -89,7 +89,7 @@ public class DefaultRecipeBookHandler implements AutoTransferHandler {
                 if (context.getContainerScreen() instanceof RecipeBookProvider)
                     ((RecipeBookProvider) context.getContainerScreen()).getRecipeBookWidget().ghostSlots.reset();
                 context.getMinecraft().interactionManager.clickRecipe(container.syncId, recipe, Screen.hasShiftDown());
-                ScreenHelper.getLastOverlay().init();
+                return Result.createSuccessful();
             }
         }
         return Result.createNotApplicable();

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

@@ -26,6 +26,7 @@ package me.shedaniel.rei.plugin.beacon;
 import com.google.common.collect.Lists;
 import me.shedaniel.clothconfig2.ClothConfigInitializer;
 import me.shedaniel.clothconfig2.api.ScissorsHandler;
+import me.shedaniel.clothconfig2.api.ScrollingContainer;
 import me.shedaniel.math.Point;
 import me.shedaniel.math.Rectangle;
 import me.shedaniel.rei.api.EntryStack;
@@ -34,7 +35,6 @@ import me.shedaniel.rei.api.RecipeCategory;
 import me.shedaniel.rei.api.widgets.Slot;
 import me.shedaniel.rei.api.widgets.Widgets;
 import me.shedaniel.rei.gui.entries.RecipeEntry;
-import me.shedaniel.clothconfig2.api.ScrollingContainer;
 import me.shedaniel.rei.gui.widget.Widget;
 import me.shedaniel.rei.gui.widget.WidgetWithBounds;
 import me.shedaniel.rei.plugin.DefaultPlugin;

+ 0 - 0
src/main/java/me/shedaniel/rei/plugin/beacon/DefaultBeaconBaseDisplay.java → RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/beacon/DefaultBeaconBaseDisplay.java


+ 0 - 0
src/main/java/me/shedaniel/rei/plugin/blasting/DefaultBlastingDisplay.java → RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/blasting/DefaultBlastingDisplay.java


+ 4 - 4
src/main/java/me/shedaniel/rei/plugin/brewing/BrewingRecipe.java → RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/brewing/BrewingRecipe.java

@@ -32,10 +32,10 @@ public class BrewingRecipe {
     public final Ingredient ingredient;
     public final Item output;
     
-    public BrewingRecipe(Item object_1, Ingredient ingredient_1, Item object_2) {
-        this.input = object_1;
-        this.ingredient = ingredient_1;
-        this.output = object_2;
+    public BrewingRecipe(Item input, Ingredient ingredient, Item output) {
+        this.input = input;
+        this.ingredient = ingredient;
+        this.output = output;
     }
     
 }

+ 5 - 1
src/main/java/me/shedaniel/rei/plugin/brewing/DefaultBrewingCategory.java → RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/brewing/DefaultBrewingCategory.java

@@ -27,10 +27,13 @@ import com.google.common.collect.Lists;
 import me.shedaniel.math.Point;
 import me.shedaniel.math.Rectangle;
 import me.shedaniel.rei.api.EntryStack;
+import me.shedaniel.rei.api.REIHelper;
 import me.shedaniel.rei.api.RecipeCategory;
 import me.shedaniel.rei.api.widgets.Widgets;
 import me.shedaniel.rei.gui.widget.Widget;
 import me.shedaniel.rei.plugin.DefaultPlugin;
+import net.fabricmc.api.EnvType;
+import net.fabricmc.api.Environment;
 import net.minecraft.block.Blocks;
 import net.minecraft.client.MinecraftClient;
 import net.minecraft.client.resource.language.I18n;
@@ -40,6 +43,7 @@ import net.minecraft.util.math.MathHelper;
 
 import java.util.List;
 
+@Environment(EnvType.CLIENT)
 public class DefaultBrewingCategory implements RecipeCategory<DefaultBrewingDisplay> {
     
     @Override
@@ -63,7 +67,7 @@ public class DefaultBrewingCategory implements RecipeCategory<DefaultBrewingDisp
         List<Widget> widgets = Lists.newArrayList();
         widgets.add(Widgets.createRecipeBase(bounds));
         widgets.add(Widgets.createDrawableWidget((helper, matrices, mouseX, mouseY, delta) -> {
-            MinecraftClient.getInstance().getTextureManager().bindTexture(DefaultPlugin.getDisplayTexture());
+            MinecraftClient.getInstance().getTextureManager().bindTexture(REIHelper.getInstance().getDefaultDisplayTexture());
             helper.drawTexture(matrices, startPoint.x, startPoint.y, 0, 108, 103, 59);
             int width = MathHelper.ceil(System.currentTimeMillis() / 250d % 18d);
             helper.drawTexture(matrices, startPoint.x + 44, startPoint.y + 28, 103, 163, width, 4);

+ 2 - 0
src/main/java/me/shedaniel/rei/plugin/brewing/DefaultBrewingDisplay.java → RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/brewing/DefaultBrewingDisplay.java

@@ -34,6 +34,7 @@ import net.minecraft.recipe.Ingredient;
 import net.minecraft.text.TranslatableText;
 import net.minecraft.util.Formatting;
 import net.minecraft.util.Identifier;
+import org.jetbrains.annotations.ApiStatus;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -45,6 +46,7 @@ public class DefaultBrewingDisplay implements RecipeDisplay {
     private EntryStack input, output;
     private List<EntryStack> reactant;
     
+    @ApiStatus.Internal
     public DefaultBrewingDisplay(ItemStack input, Ingredient reactant, ItemStack output) {
         this.input = EntryStack.create(input).setting(EntryStack.Settings.TOOLTIP_APPEND_EXTRA, stack -> Collections.singletonList(new TranslatableText("category.rei.brewing.input").formatted(Formatting.YELLOW)));
         ItemStack[] reactantStacks = reactant.getMatchingStacksClient();

+ 12 - 24
src/main/java/me/shedaniel/rei/plugin/DefaultAutoCraftingPlugin.java → RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/brewing/RegisteredBrewingRecipe.java

@@ -21,33 +21,21 @@
  * SOFTWARE.
  */
 
-package me.shedaniel.rei.plugin;
+package me.shedaniel.rei.plugin.brewing;
 
-import me.shedaniel.rei.api.ConfigObject;
-import me.shedaniel.rei.api.RecipeHelper;
-import me.shedaniel.rei.api.plugins.REIPluginV0;
-import me.shedaniel.rei.plugin.autocrafting.DefaultCategoryHandler;
-import me.shedaniel.rei.plugin.autocrafting.DefaultRecipeBookHandler;
-import net.fabricmc.api.EnvType;
-import net.fabricmc.api.Environment;
-import net.minecraft.util.Identifier;
+import net.minecraft.item.ItemStack;
+import net.minecraft.recipe.Ingredient;
 
-@Environment(EnvType.CLIENT)
-public class DefaultAutoCraftingPlugin implements REIPluginV0 {
+public class RegisteredBrewingRecipe {
     
-    public static final Identifier PLUGIN = new Identifier("roughlyenoughitems", "default_auto_crafting_plugin");
+    public final ItemStack input;
+    public final Ingredient ingredient;
+    public final ItemStack output;
     
-    @Override
-    public Identifier getPluginIdentifier() {
-        return PLUGIN;
+    public RegisteredBrewingRecipe(ItemStack input, Ingredient ingredient, ItemStack output) {
+        this.input = input;
+        this.ingredient = ingredient;
+        this.output = output;
     }
     
-    @Override
-    public void registerOthers(RecipeHelper recipeHelper) {
-        if (!ConfigObject.getInstance().isLoadingDefaultPlugin()) {
-            return;
-        }
-        recipeHelper.registerAutoCraftingHandler(new DefaultCategoryHandler());
-        recipeHelper.registerAutoCraftingHandler(new DefaultRecipeBookHandler());
-    }
-}
+}

+ 0 - 0
src/main/java/me/shedaniel/rei/plugin/campfire/DefaultCampfireCategory.java → RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/campfire/DefaultCampfireCategory.java


+ 0 - 2
src/main/java/me/shedaniel/rei/plugin/campfire/DefaultCampfireDisplay.java → RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/campfire/DefaultCampfireDisplay.java

@@ -35,11 +35,9 @@ import net.minecraft.recipe.Ingredient;
 import net.minecraft.util.Identifier;
 import net.minecraft.util.collection.DefaultedList;
 
-import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import java.util.Optional;
-import java.util.stream.Collectors;
 
 @Environment(EnvType.CLIENT)
 public class DefaultCampfireDisplay implements RecipeDisplay {

+ 4 - 1
src/main/java/me/shedaniel/rei/plugin/composting/DefaultCompostingCategory.java → RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/composting/DefaultCompostingCategory.java

@@ -39,6 +39,7 @@ import net.minecraft.block.Blocks;
 import net.minecraft.client.MinecraftClient;
 import net.minecraft.client.resource.language.I18n;
 import net.minecraft.client.util.math.MatrixStack;
+import net.minecraft.text.Text;
 import net.minecraft.text.TranslatableText;
 import net.minecraft.util.Formatting;
 import net.minecraft.util.Identifier;
@@ -67,6 +68,8 @@ public class DefaultCompostingCategory implements RecipeCategory<DefaultComposti
     @Override
     public RecipeEntry getSimpleRenderer(DefaultCompostingDisplay recipe) {
         return new RecipeEntry() {
+            private Text text = new TranslatableText("text.rei.composting.page", recipe.getPage() + 1);
+            
             @Override
             public int getHeight() {
                 return 10 + MinecraftClient.getInstance().textRenderer.fontHeight;
@@ -74,7 +77,7 @@ public class DefaultCompostingCategory implements RecipeCategory<DefaultComposti
             
             @Override
             public void render(MatrixStack matrices, Rectangle rectangle, int mouseX, int mouseY, float delta) {
-                MinecraftClient.getInstance().textRenderer.draw(matrices, new TranslatableText("text.rei.composting.page", recipe.getPage() + 1), rectangle.x + 5, rectangle.y + 6, -1);
+                MinecraftClient.getInstance().textRenderer.draw(matrices, text.method_30937(), rectangle.x + 5, rectangle.y + 6, -1);
             }
         };
     }

+ 0 - 0
src/main/java/me/shedaniel/rei/plugin/composting/DefaultCompostingDisplay.java → RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/composting/DefaultCompostingDisplay.java


+ 0 - 0
src/main/java/me/shedaniel/rei/plugin/containers/CraftingContainerInfoWrapper.java → RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/containers/CraftingContainerInfoWrapper.java


+ 0 - 0
src/main/java/me/shedaniel/rei/plugin/cooking/DefaultCookingCategory.java → RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/cooking/DefaultCookingCategory.java


+ 0 - 0
src/main/java/me/shedaniel/rei/plugin/cooking/DefaultCookingDisplay.java → RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/cooking/DefaultCookingDisplay.java


+ 0 - 0
src/main/java/me/shedaniel/rei/plugin/crafting/DefaultCraftingCategory.java → RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/crafting/DefaultCraftingCategory.java


+ 0 - 0
src/main/java/me/shedaniel/rei/plugin/crafting/DefaultCraftingDisplay.java → RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/crafting/DefaultCraftingDisplay.java


+ 0 - 0
src/main/java/me/shedaniel/rei/plugin/crafting/DefaultCustomDisplay.java → RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/crafting/DefaultCustomDisplay.java


+ 0 - 3
src/main/java/me/shedaniel/rei/plugin/crafting/DefaultShapedDisplay.java → RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/crafting/DefaultShapedDisplay.java

@@ -26,16 +26,13 @@ package me.shedaniel.rei.plugin.crafting;
 import me.shedaniel.rei.api.EntryStack;
 import net.fabricmc.api.EnvType;
 import net.fabricmc.api.Environment;
-import net.minecraft.item.ItemStack;
 import net.minecraft.recipe.Recipe;
 import net.minecraft.recipe.ShapedRecipe;
 import net.minecraft.util.Identifier;
 
-import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import java.util.Optional;
-import java.util.stream.Collectors;
 
 @Environment(EnvType.CLIENT)
 public class DefaultShapedDisplay implements DefaultCraftingDisplay {

+ 0 - 0
src/main/java/me/shedaniel/rei/plugin/crafting/DefaultShapelessDisplay.java → RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/crafting/DefaultShapelessDisplay.java


+ 7 - 2
src/main/java/me/shedaniel/rei/plugin/fuel/DefaultFuelCategory.java → RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/fuel/DefaultFuelCategory.java

@@ -34,6 +34,8 @@ import me.shedaniel.rei.api.widgets.Widgets;
 import me.shedaniel.rei.gui.entries.RecipeEntry;
 import me.shedaniel.rei.gui.widget.Widget;
 import me.shedaniel.rei.plugin.DefaultPlugin;
+import net.fabricmc.api.EnvType;
+import net.fabricmc.api.Environment;
 import net.minecraft.client.MinecraftClient;
 import net.minecraft.client.resource.language.I18n;
 import net.minecraft.client.util.math.MatrixStack;
@@ -45,6 +47,7 @@ import org.jetbrains.annotations.Nullable;
 import java.text.DecimalFormat;
 import java.util.List;
 
+@Environment(EnvType.CLIENT)
 public class DefaultFuelCategory implements RecipeCategory<DefaultFuelDisplay> {
     
     private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("#.##");
@@ -70,7 +73,7 @@ public class DefaultFuelCategory implements RecipeCategory<DefaultFuelDisplay> {
     }
     
     @Override
-    public List<Widget> setupDisplay(DefaultFuelDisplay recipeDisplay, me.shedaniel.math.Rectangle bounds) {
+    public List<Widget> setupDisplay(DefaultFuelDisplay recipeDisplay, Rectangle bounds) {
         Point startPoint = new Point(bounds.getCenterX() - 41, bounds.getCenterY() - 17);
         String burnItems = DECIMAL_FORMAT.format(recipeDisplay.getFuelTime() / 200d);
         List<Widget> widgets = Lists.newArrayList();
@@ -87,6 +90,8 @@ public class DefaultFuelCategory implements RecipeCategory<DefaultFuelDisplay> {
         Slot slot = Widgets.createSlot(new Point(0, 0)).entries(recipe.getInputEntries().get(0)).disableBackground().disableHighlight();
         String burnItems = DECIMAL_FORMAT.format(recipe.getFuelTime() / 200d);
         return new RecipeEntry() {
+            private TranslatableText text = new TranslatableText("category.rei.fuel.time_short.items", burnItems);
+            
             @Override
             public int getHeight() {
                 return 22;
@@ -105,7 +110,7 @@ public class DefaultFuelCategory implements RecipeCategory<DefaultFuelDisplay> {
                 slot.setZ(getZ() + 50);
                 slot.getBounds().setLocation(bounds.x + 4, bounds.y + 2);
                 slot.render(matrices, mouseX, mouseY, delta);
-                MinecraftClient.getInstance().textRenderer.drawWithShadow(matrices, new TranslatableText("category.rei.fuel.time_short.items", burnItems), bounds.x + 25, bounds.y + 8, -1);
+                MinecraftClient.getInstance().textRenderer.drawWithShadow(matrices, text.method_30937(), bounds.x + 25, bounds.y + 8, -1);
             }
         };
     }

+ 0 - 0
src/main/java/me/shedaniel/rei/plugin/fuel/DefaultFuelDisplay.java → RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/fuel/DefaultFuelDisplay.java


+ 6 - 5
src/main/java/me/shedaniel/rei/plugin/information/DefaultInformationCategory.java → RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/information/DefaultInformationCategory.java

@@ -41,6 +41,7 @@ import me.shedaniel.rei.impl.RenderingEntry;
 import me.shedaniel.rei.plugin.DefaultPlugin;
 import net.fabricmc.api.EnvType;
 import net.fabricmc.api.Environment;
+import net.minecraft.class_5481;
 import net.minecraft.client.MinecraftClient;
 import net.minecraft.client.gui.Element;
 import net.minecraft.client.render.BufferBuilder;
@@ -85,7 +86,7 @@ public class DefaultInformationCategory implements RecipeCategory<DefaultInforma
     
     @Override
     public RecipeEntry getSimpleRenderer(DefaultInformationDisplay recipe) {
-        Text name = recipe.getName();
+        class_5481 name = recipe.getName().method_30937();
         return new RecipeEntry() {
             @Override
             public int getHeight() {
@@ -104,7 +105,7 @@ public class DefaultInformationCategory implements RecipeCategory<DefaultInforma
         return new RenderingEntry() {
             @Override
             public void render(MatrixStack matrices, Rectangle bounds, int mouseX, int mouseY, float delta) {
-                MinecraftClient.getInstance().getTextureManager().bindTexture(DefaultPlugin.getDisplayTexture());
+                MinecraftClient.getInstance().getTextureManager().bindTexture(REIHelper.getInstance().getDefaultDisplayTexture());
                 matrices.push();
                 matrices.translate(-1.2f, -1, 0);
                 Matrix4f matrix = matrices.peek().getModel();
@@ -137,7 +138,7 @@ public class DefaultInformationCategory implements RecipeCategory<DefaultInforma
     
     private static class ScrollableTextWidget extends WidgetWithBounds {
         private Rectangle bounds;
-        private List<StringRenderable> texts;
+        private List<class_5481> texts;
         private final ScrollingContainer scrolling = new ScrollingContainer() {
             @Override
             public Rectangle getBounds() {
@@ -148,7 +149,7 @@ public class DefaultInformationCategory implements RecipeCategory<DefaultInforma
             @Override
             public int getMaxScrollHeight() {
                 int i = 2;
-                for (StringRenderable entry : texts) {
+                for (class_5481 entry : texts) {
                     i += entry == null ? 4 : font.fontHeight;
                 }
                 return i;
@@ -200,7 +201,7 @@ public class DefaultInformationCategory implements RecipeCategory<DefaultInforma
             Rectangle innerBounds = scrolling.getScissorBounds();
             ScissorsHandler.INSTANCE.scissor(innerBounds);
             int currentY = (int) -scrolling.scrollAmount + innerBounds.y;
-            for (StringRenderable text : texts) {
+            for (class_5481 text : texts) {
                 if (text != null && currentY + font.fontHeight >= innerBounds.y && currentY <= innerBounds.getMaxY()) {
                     font.draw(matrices, text, innerBounds.x + 2, currentY + 2, REIHelper.getInstance().isDarkThemeEnabled() ? 0xFFBBBBBB : 0xFF090909);
                 }

+ 0 - 0
src/main/java/me/shedaniel/rei/plugin/information/DefaultInformationDisplay.java → RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/information/DefaultInformationDisplay.java


+ 7 - 4
src/main/java/me/shedaniel/rei/mixin/MixinBrewingRecipeRegistry.java → RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/mixin/MixinBrewingRecipeRegistry.java

@@ -21,12 +21,14 @@
  * SOFTWARE.
  */
 
-package me.shedaniel.rei.mixin;
+package me.shedaniel.rei.plugin.mixin;
 
 import com.google.common.collect.Lists;
 import me.shedaniel.rei.plugin.DefaultPlugin;
 import me.shedaniel.rei.plugin.brewing.BrewingRecipe;
-import me.shedaniel.rei.plugin.brewing.DefaultBrewingDisplay;
+import me.shedaniel.rei.plugin.brewing.RegisteredBrewingRecipe;
+import net.fabricmc.api.EnvType;
+import net.fabricmc.api.Environment;
 import net.minecraft.item.Item;
 import net.minecraft.item.ItemStack;
 import net.minecraft.item.PotionItem;
@@ -43,6 +45,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
 import java.util.List;
 
 @Mixin(BrewingRecipeRegistry.class)
+@Environment(EnvType.CLIENT)
 public class MixinBrewingRecipeRegistry {
     
     @Unique private static final List<BrewingRecipe> SELF_ITEM_RECIPES = Lists.newArrayList();
@@ -69,7 +72,7 @@ public class MixinBrewingRecipeRegistry {
             rei_registerPotionType(potion_2);
         for (Ingredient type : SELF_POTION_TYPES) {
             for (ItemStack stack : type.getMatchingStacksClient()) {
-                DefaultPlugin.registerBrewingDisplay(new DefaultBrewingDisplay(PotionUtil.setPotion(stack.copy(), potion_1), Ingredient.ofItems(item_1), PotionUtil.setPotion(stack.copy(), potion_2)));
+                DefaultPlugin.registerBrewingRecipe(new RegisteredBrewingRecipe(PotionUtil.setPotion(stack.copy(), potion_1), Ingredient.ofItems(item_1), PotionUtil.setPotion(stack.copy(), potion_2)));
             }
         }
     }
@@ -77,7 +80,7 @@ public class MixinBrewingRecipeRegistry {
     private static void rei_registerPotionType(Potion potion) {
         REGISTERED_POTION_TYPES.add(potion);
         for (BrewingRecipe recipe : SELF_ITEM_RECIPES) {
-            DefaultPlugin.registerBrewingDisplay(new DefaultBrewingDisplay(PotionUtil.setPotion(recipe.input.getStackForRender(), potion), recipe.ingredient, PotionUtil.setPotion(recipe.output.getStackForRender(), potion)));
+            DefaultPlugin.registerBrewingRecipe(new RegisteredBrewingRecipe(PotionUtil.setPotion(recipe.input.getStackForRender(), potion), recipe.ingredient, PotionUtil.setPotion(recipe.output.getStackForRender(), potion)));
         }
     }
     

+ 0 - 0
src/main/java/me/shedaniel/rei/plugin/smelting/DefaultSmeltingDisplay.java → RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/smelting/DefaultSmeltingDisplay.java


+ 0 - 0
src/main/java/me/shedaniel/rei/plugin/smithing/DefaultSmithingCategory.java → RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/smithing/DefaultSmithingCategory.java


Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff