فهرست منبع

v2.7.3 Bug fixes

Fix #56
Unknown 6 سال پیش
والد
کامیت
478e34e91d
36فایلهای تغییر یافته به همراه237 افزوده شده و 262 حذف شده
  1. 8 0
      CHANGELOG.md
  2. 1 1
      gradle.properties
  3. 2 1
      src/main/java/me/shedaniel/rei/api/RecipeCategory.java
  4. 1 3
      src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java
  5. 3 3
      src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java
  6. 34 0
      src/main/java/me/shedaniel/rei/gui/config/ItemListOrderingConfig.java
  7. 0 90
      src/main/java/me/shedaniel/rei/gui/config/ItemListOrderingEntry.java
  8. 20 2
      src/main/java/me/shedaniel/rei/gui/credits/CreditsEntryListWidget.java
  9. 0 24
      src/main/java/me/shedaniel/rei/gui/credits/CreditsItem.java
  10. 3 1
      src/main/java/me/shedaniel/rei/gui/credits/CreditsScreen.java
  11. 1 3
      src/main/java/me/shedaniel/rei/gui/widget/ButtonWidget.java
  12. 16 0
      src/main/java/me/shedaniel/rei/gui/widget/CategoryBaseWidget.java
  13. 1 1
      src/main/java/me/shedaniel/rei/gui/widget/ClickableLabelWidget.java
  14. 3 2
      src/main/java/me/shedaniel/rei/gui/widget/CraftableToggleButtonWidget.java
  15. 1 1
      src/main/java/me/shedaniel/rei/gui/widget/DraggableWidget.java
  16. 2 2
      src/main/java/me/shedaniel/rei/gui/widget/ItemSlotWidget.java
  17. 2 4
      src/main/java/me/shedaniel/rei/gui/widget/LabelWidget.java
  18. 29 22
      src/main/java/me/shedaniel/rei/gui/widget/RecipeBaseWidget.java
  19. 7 7
      src/main/java/me/shedaniel/rei/gui/widget/RecipeChoosePageWidget.java
  20. 0 1
      src/main/java/me/shedaniel/rei/gui/widget/TabWidget.java
  21. 0 3
      src/main/java/me/shedaniel/rei/gui/widget/TextFieldWidget.java
  22. 2 0
      src/main/java/me/shedaniel/rei/gui/widget/Widget.java
  23. 0 31
      src/main/java/me/shedaniel/rei/mixin/MixinClientPlayerNetworkHandler.java
  24. 4 9
      src/main/java/me/shedaniel/rei/plugin/DefaultBlastingDisplay.java
  25. 5 5
      src/main/java/me/shedaniel/rei/plugin/DefaultBrewingDisplay.java
  26. 3 4
      src/main/java/me/shedaniel/rei/plugin/DefaultCampfireDisplay.java
  27. 11 4
      src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java
  28. 4 6
      src/main/java/me/shedaniel/rei/plugin/DefaultShapedDisplay.java
  29. 4 6
      src/main/java/me/shedaniel/rei/plugin/DefaultShapelessDisplay.java
  30. 4 9
      src/main/java/me/shedaniel/rei/plugin/DefaultSmeltingDisplay.java
  31. 4 9
      src/main/java/me/shedaniel/rei/plugin/DefaultSmokingDisplay.java
  32. 21 0
      src/main/java/me/shedaniel/rei/plugin/DefaultStoneCuttingCategory.java
  33. 4 4
      src/main/java/me/shedaniel/rei/plugin/DefaultStoneCuttingDisplay.java
  34. 37 4
      src/main/java/me/shedaniel/rei/utils/ClothScreenRegistry.java
  35. BIN
      src/main/resources/assets/roughlyenoughitems/textures/gui/display.png
  36. BIN
      src/main/resources/assets/roughlyenoughitems/textures/gui/recipecontainer.png

+ 8 - 0
CHANGELOG.md

@@ -1,3 +1,11 @@
+## v2.7.3.86
+- Fixed [#56](https://github.com/shedaniel/RoughlyEnoughItems/issues/56): Even tho I don't know how I fixed it
+- Added: Credits button in Config Screen
+- Fixed: Odd pixel with the recipe screen
+- Fixed: Pressing R not working on the side panel while viewing recipes
+- Modified: Right-clicking the search field now focus it
+- Fixed: Craftable Only button having a weird tint when something else is focused
+- Added: Recipes now sort base on their identifiers
 ## v2.7.2.85
 - Bundled with updated APIs for 1.14-pre1
 - New DisplayHelper for better bounds calculation

+ 1 - 1
gradle.properties

@@ -1,4 +1,4 @@
-mod_version=2.7.2+build.85
+mod_version=2.7.3+build.86
 minecraft_version=1.14 Pre-Release 1
 yarn_version=1.14 Pre-Release 1+build.3
 fabric_version=0.2.7+build.122

+ 2 - 1
src/main/java/me/shedaniel/rei/api/RecipeCategory.java

@@ -1,6 +1,7 @@
 package me.shedaniel.rei.api;
 
 import me.shedaniel.rei.gui.RecipeViewingScreen;
+import me.shedaniel.rei.gui.widget.CategoryBaseWidget;
 import me.shedaniel.rei.gui.widget.RecipeBaseWidget;
 import me.shedaniel.rei.gui.widget.Widget;
 import net.minecraft.client.gui.DrawableHelper;
@@ -26,7 +27,7 @@ public interface RecipeCategory<T extends RecipeDisplay> {
     }
     
     default void drawCategoryBackground(Rectangle bounds, int mouseX, int mouseY, float delta) {
-        new RecipeBaseWidget(bounds).render();
+        new CategoryBaseWidget(bounds).render();
         DrawableHelper.fill(bounds.x + 17, bounds.y + 5, bounds.x + bounds.width - 17, bounds.y + 17, RecipeViewingScreen.SUB_COLOR.getRGB());
         DrawableHelper.fill(bounds.x + 17, bounds.y + 21, bounds.x + bounds.width - 17, bounds.y + 33, RecipeViewingScreen.SUB_COLOR.getRGB());
     }

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

@@ -519,10 +519,8 @@ public class ContainerScreenOverlay extends AbstractParentElement implements Dra
         
         @Override
         public boolean mouseClicked(double double_1, double double_2, int int_1) {
-            if (isVisible() && getBounds().contains(double_1, double_2) && int_1 == 1) {
+            if (isVisible() && getBounds().contains(double_1, double_2) && int_1 == 1)
                 setText("");
-                return true;
-            }
             return super.mouseClicked(double_1, double_2, int_1);
         }
         

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

@@ -94,8 +94,8 @@ public class RecipeViewingScreen extends Screen {
         }
         if (choosePageActivated)
             return recipeChoosePageWidget.keyPressed(int_1, int_2, int_3);
-        for(Widget widget : widgets)
-            if (widget.keyPressed(int_1, int_2, int_3))
+        for(Element element : children())
+            if (element.keyPressed(int_1, int_2, int_3))
                 return true;
         return super.keyPressed(int_1, int_2, int_3);
     }
@@ -314,7 +314,7 @@ public class RecipeViewingScreen extends Screen {
         if (selectedCategory != null)
             selectedCategory.drawCategoryBackground(bounds, mouseX, mouseY, delta);
         else {
-            new RecipeBaseWidget(bounds).render();
+            new CategoryBaseWidget(bounds).render();
             fill(bounds.x + 17, bounds.y + 5, bounds.x + bounds.width - 17, bounds.y + 17, SUB_COLOR.getRGB());
             fill(bounds.x + 17, bounds.y + 21, bounds.x + bounds.width - 17, bounds.y + 33, SUB_COLOR.getRGB());
         }

+ 34 - 0
src/main/java/me/shedaniel/rei/gui/config/ItemListOrderingConfig.java

@@ -0,0 +1,34 @@
+package me.shedaniel.rei.gui.config;
+
+import me.shedaniel.rei.client.ItemListOrdering;
+import net.minecraft.client.resource.language.I18n;
+
+public enum ItemListOrderingConfig {
+    REGISTRY_ASCENDING(ItemListOrdering.registry, true), NAME_ASCENDING(ItemListOrdering.name, true), GROUPS_ASCENDING(ItemListOrdering.item_groups, true), REGISTRY_DESCENDING(ItemListOrdering.registry, false), NAME_DESCENDING(ItemListOrdering.name, false), GROUPS_DESCENDING(ItemListOrdering.item_groups, false);
+    
+    private ItemListOrdering ordering;
+    private boolean isAscending;
+    
+    ItemListOrderingConfig(ItemListOrdering ordering, boolean isAscending) {
+        this.ordering = ordering;
+        this.isAscending = isAscending;
+    }
+    
+    public static ItemListOrderingConfig from(ItemListOrdering ordering, boolean isAscending) {
+        int index = ordering.ordinal() + (isAscending ? 0 : 3);
+        return values()[index];
+    }
+    
+    public ItemListOrdering getOrdering() {
+        return ordering;
+    }
+    
+    public boolean isAscending() {
+        return isAscending;
+    }
+    
+    @Override
+    public String toString() {
+        return I18n.translate("text.rei.config.list_ordering_button", I18n.translate(getOrdering().getNameTranslationKey()), I18n.translate(isAscending ? "ordering.rei.ascending" : "ordering.rei.descending"));
+    }
+}

+ 0 - 90
src/main/java/me/shedaniel/rei/gui/config/ItemListOrderingEntry.java

@@ -1,90 +0,0 @@
-package me.shedaniel.rei.gui.config;
-
-import com.google.common.collect.Lists;
-import me.shedaniel.cloth.gui.ClothConfigScreen.ListEntry;
-import me.shedaniel.rei.RoughlyEnoughItemsCore;
-import me.shedaniel.rei.client.ItemListOrdering;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.gui.Element;
-import net.minecraft.client.gui.widget.ButtonWidget;
-import net.minecraft.client.resource.language.I18n;
-import net.minecraft.client.util.Window;
-import net.minecraft.util.Pair;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Optional;
-import java.util.concurrent.atomic.AtomicReference;
-
-public class ItemListOrderingEntry extends ListEntry {
-    private AtomicReference<Pair<ItemListOrdering, Boolean>> value;
-    private ButtonWidget buttonWidget;
-    private ButtonWidget resetButton;
-    private List<Element> widgets;
-    
-    public ItemListOrderingEntry(String fieldName, Pair<ItemListOrdering, Boolean> val) {
-        super(fieldName);
-        this.value = new AtomicReference(val);
-        this.buttonWidget = new ButtonWidget(0, 0, 150, 20, "", widget -> {
-            int index = Arrays.asList(ItemListOrdering.values()).indexOf(value.get().getLeft()) + 1;
-            boolean currentAscending = value.get().getRight();
-            if (index >= ItemListOrdering.values().length) {
-                index = 0;
-                currentAscending = !currentAscending;
-            }
-            ItemListOrderingEntry.this.value.set(new Pair<>(ItemListOrdering.values()[index], currentAscending));
-            getScreen().setEdited(true);
-        });
-        this.resetButton = new ButtonWidget(0, 0, MinecraftClient.getInstance().textRenderer.getStringWidth(I18n.translate("text.cloth.reset_value")) + 6, 20, I18n.translate("text.cloth.reset_value"), (widget) -> {
-            this.value.set((Pair) getDefaultValue().get());
-            getScreen().setEdited(true);
-        });
-        this.widgets = Lists.newArrayList(this.buttonWidget, this.resetButton);
-    }
-    
-    public Object getObject() {
-        return this.value.get();
-    }
-    
-    @Override
-    public Optional<Object> getDefaultValue() {
-        return Optional.of(new Pair<>(ItemListOrdering.registry, true));
-    }
-    
-    @Override
-    public void render(int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean isSelected, float delta) {
-        Window window = MinecraftClient.getInstance().window;
-        this.resetButton.active = this.getDefaultValue().isPresent() && (((Pair<ItemListOrdering, Boolean>) this.getDefaultValue().get()).getLeft() != this.value.get().getLeft() || ((Pair<ItemListOrdering, Boolean>) this.getDefaultValue().get()).getRight().booleanValue() != this.value.get().getRight().booleanValue());
-        this.resetButton.y = y;
-        this.buttonWidget.y = y;
-        this.buttonWidget.setMessage(I18n.translate("text.rei.config.list_ordering_button", I18n.translate(value.get().getLeft().getNameTranslationKey()), I18n.translate(value.get().getRight() ? "ordering.rei.ascending" : "ordering.rei.descending")));
-        if (MinecraftClient.getInstance().textRenderer.isRightToLeft()) {
-            MinecraftClient.getInstance().textRenderer.drawWithShadow(I18n.translate(this.getFieldName(), new Object[0]), (float) (window.getScaledWidth() - x - MinecraftClient.getInstance().textRenderer.getStringWidth(I18n.translate(this.getFieldName(), new Object[0]))), (float) (y + 5), 16777215);
-            this.resetButton.x = x;
-            this.buttonWidget.x = x + this.resetButton.getWidth() + 2;
-            this.buttonWidget.setWidth(150 - this.resetButton.getWidth() - 2);
-        } else {
-            MinecraftClient.getInstance().textRenderer.drawWithShadow(I18n.translate(this.getFieldName(), new Object[0]), (float) x, (float) (y + 5), 16777215);
-            this.resetButton.x = window.getScaledWidth() - x - this.resetButton.getWidth();
-            this.buttonWidget.x = window.getScaledWidth() - x - 150;
-            this.buttonWidget.setWidth(150 - this.resetButton.getWidth() - 2);
-        }
-        this.buttonWidget.render(mouseX, mouseY, delta);
-        this.resetButton.render(mouseX, mouseY, delta);
-    }
-    
-    public String getYesNoText(boolean bool) {
-        return bool ? "§aYes" : "§cNo";
-    }
-    
-    @Override
-    public List<? extends Element> children() {
-        return widgets;
-    }
-    
-    @Override
-    public void save() {
-        RoughlyEnoughItemsCore.getConfigManager().getConfig().itemListOrdering = value.get().getLeft();
-        RoughlyEnoughItemsCore.getConfigManager().getConfig().isAscending = value.get().getRight();
-    }
-}

+ 20 - 2
src/main/java/me/shedaniel/rei/gui/credits/CreditsEntryListWidget.java

@@ -1,9 +1,10 @@
 package me.shedaniel.rei.gui.credits;
 
 import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.gui.widget.ItemListWidget;
+import net.minecraft.client.gui.menu.AlwaysSelectedItemListWidget;
+import net.minecraft.text.TextComponent;
 
-public class CreditsEntryListWidget extends ItemListWidget<CreditsItem> {
+public class CreditsEntryListWidget extends AlwaysSelectedItemListWidget<CreditsEntryListWidget.CreditsItem> {
     
     public CreditsEntryListWidget(MinecraftClient client, int width, int height, int startY, int endY, int entryHeight) {
         super(client, width, height, startY, endY, entryHeight);
@@ -32,4 +33,21 @@ public class CreditsEntryListWidget extends ItemListWidget<CreditsItem> {
         return width - 40;
     }
     
+    public static class CreditsItem extends AlwaysSelectedItemListWidget.class_4281<CreditsItem> {
+        private String text;
+        
+        public CreditsItem(TextComponent textComponent) {
+            this(textComponent.getFormattedText());
+        }
+        
+        public CreditsItem(String text) {
+            this.text = text;
+        }
+        
+        @Override
+        public void render(int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean isSelected, float delta) {
+            MinecraftClient.getInstance().textRenderer.drawWithShadow(text, x + 5, y + 5, -1);
+        }
+    }
+    
 }

+ 0 - 24
src/main/java/me/shedaniel/rei/gui/credits/CreditsItem.java

@@ -1,24 +0,0 @@
-package me.shedaniel.rei.gui.credits;
-
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.gui.widget.ItemListWidget;
-import net.minecraft.text.TextComponent;
-
-public class CreditsItem extends ItemListWidget.Item<CreditsItem> {
-    
-    private String text;
-    
-    public CreditsItem(TextComponent textComponent) {
-        this(textComponent.getFormattedText());
-    }
-    
-    public CreditsItem(String text) {
-        this.text = text;
-    }
-    
-    @Override
-    public void render(int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean isSelected, float delta) {
-        MinecraftClient.getInstance().textRenderer.drawWithShadow(text, x + 5, y + 5, -1);
-    }
-    
-}

+ 3 - 1
src/main/java/me/shedaniel/rei/gui/credits/CreditsScreen.java

@@ -1,6 +1,7 @@
 package me.shedaniel.rei.gui.credits;
 
 import me.shedaniel.rei.client.ScreenHelper;
+import me.shedaniel.rei.gui.credits.CreditsEntryListWidget.CreditsItem;
 import me.shedaniel.rei.gui.widget.ButtonWidget;
 import net.minecraft.client.gui.ContainerScreen;
 import net.minecraft.client.gui.Screen;
@@ -48,7 +49,7 @@ public class CreditsScreen extends Screen {
     
     @Override
     public boolean mouseScrolled(double double_1, double double_2, double double_3) {
-        if (entryListWidget.mouseScrolled(double_1, double_2, double_3))
+        if (entryListWidget.mouseScrolled(double_1, double_2, double_3 * 3))
             return true;
         return super.mouseScrolled(double_1, double_2, double_3);
     }
@@ -59,6 +60,7 @@ public class CreditsScreen extends Screen {
         this.entryListWidget.render(int_1, int_2, float_1);
         this.drawCenteredString(this.font, I18n.translate("text.rei.credits"), this.width / 2, 16, 16777215);
         super.render(int_1, int_2, float_1);
+        buttonDone.render(int_1, int_2, float_1);
     }
     
 }

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

@@ -3,7 +3,6 @@ package me.shedaniel.rei.gui.widget;
 import com.mojang.blaze3d.platform.GlStateManager;
 import me.shedaniel.rei.client.ScreenHelper;
 import net.minecraft.client.audio.PositionedSoundInstance;
-import net.minecraft.client.font.TextRenderer;
 import net.minecraft.client.gui.Element;
 import net.minecraft.client.gui.widget.AbstractButtonWidget;
 import net.minecraft.sound.SoundEvents;
@@ -58,7 +57,6 @@ public abstract class ButtonWidget extends HighlightableWidget {
     @Override
     public void render(int mouseX, int mouseY, float delta) {
         int x = bounds.x, y = bounds.y, width = bounds.width, height = bounds.height;
-        TextRenderer textRenderer = minecraft.textRenderer;
         minecraft.getTextureManager().bindTexture(AbstractButtonWidget.WIDGETS_LOCATION);
         GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
         int textureOffset = this.getTextureId(isHovered(mouseX, mouseY));
@@ -87,7 +85,7 @@ public abstract class ButtonWidget extends HighlightableWidget {
             colour = 16777120;
         }
         
-        this.drawCenteredString(textRenderer, this.text, x + width / 2, y + (height - 8) / 2, colour);
+        this.drawCenteredString(font, text, x + width / 2, y + (height - 8) / 2, colour);
         
         if (getTooltips().isPresent())
             if (!focused && isHighlighted(mouseX, mouseY))

+ 16 - 0
src/main/java/me/shedaniel/rei/gui/widget/CategoryBaseWidget.java

@@ -0,0 +1,16 @@
+package me.shedaniel.rei.gui.widget;
+
+import java.awt.*;
+
+public class CategoryBaseWidget extends RecipeBaseWidget {
+    
+    public CategoryBaseWidget(Rectangle bounds) {
+        super(bounds);
+    }
+    
+    @Override
+    protected int getTextureOffset() {
+        return 66;
+    }
+    
+}

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

@@ -19,7 +19,7 @@ public abstract class ClickableLabelWidget extends LabelWidget {
         int colour = -1;
         if (isHovered(mouseX, mouseY))
             colour = hoveredColor;
-        drawCenteredString(textRenderer, (isHovered(mouseX, mouseY) ? "§n" : "") + text, x, y, colour);
+        drawCenteredString(font, (isHovered(mouseX, mouseY) ? "§n" : "") + text, x, y, colour);
         if (getTooltips().isPresent())
             if (!focused && isHighlighted(mouseX, mouseY))
                 ScreenHelper.getLastOverlay().addTooltip(QueuedTooltip.create(getTooltips().get().split("\n")));

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

@@ -39,8 +39,9 @@ public abstract class CraftableToggleButtonWidget extends ButtonWidget {
         GuiLighting.disable();
         MinecraftClient.getInstance().getTextureManager().bindTexture(CHEST_GUI_TEXTURE);
         GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
-        this.blitOffset += 100;
-        this.blit(getBounds().x, getBounds().y, (56 + (RoughlyEnoughItemsCore.getConfigManager().isCraftableOnlyEnabled() ? 0 : 20)), 202, 20, 20);
+        int color = RoughlyEnoughItemsCore.getConfigManager().isCraftableOnlyEnabled() ? 939579655 : 956235776;
+        this.blitOffset += 100f;
+        this.fillGradient(getBounds().x, getBounds().y, getBounds().x + getBounds().width, getBounds().y + getBounds().height, color, color);
         this.blitOffset = 0;
     }
     

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

@@ -45,7 +45,7 @@ public abstract class DraggableWidget extends HighlightableWidget {
                     dragged = true;
                 }
             } else {
-                Window window = MinecraftClient.getInstance().window;
+                Window window = minecraft.window;
                 midPoint = processMidPoint(midPoint, mouse, startPoint, window, relateX, relateY);
                 updateWidgets(midPoint);
             }

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

@@ -69,7 +69,7 @@ public class ItemSlotWidget extends HighlightableWidget {
             GlStateManager.disableLighting();
             GlStateManager.disableDepthTest();
             GlStateManager.colorMask(true, true, true, false);
-            fill(x, y, x + 16, y + 16, -2130706433);
+            fillGradient(x, y, x + 16, y + 16, -2130706433, -2130706433);
             GlStateManager.colorMask(true, true, true, true);
             GlStateManager.enableLighting();
             GlStateManager.enableDepthTest();
@@ -81,7 +81,7 @@ public class ItemSlotWidget extends HighlightableWidget {
             ItemRenderer itemRenderer = minecraft.getItemRenderer();
             itemRenderer.zOffset = 200.0F;
             itemRenderer.renderGuiItem(itemStack, x, y);
-            itemRenderer.renderGuiItemOverlay(minecraft.textRenderer, itemStack, x, y, getItemCountOverlay(itemStack));
+            itemRenderer.renderGuiItemOverlay(font, itemStack, x, y, getItemCountOverlay(itemStack));
             itemRenderer.zOffset = 0.0F;
         }
         if (!itemStack.isEmpty() && isHighlighted(mouseX, mouseY) && showToolTips)

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

@@ -12,18 +12,16 @@ public class LabelWidget extends HighlightableWidget {
     public int x;
     public int y;
     public String text;
-    protected TextRenderer textRenderer;
     
     public LabelWidget(int x, int y, String text) {
         this.x = x;
         this.y = y;
         this.text = text;
-        this.textRenderer = minecraft.textRenderer;
     }
     
     @Override
     public Rectangle getBounds() {
-        int width = textRenderer.getStringWidth(text);
+        int width = font.getStringWidth(text);
         return new Rectangle(x - width / 2 - 1, y - 5, width + 2, 14);
     }
     
@@ -34,7 +32,7 @@ public class LabelWidget extends HighlightableWidget {
     
     @Override
     public void render(int mouseX, int mouseY, float delta) {
-        drawCenteredString(textRenderer, text, x, y, -1);
+        drawCenteredString(font, text, x, y, -1);
     }
     
 }

+ 29 - 22
src/main/java/me/shedaniel/rei/gui/widget/RecipeBaseWidget.java

@@ -1,10 +1,8 @@
 package me.shedaniel.rei.gui.widget;
 
 import com.mojang.blaze3d.platform.GlStateManager;
-import net.minecraft.client.MinecraftClient;
 import net.minecraft.client.render.GuiLighting;
 import net.minecraft.util.Identifier;
-import net.minecraft.util.math.MathHelper;
 
 import java.awt.*;
 import java.util.Collections;
@@ -19,6 +17,8 @@ public class RecipeBaseWidget extends HighlightableWidget {
     
     public RecipeBaseWidget(Rectangle bounds) {
         this.bounds = bounds;
+        if (bounds.width < 8 || bounds.height < 8)
+            throw new IllegalArgumentException("Base too small, at least 8x8!");
     }
     
     @Override
@@ -39,26 +39,33 @@ public class RecipeBaseWidget extends HighlightableWidget {
     public void render(int mouseX, int mouseY, float delta) {
         GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
         GuiLighting.disable();
-        MinecraftClient.getInstance().getTextureManager().bindTexture(CHEST_GUI_TEXTURE);
-        blit(bounds.x, bounds.y, 106, 190, bounds.width / 2, bounds.height / 2);
-        blit(bounds.x + bounds.width / 2, bounds.y, 256 - bounds.width / 2, 190, bounds.width / 2, bounds.height / 2);
-        blit(bounds.x, bounds.y + bounds.height / 2, 106, 190 + 66 - bounds.height / 2, bounds.width / 2, bounds.height / 2);
-        blit(bounds.x + bounds.width / 2, bounds.y + bounds.height / 2, 256 - bounds.width / 2, 190 + 66 - bounds.height / 2, bounds.width / 2, bounds.height / 2);
-        if (bounds.height > 40)
-            for(int i = 20; i < bounds.height - 20; i += MathHelper.clamp(20, 0, bounds.height - 20 - i)) {
-                int height = MathHelper.clamp(20, 0, bounds.height - 20 - i);
-                blit(bounds.x, bounds.y + i, 106, 230, bounds.width / 2, height);
-                blit(bounds.x + bounds.width / 2, bounds.y + i, 256 - bounds.width / 2, 210, bounds.width / 2, height);
-            }
-        if (bounds.width > 40)
-            for(int i = 20; i < bounds.width - 20; i += MathHelper.clamp(40, 0, bounds.width - 20 - i)) {
-                int width = MathHelper.clamp(40, 0, bounds.width - 20 - i);
-                GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
-                GuiLighting.disable();
-                blit(bounds.x + i, bounds.y, 113, 190, width, MathHelper.clamp(4, 0, bounds.height / 2));
-                blit(bounds.x + i, bounds.y + bounds.height - 4, 113, 252, width, MathHelper.clamp(4, 0, bounds.height / 2));
-                fill(bounds.x + i, bounds.y + 4, bounds.x + i + width, bounds.y + bounds.height - 4, INNER_COLOR.getRGB());
-            }
+        minecraft.getTextureManager().bindTexture(CHEST_GUI_TEXTURE);
+        int x = bounds.x, y = bounds.y, width = bounds.width, height = bounds.height;
+        int textureOffset = getTextureOffset();
+        
+        //Four Corners
+        this.blit(x, y, 106, 124 + textureOffset, 4, 4);
+        this.blit(x + width - 4, y, 252, 124 + textureOffset, 4, 4);
+        this.blit(x, y + height - 4, 106, 186 + textureOffset, 4, 4);
+        this.blit(x + width - 4, y + height - 4, 252, 186 + textureOffset, 4, 4);
+        
+        //Sides
+        for(int xx = 4; xx < width - 4; xx += 128) {
+            int thisWidth = Math.min(128, width - 4 - xx);
+            this.blit(x + xx, y, 110, 124 + textureOffset, thisWidth, 4);
+            this.blit(x + xx, y + height - 4, 110, 186 + textureOffset, thisWidth, 4);
+        }
+        for(int yy = 4; yy < height - 4; yy += 50) {
+            int thisHeight = Math.min(50, height - 4 - yy);
+            this.blit(x, y + yy, 106, 128 + textureOffset, 4, thisHeight);
+            this.blit(x + width - 4, y + yy, 252, 128 + textureOffset, 4, thisHeight);
+        }
+        fillGradient(x + 4, y + 4, x + width - 4, y + height - 4, INNER_COLOR.getRGB(), INNER_COLOR.getRGB());
     }
     
+    protected int getTextureOffset() {
+        return 0;
+    }
+    
+    
 }

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

@@ -26,7 +26,7 @@ public class RecipeChoosePageWidget extends DraggableWidget {
     private List<Widget> widgets;
     private RecipeViewingScreen recipeViewingScreen;
     private TextFieldWidget textFieldWidget;
-    private RecipeBaseWidget base1, base2;
+    private CategoryBaseWidget base1, base2;
     private ButtonWidget btnDone;
     
     public RecipeChoosePageWidget(RecipeViewingScreen recipeViewingScreen, int currentPage, int maxPage) {
@@ -80,8 +80,8 @@ public class RecipeChoosePageWidget extends DraggableWidget {
         this.grabBounds = new Rectangle(midPoint.x - 50, midPoint.y - 20, 100, 16);
         this.dragBounds = new Rectangle(midPoint.x - 50, midPoint.y - 20, 100, 70);
         this.widgets = Lists.newArrayList();
-        this.widgets.add(base1 = new RecipeBaseWidget(new Rectangle(bounds.x + bounds.width - 50, bounds.y + bounds.height - 6, 50, 36)));
-        this.widgets.add(base2 = new RecipeBaseWidget(bounds));
+        this.widgets.add(base1 = new CategoryBaseWidget(new Rectangle(bounds.x + bounds.width - 50, bounds.y + bounds.height - 6, 50, 36)));
+        this.widgets.add(base2 = new CategoryBaseWidget(bounds));
         this.widgets.add(new Widget() {
             @Override
             public List<Widget> children() {
@@ -90,14 +90,14 @@ public class RecipeChoosePageWidget extends DraggableWidget {
             
             @Override
             public void render(int i, int i1, float v) {
-                minecraft.textRenderer.draw(I18n.translate("text.rei.choose_page"), bounds.x + 5, bounds.y + 5, 4210752);
+                font.draw(I18n.translate("text.rei.choose_page"), bounds.x + 5, bounds.y + 5, 4210752);
                 String endString = String.format(" /%d", maxPage);
-                int width = minecraft.textRenderer.getStringWidth(endString);
-                minecraft.textRenderer.draw(endString, bounds.x + bounds.width - 5 - width, bounds.y + 22, 4210752);
+                int width = font.getStringWidth(endString);
+                font.draw(endString, bounds.x + bounds.width - 5 - width, bounds.y + 22, 4210752);
             }
         });
         String endString = String.format(" /%d", maxPage);
-        int width = minecraft.textRenderer.getStringWidth(endString);
+        int width = font.getStringWidth(endString);
         this.widgets.add(textFieldWidget = new TextFieldWidget(bounds.x + 7, bounds.y + 16, bounds.width - width - 12, 18));
         textFieldWidget.stripInvaild = s -> {
             StringBuilder stringBuilder_1 = new StringBuilder();

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

@@ -68,7 +68,6 @@ public class TabWidget extends HighlightableWidget {
     public void render(int mouseX, int mouseY, float delta) {
         if (shown) {
             int l = (int) this.bounds.getCenterX() - 8, i1 = (int) this.bounds.getCenterY() - 6;
-            
             GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
             GuiLighting.disable();
             minecraft.getTextureManager().bindTexture(CHEST_GUI_TEXTURE);

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

@@ -3,7 +3,6 @@ package me.shedaniel.rei.gui.widget;
 import com.google.common.base.Predicates;
 import com.mojang.blaze3d.platform.GlStateManager;
 import net.minecraft.SharedConstants;
-import net.minecraft.client.font.TextRenderer;
 import net.minecraft.client.gui.Screen;
 import net.minecraft.client.render.BufferBuilder;
 import net.minecraft.client.render.Tessellator;
@@ -20,7 +19,6 @@ import java.util.function.Predicate;
 
 public class TextFieldWidget extends HighlightableWidget {
     
-    protected final TextRenderer font;
     public Function<String, String> stripInvaild;
     protected int focusedTicks;
     protected boolean editable;
@@ -55,7 +53,6 @@ public class TextFieldWidget extends HighlightableWidget {
         this.renderTextProvider = (string_1, integer_1) -> {
             return string_1;
         };
-        this.font = minecraft.textRenderer;
         this.bounds = rectangle;
         this.stripInvaild = s -> SharedConstants.stripInvalidChars(s);
     }

+ 2 - 0
src/main/java/me/shedaniel/rei/gui/widget/Widget.java

@@ -1,11 +1,13 @@
 package me.shedaniel.rei.gui.widget;
 
 import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.font.TextRenderer;
 import net.minecraft.client.gui.AbstractParentElement;
 import net.minecraft.client.gui.Drawable;
 
 public abstract class Widget extends AbstractParentElement implements Drawable {
     
     protected final MinecraftClient minecraft = MinecraftClient.getInstance();
+    protected final TextRenderer font = minecraft.textRenderer;
     
 }

+ 0 - 31
src/main/java/me/shedaniel/rei/mixin/MixinClientPlayerNetworkHandler.java

@@ -1,31 +0,0 @@
-package me.shedaniel.rei.mixin;
-
-import net.minecraft.client.network.ClientPlayNetworkHandler;
-import net.minecraft.client.network.packet.GameStateChangeS2CPacket;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.injection.At;
-import org.spongepowered.asm.mixin.injection.Inject;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-
-@Mixin(ClientPlayNetworkHandler.class)
-public class MixinClientPlayerNetworkHandler {
-    
-    @Inject(method = "onGameStateChange", at = @At("RETURN"))
-    public void onGameStateChange(GameStateChangeS2CPacket packet, CallbackInfo callbackInfo) {
-        switch (packet.getReason()) {
-            case 1:
-                System.out.println("End Raining");
-                break;
-            case 2:
-                System.out.println("Start Raining");
-                break;
-            case 7:
-                System.out.println("Change rain color to " + packet.getValue());
-                break;
-            case 8:
-                System.out.println("Change thunder color to " + packet.getValue());
-                break;
-        }
-    }
-    
-}

+ 4 - 9
src/main/java/me/shedaniel/rei/plugin/DefaultBlastingDisplay.java

@@ -8,7 +8,7 @@ import net.minecraft.item.ItemStack;
 import net.minecraft.recipe.cooking.BlastingRecipe;
 import net.minecraft.util.Identifier;
 
-import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 import java.util.Optional;
 import java.util.stream.Collectors;
@@ -21,14 +21,9 @@ public class DefaultBlastingDisplay implements RecipeDisplay<BlastingRecipe> {
     
     public DefaultBlastingDisplay(BlastingRecipe recipe) {
         this.display = recipe;
-        List<ItemStack> fuel = Lists.newArrayList();
-        this.input = Lists.newArrayList();
-        fuel.addAll(FurnaceBlockEntity.createFuelTimeMap().keySet().stream().map(Item::getDefaultStack).collect(Collectors.toList()));
-        recipe.getPreviewInputs().forEach(ingredient -> {
-            input.add(Arrays.asList(ingredient.getStackArray()));
-        });
-        input.add(fuel);
-        this.output = Arrays.asList(recipe.getOutput());
+        this.input = Lists.newArrayList(recipe.getPreviewInputs().stream().map(i -> Lists.newArrayList(i.getStackArray())).collect(Collectors.toList()));
+        input.add(FurnaceBlockEntity.createFuelTimeMap().keySet().stream().map(Item::getDefaultStack).collect(Collectors.toList()));
+        this.output = Collections.singletonList(recipe.getOutput());
     }
     
     @Override

+ 5 - 5
src/main/java/me/shedaniel/rei/plugin/DefaultBrewingDisplay.java

@@ -1,15 +1,15 @@
 package me.shedaniel.rei.plugin;
 
+import com.google.common.collect.Lists;
 import me.shedaniel.rei.api.RecipeDisplay;
 import net.minecraft.block.Blocks;
 import net.minecraft.item.ItemStack;
-import net.minecraft.item.Items;
 import net.minecraft.recipe.Ingredient;
 import net.minecraft.recipe.Recipe;
 import net.minecraft.util.Identifier;
 
 import java.util.ArrayList;
-import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 import java.util.Optional;
 
@@ -31,12 +31,12 @@ public class DefaultBrewingDisplay implements RecipeDisplay {
     
     @Override
     public List<List<ItemStack>> getInput() {
-        return Arrays.asList(Arrays.asList(input), Arrays.asList(reactant.getStackArray()));
+        return Lists.newArrayList(Collections.singletonList(input), Lists.newArrayList(reactant.getStackArray()));
     }
     
     @Override
     public List<ItemStack> getOutput() {
-        return Arrays.asList(output);
+        return Collections.singletonList(output);
     }
     
     @Override
@@ -55,6 +55,6 @@ public class DefaultBrewingDisplay implements RecipeDisplay {
     
     @Override
     public List<List<ItemStack>> getRequiredItems() {
-        return Arrays.asList(Arrays.asList(new ItemStack(Items.AIR)));
+        return Collections.singletonList(Collections.singletonList(ItemStack.EMPTY));
     }
 }

+ 3 - 4
src/main/java/me/shedaniel/rei/plugin/DefaultCampfireDisplay.java

@@ -8,7 +8,6 @@ import net.minecraft.recipe.cooking.CampfireCookingRecipe;
 import net.minecraft.util.DefaultedList;
 import net.minecraft.util.Identifier;
 
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 import java.util.Optional;
@@ -26,8 +25,8 @@ public class DefaultCampfireDisplay implements RecipeDisplay<CampfireCookingReci
     
     public DefaultCampfireDisplay(DefaultedList<Ingredient> ingredients, ItemStack output, int cookTime) {
         this.inputs = Lists.newArrayList();
-        ingredients.stream().map(ingredient -> ingredient.getStackArray()).forEach(itemStacks -> Collections.addAll(inputs, itemStacks));
-        this.output = Arrays.asList(output);
+        ingredients.stream().map(ingredient -> Lists.newArrayList(ingredient.getStackArray())).forEach(inputs::addAll);
+        this.output = Collections.singletonList(output);
         this.cookTime = cookTime;
     }
     
@@ -42,7 +41,7 @@ public class DefaultCampfireDisplay implements RecipeDisplay<CampfireCookingReci
     
     @Override
     public List<List<ItemStack>> getInput() {
-        return Arrays.asList(inputs);
+        return Collections.singletonList(inputs);
     }
     
     @Override

+ 11 - 4
src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java

@@ -95,7 +95,14 @@ public class DefaultPlugin implements REIPlugin {
     
     @Override
     public void registerRecipeDisplays(RecipeHelper recipeHelper) {
-        for(Recipe recipe : recipeHelper.getRecipeManager().values())
+        List<Recipe> values = Lists.newLinkedList(recipeHelper.getRecipeManager().values());
+        values.sort((o1, o2) -> {
+            int int_1 = o1.getId().getNamespace().compareTo(o2.getId().getNamespace());
+            if (int_1 == 0)
+                int_1 = o1.getId().getPath().compareTo(o2.getId().getPath());
+            return int_1;
+        });
+        for(Recipe recipe : values)
             if (recipe instanceof ShapelessRecipe)
                 recipeHelper.registerDisplay(CRAFTING, new DefaultShapelessDisplay((ShapelessRecipe) recipe));
             else if (recipe instanceof ShapedRecipe)
@@ -111,18 +118,18 @@ public class DefaultPlugin implements REIPlugin {
             else if (recipe instanceof StonecuttingRecipe)
                 recipeHelper.registerDisplay(STONE_CUTTING, new DefaultStoneCuttingDisplay((StonecuttingRecipe) recipe));
         BREWING_DISPLAYS.stream().forEachOrdered(display -> recipeHelper.registerDisplay(BREWING, display));
-        List<ItemStack> arrowStack = Arrays.asList(Items.ARROW.getDefaultStack());
+        List<ItemStack> arrowStack = Collections.singletonList(Items.ARROW.getDefaultStack());
         RoughlyEnoughItemsCore.getItemRegisterer().getItemList().stream().filter(stack -> stack.getItem().equals(Items.LINGERING_POTION)).forEach(stack -> {
             List<List<ItemStack>> input = new ArrayList<>();
             for(int i = 0; i < 4; i++)
                 input.add(arrowStack);
-            input.add(Arrays.asList(stack));
+            input.add(Collections.singletonList(stack));
             for(int i = 0; i < 4; i++)
                 input.add(arrowStack);
             ItemStack outputStack = new ItemStack(Items.TIPPED_ARROW, 8);
             PotionUtil.setPotion(outputStack, PotionUtil.getPotion(stack));
             PotionUtil.setCustomPotionEffects(outputStack, PotionUtil.getCustomPotionEffects(stack));
-            List<ItemStack> output = Lists.newArrayList(outputStack);
+            List<ItemStack> output = Collections.singletonList(outputStack);
             recipeHelper.registerDisplay(CRAFTING, new DefaultCustomDisplay(input, output));
         });
     }

+ 4 - 6
src/main/java/me/shedaniel/rei/plugin/DefaultShapedDisplay.java

@@ -5,9 +5,10 @@ import net.minecraft.item.ItemStack;
 import net.minecraft.recipe.Recipe;
 import net.minecraft.recipe.crafting.ShapedRecipe;
 
-import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 import java.util.Optional;
+import java.util.stream.Collectors;
 
 public class DefaultShapedDisplay implements DefaultCraftingDisplay<ShapedRecipe> {
     
@@ -17,11 +18,8 @@ public class DefaultShapedDisplay implements DefaultCraftingDisplay<ShapedRecipe
     
     public DefaultShapedDisplay(ShapedRecipe recipe) {
         this.display = recipe;
-        this.input = Lists.newArrayList();
-        recipe.getPreviewInputs().forEach(ingredient -> {
-            input.add(Arrays.asList(ingredient.getStackArray()));
-        });
-        this.output = Arrays.asList(recipe.getOutput());
+        this.input = Lists.newArrayList(recipe.getPreviewInputs().stream().map(i -> Lists.newArrayList(i.getStackArray())).collect(Collectors.toList()));
+        this.output = Collections.singletonList(recipe.getOutput());
     }
     
     @Override

+ 4 - 6
src/main/java/me/shedaniel/rei/plugin/DefaultShapelessDisplay.java

@@ -4,9 +4,10 @@ import com.google.common.collect.Lists;
 import net.minecraft.item.ItemStack;
 import net.minecraft.recipe.crafting.ShapelessRecipe;
 
-import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 import java.util.Optional;
+import java.util.stream.Collectors;
 
 public class DefaultShapelessDisplay implements DefaultCraftingDisplay {
     
@@ -16,11 +17,8 @@ public class DefaultShapelessDisplay implements DefaultCraftingDisplay {
     
     public DefaultShapelessDisplay(ShapelessRecipe recipe) {
         this.display = recipe;
-        this.input = Lists.newArrayList();
-        recipe.getPreviewInputs().forEach(ingredient -> {
-            input.add(Arrays.asList(ingredient.getStackArray()));
-        });
-        this.output = Arrays.asList(recipe.getOutput());
+        this.input = Lists.newArrayList(recipe.getPreviewInputs().stream().map(i -> Lists.newArrayList(i.getStackArray())).collect(Collectors.toList()));
+        this.output = Collections.singletonList(recipe.getOutput());
     }
     
     @Override

+ 4 - 9
src/main/java/me/shedaniel/rei/plugin/DefaultSmeltingDisplay.java

@@ -8,7 +8,7 @@ import net.minecraft.item.ItemStack;
 import net.minecraft.recipe.cooking.SmeltingRecipe;
 import net.minecraft.util.Identifier;
 
-import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 import java.util.Optional;
 import java.util.stream.Collectors;
@@ -21,14 +21,9 @@ public class DefaultSmeltingDisplay implements RecipeDisplay<SmeltingRecipe> {
     
     public DefaultSmeltingDisplay(SmeltingRecipe recipe) {
         this.display = recipe;
-        List<ItemStack> fuel = Lists.newArrayList();
-        this.input = Lists.newArrayList();
-        fuel.addAll(FurnaceBlockEntity.createFuelTimeMap().keySet().stream().map(Item::getDefaultStack).collect(Collectors.toList()));
-        recipe.getPreviewInputs().forEach(ingredient -> {
-            input.add(Arrays.asList(ingredient.getStackArray()));
-        });
-        input.add(fuel);
-        this.output = Arrays.asList(recipe.getOutput());
+        this.input = Lists.newArrayList(recipe.getPreviewInputs().stream().map(i -> Lists.newArrayList(i.getStackArray())).collect(Collectors.toList()));
+        input.add(FurnaceBlockEntity.createFuelTimeMap().keySet().stream().map(Item::getDefaultStack).collect(Collectors.toList()));
+        this.output = Collections.singletonList(recipe.getOutput());
     }
     
     @Override

+ 4 - 9
src/main/java/me/shedaniel/rei/plugin/DefaultSmokingDisplay.java

@@ -8,7 +8,7 @@ import net.minecraft.item.ItemStack;
 import net.minecraft.recipe.cooking.SmokingRecipe;
 import net.minecraft.util.Identifier;
 
-import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 import java.util.Optional;
 import java.util.stream.Collectors;
@@ -21,14 +21,9 @@ public class DefaultSmokingDisplay implements RecipeDisplay<SmokingRecipe> {
     
     public DefaultSmokingDisplay(SmokingRecipe recipe) {
         this.display = recipe;
-        List<ItemStack> fuel = Lists.newArrayList();
-        this.input = Lists.newArrayList();
-        fuel.addAll(FurnaceBlockEntity.createFuelTimeMap().keySet().stream().map(Item::getDefaultStack).collect(Collectors.toList()));
-        recipe.getPreviewInputs().forEach(ingredient -> {
-            input.add(Arrays.asList(ingredient.getStackArray()));
-        });
-        input.add(fuel);
-        this.output = Arrays.asList(recipe.getOutput());
+        this.input = Lists.newArrayList(recipe.getPreviewInputs().stream().map(i -> Lists.newArrayList(i.getStackArray())).collect(Collectors.toList()));
+        input.add(FurnaceBlockEntity.createFuelTimeMap().keySet().stream().map(Item::getDefaultStack).collect(Collectors.toList()));
+        this.output = Collections.singletonList(recipe.getOutput());
     }
     
     @Override

+ 21 - 0
src/main/java/me/shedaniel/rei/plugin/DefaultStoneCuttingCategory.java

@@ -1,6 +1,7 @@
 package me.shedaniel.rei.plugin;
 
 import com.mojang.blaze3d.platform.GlStateManager;
+import me.shedaniel.rei.api.DisplaySettings;
 import me.shedaniel.rei.api.RecipeCategory;
 import me.shedaniel.rei.gui.widget.ItemSlotWidget;
 import me.shedaniel.rei.gui.widget.RecipeBaseWidget;
@@ -55,4 +56,24 @@ public class DefaultStoneCuttingCategory implements RecipeCategory<DefaultStoneC
         return widgets;
     }
     
+    @Override
+    public DisplaySettings getDisplaySettings() {
+        return new DisplaySettings<DefaultStoneCuttingDisplay>() {
+            @Override
+            public int getDisplayHeight(RecipeCategory category) {
+                return 36;
+            }
+            
+            @Override
+            public int getDisplayWidth(RecipeCategory category, DefaultStoneCuttingDisplay display) {
+                return 150;
+            }
+            
+            @Override
+            public int getMaximumRecipePerPage(RecipeCategory category) {
+                return 99;
+            }
+        };
+    }
+    
 }

+ 4 - 4
src/main/java/me/shedaniel/rei/plugin/DefaultStoneCuttingDisplay.java

@@ -8,10 +8,10 @@ import net.minecraft.recipe.StonecuttingRecipe;
 import net.minecraft.util.DefaultedList;
 import net.minecraft.util.Identifier;
 
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 import java.util.Optional;
+import java.util.stream.Collectors;
 
 public class DefaultStoneCuttingDisplay implements RecipeDisplay<StonecuttingRecipe> {
     
@@ -25,8 +25,8 @@ public class DefaultStoneCuttingDisplay implements RecipeDisplay<StonecuttingRec
     
     public DefaultStoneCuttingDisplay(DefaultedList<Ingredient> ingredients, ItemStack output) {
         this.inputs = Lists.newArrayList();
-        ingredients.stream().map(ingredient -> ingredient.getStackArray()).forEach(itemStacks -> Collections.addAll(inputs, itemStacks));
-        this.output = Arrays.asList(output);
+        ingredients.stream().map(i -> Lists.newArrayList(i.getStackArray())).collect(Collectors.toList()).forEach(inputs::addAll);
+        this.output = Collections.singletonList(output);
     }
     
     @Override
@@ -36,7 +36,7 @@ public class DefaultStoneCuttingDisplay implements RecipeDisplay<StonecuttingRec
     
     @Override
     public List<List<ItemStack>> getInput() {
-        return Arrays.asList(inputs);
+        return Collections.singletonList(inputs);
     }
     
     @Override

+ 37 - 4
src/main/java/me/shedaniel/rei/utils/ClothScreenRegistry.java

@@ -1,32 +1,59 @@
 package me.shedaniel.rei.utils;
 
 import me.shedaniel.cloth.api.ConfigScreenBuilder;
+import me.shedaniel.cloth.gui.ClothConfigScreen;
 import me.shedaniel.cloth.gui.entries.BooleanListEntry;
+import me.shedaniel.cloth.gui.entries.EnumListEntry;
 import me.shedaniel.cloth.gui.entries.IntegerSliderEntry;
 import me.shedaniel.cloth.gui.entries.StringListEntry;
 import me.shedaniel.rei.RoughlyEnoughItemsCore;
-import me.shedaniel.rei.gui.config.ItemListOrderingEntry;
+import me.shedaniel.rei.gui.config.ItemListOrderingConfig;
+import me.shedaniel.rei.gui.credits.CreditsScreen;
 import net.minecraft.client.MinecraftClient;
 import net.minecraft.client.gui.Screen;
+import net.minecraft.client.gui.widget.ButtonWidget;
 import net.minecraft.client.resource.language.I18n;
 import net.minecraft.util.Pair;
 
 import java.io.IOException;
+import java.util.List;
+import java.util.Map;
 
 public class ClothScreenRegistry {
     
     public static void openConfigScreen(Screen parent) {
-        ConfigScreenBuilder builder = ConfigScreenBuilder.create(parent, "text.rei.config.title", savedConfig -> {
+        //        ConfigScreenBuilder builder = ConfigScreenBuilder.create(parent, "text.rei.config.title", savedConfig -> {
+        ConfigScreenBuilder builder = new ClothConfigScreen.Builder(parent, "text.rei.config.title", savedConfig -> {
             try {
                 RoughlyEnoughItemsCore.getConfigManager().saveConfig();
             } catch (IOException e) {
                 e.printStackTrace();
             }
-        });
+        }) {
+            @Override
+            public ClothConfigScreen build() {
+                return new ClothConfigScreen(this.getParentScreen(), this.getTitle(), this.getDataMap(), this.doesConfirmSave(), this.shouldProcessErrors()) {
+                    public void onSave(Map<String, List<Pair<String, Object>>> o) {
+                        if (getOnSave() != null) {
+                            getOnSave().accept(new SelfSavedConfig(o));
+                        }
+                    }
+                    
+                    @Override
+                    protected void init() {
+                        addButton(new ButtonWidget(6, 6, 60, 20, I18n.translate("text.rei.credits"), widget -> MinecraftClient.getInstance().openScreen(new CreditsScreen(MinecraftClient.getInstance().currentScreen))));
+                        super.init();
+                    }
+                };
+            }
+        };
         builder.addCategory("text.rei.config.general").addOption(new BooleanListEntry("text.rei.config.cheating", RoughlyEnoughItemsCore.getConfigManager().getConfig().cheating, "text.cloth-config.reset_value", () -> false, bool -> RoughlyEnoughItemsCore.getConfigManager().getConfig().cheating = bool));
         ConfigScreenBuilder.CategoryBuilder appearance = builder.addCategory("text.rei.config.appearance");
         appearance.addOption(new BooleanListEntry("text.rei.config.side_search_box", RoughlyEnoughItemsCore.getConfigManager().getConfig().sideSearchField, "text.cloth-config.reset_value", () -> false, bool -> RoughlyEnoughItemsCore.getConfigManager().getConfig().sideSearchField = bool));
-        appearance.addOption(new ItemListOrderingEntry("text.rei.config.list_ordering", new Pair<>(RoughlyEnoughItemsCore.getConfigManager().getConfig().itemListOrdering, RoughlyEnoughItemsCore.getConfigManager().getConfig().isAscending)));
+        appearance.addOption(new EnumListEntry<ItemListOrderingConfig>("text.rei.config.list_ordering", ItemListOrderingConfig.class, ItemListOrderingConfig.from(RoughlyEnoughItemsCore.getConfigManager().getConfig().itemListOrdering, RoughlyEnoughItemsCore.getConfigManager().getConfig().isAscending), "text.cloth-config.reset_value", () -> ItemListOrderingConfig.REGISTRY_ASCENDING, config -> {
+            RoughlyEnoughItemsCore.getConfigManager().getConfig().itemListOrdering = config.getOrdering();
+            RoughlyEnoughItemsCore.getConfigManager().getConfig().isAscending = config.isAscending();
+        }));
         appearance.addOption(new BooleanListEntry("text.rei.config.item_list_position", RoughlyEnoughItemsCore.getConfigManager().getConfig().mirrorItemPanel, "text.cloth-config.reset_value", () -> false, bool -> RoughlyEnoughItemsCore.getConfigManager().getConfig().mirrorItemPanel = bool) {
             @Override
             public String getYesNoText(boolean bool) {
@@ -49,4 +76,10 @@ public class ClothScreenRegistry {
         MinecraftClient.getInstance().openScreen(builder.build());
     }
     
+    private static class SelfSavedConfig extends ClothConfigScreen.Builder.SavedConfig {
+        protected SelfSavedConfig(Map<String, List<Pair<String, Object>>> map) {
+            super(map);
+        }
+    }
+    
 }

BIN
src/main/resources/assets/roughlyenoughitems/textures/gui/display.png


BIN
src/main/resources/assets/roughlyenoughitems/textures/gui/recipecontainer.png