Browse Source

Better stuff

Unknown 6 years ago
parent
commit
3aac033fd4
36 changed files with 975 additions and 232 deletions
  1. 21 1
      README.md
  2. 32 17
      src/main/java/me/shedaniel/ClientListener.java
  3. 6 2
      src/main/java/me/shedaniel/api/IDisplayCategory.java
  4. 1 1
      src/main/java/me/shedaniel/api/IREIPlugin.java
  5. 2 2
      src/main/java/me/shedaniel/gui/Drawable.java
  6. 88 48
      src/main/java/me/shedaniel/gui/GuiItemList.java
  7. 48 36
      src/main/java/me/shedaniel/gui/REIRenderHelper.java
  8. 80 26
      src/main/java/me/shedaniel/gui/RecipeGui.java
  9. 35 0
      src/main/java/me/shedaniel/gui/SearchArgument.java
  10. 2 2
      src/main/java/me/shedaniel/gui/widget/Button.java
  11. 19 0
      src/main/java/me/shedaniel/gui/widget/Control.java
  12. 20 19
      src/main/java/me/shedaniel/gui/widget/REISlot.java
  13. 101 0
      src/main/java/me/shedaniel/gui/widget/Tab.java
  14. 5 5
      src/main/java/me/shedaniel/gui/widget/TextBox.java
  15. 4 0
      src/main/java/me/shedaniel/gui/widget/WidgetArrow.java
  16. 14 14
      src/main/java/me/shedaniel/impl/REIRecipeManager.java
  17. 1 1
      src/main/java/me/shedaniel/listenerdefinitions/MinecraftResize.java
  18. 8 0
      src/main/java/me/shedaniel/listenerdefinitions/PotionCraftingAdder.java
  19. 8 8
      src/main/java/me/shedaniel/listeners/DrawContainerListener.java
  20. 1 2
      src/main/java/me/shedaniel/listeners/InitListener.java
  21. 3 3
      src/main/java/me/shedaniel/listeners/ResizeListener.java
  22. 1 0
      src/main/java/me/shedaniel/mixins/MixinGuiContainerCreative.java
  23. 7 2
      src/main/java/me/shedaniel/mixins/MixinMinecraftResize.java
  24. 21 0
      src/main/java/me/shedaniel/mixins/MixinPotionBrewing.java
  25. 33 0
      src/main/java/me/shedaniel/plugin/RandomRecipe.java
  26. 72 0
      src/main/java/me/shedaniel/plugin/TestRandomCategory.java
  27. 51 13
      src/main/java/me/shedaniel/plugin/VanillaPlugin.java
  28. 15 6
      src/main/java/me/shedaniel/plugin/crafting/VanillaCraftingCategory.java
  29. 15 9
      src/main/java/me/shedaniel/plugin/furnace/VanillaFurnaceCategory.java
  30. 189 0
      src/main/java/me/shedaniel/plugin/potion/VanillaPotionCategory.java
  31. 48 0
      src/main/java/me/shedaniel/plugin/potion/VanillaPotionRecipe.java
  32. 14 6
      src/main/resources/assets/almostenoughitems/lang/en_us.json
  33. 6 6
      src/main/resources/assets/almostenoughitems/lang/fr_fr.json
  34. 2 1
      src/main/resources/mixins.roughlyenoughitems.json
  35. 1 1
      src/main/resources/pack.mcmeta
  36. 1 1
      src/main/resources/riftmod.json

+ 21 - 1
README.md

@@ -1,2 +1,22 @@
 # RoughlyEnoughItems
 # RoughlyEnoughItems
-A project to make almostenoughitems to look like jei
+A project to make (AEI) [https://minecraft.curseforge.com/projects/almost-enough-items] to look like JEI
+
+**Only supports 1.13.2 for now**
+
+### Features added from JEI
+- Better Searching
+  - Accepts Searching by Tooltip (Prefix: #)
+  - Accepts Excluding (Prefix: -)
+  - Accepts Multiple Searching (Use: |)
+  - Example: `-@randommod stone` will search items not from randommod named stone
+- Fixed Creative Gui
+- Added Useless Tabs lol _(I will make them useful in the future)_
+- All Enchanting Books
+- Potion Recipe (Experimental)
+- Fixed Scrolling (by a bit)
+- One page now shows 2 recipe
+
+### Features that I will work on in the future
+- Hide Gui with Control / Command + O
+
+I know this is still buggy and basic but I am trying to make this better :)

+ 32 - 17
src/main/java/me/shedaniel/ClientListener.java

@@ -1,12 +1,14 @@
 package me.shedaniel;
 package me.shedaniel;
 
 
-import me.shedaniel.api.IAEIPlugin;
-import me.shedaniel.gui.AEIRenderHelper;
-import me.shedaniel.impl.AEIRecipeManager;
+import me.shedaniel.api.IREIPlugin;
+import me.shedaniel.gui.REIRenderHelper;
+import me.shedaniel.impl.REIRecipeManager;
 import me.shedaniel.library.KeyBindManager;
 import me.shedaniel.library.KeyBindManager;
 import me.shedaniel.listenerdefinitions.DoneLoading;
 import me.shedaniel.listenerdefinitions.DoneLoading;
 import me.shedaniel.listenerdefinitions.RecipeLoadListener;
 import me.shedaniel.listenerdefinitions.RecipeLoadListener;
 import net.minecraft.client.settings.KeyBinding;
 import net.minecraft.client.settings.KeyBinding;
+import net.minecraft.enchantment.Enchantment;
+import net.minecraft.enchantment.EnchantmentHelper;
 import net.minecraft.init.Items;
 import net.minecraft.init.Items;
 import net.minecraft.item.Item;
 import net.minecraft.item.Item;
 import net.minecraft.item.ItemGroup;
 import net.minecraft.item.ItemGroup;
@@ -16,34 +18,43 @@ import net.minecraft.util.registry.IRegistry;
 
 
 import java.awt.event.KeyEvent;
 import java.awt.event.KeyEvent;
 import java.util.ArrayList;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.List;
+import java.util.Map;
 
 
 public class ClientListener implements DoneLoading, RecipeLoadListener {
 public class ClientListener implements DoneLoading, RecipeLoadListener {
     public static KeyBinding recipeKeybind;
     public static KeyBinding recipeKeybind;
     public static KeyBinding hideKeybind;
     public static KeyBinding hideKeybind;
     public static KeyBinding useKeybind;
     public static KeyBinding useKeybind;
     
     
-    private List<IAEIPlugin> plugins;
+    private List<IREIPlugin> plugins;
     public static List<ItemStack> stackList;
     public static List<ItemStack> stackList;
     
     
     @Override
     @Override
     public void onDoneLoading() {
     public void onDoneLoading() {
-        
         plugins = new ArrayList<>();
         plugins = new ArrayList<>();
         stackList = new ArrayList<>();
         stackList = new ArrayList<>();
         
         
-        recipeKeybind = KeyBindManager.createKeybinding("key.aei.recipe", KeyEvent.VK_R, "key.aei.category", AEIRenderHelper::recipeKeybind);
-        hideKeybind = KeyBindManager.createKeybinding("key.aei.hide", KeyEvent.VK_O, "key.aei.category", AEIRenderHelper::hideKeybind);
-        useKeybind = KeyBindManager.createKeybinding("key.aei.use", KeyEvent.VK_U, "key.aei.category", AEIRenderHelper::useKeybind);
+        recipeKeybind = KeyBindManager.createKeybinding("key.rei.recipe", KeyEvent.VK_R, "key.rei.category", REIRenderHelper::recipeKeybind);
+        hideKeybind = KeyBindManager.createKeybinding("key.rei.hide", KeyEvent.VK_O, "key.rei.category", REIRenderHelper::hideKeybind);
+        useKeybind = KeyBindManager.createKeybinding("key.rei.use", KeyEvent.VK_U, "key.rei.category", REIRenderHelper::useKeybind);
         
         
         buildItemList();
         buildItemList();
     }
     }
     
     
     private void buildItemList() {
     private void buildItemList() {
-        if (!IRegistry.ITEM.isEmpty()) {
-            IRegistry.ITEM.forEach(item -> processItem((Item) item));
-        }
-        
+        if (!IRegistry.ITEM.isEmpty())
+            IRegistry.ITEM.forEach(this::processItem);
+        if (!IRegistry.ENCHANTMENT.isEmpty())
+            IRegistry.ENCHANTMENT.forEach(enchantment -> {
+                for(int i = enchantment.getMinLevel(); i < enchantment.getMaxLevel(); i++) {
+                    ItemStack stack = new ItemStack(Items.ENCHANTED_BOOK);
+                    Map<Enchantment, Integer> map = new HashMap<>();
+                    map.put(enchantment, i);
+                    EnchantmentHelper.setEnchantments(map, stack);
+                    processItemStack(stack);
+                }
+            });
     }
     }
     
     
     private void processItem(Item item) {
     private void processItem(Item item) {
@@ -52,15 +63,19 @@ public class ClientListener implements DoneLoading, RecipeLoadListener {
             item.fillItemGroup(item.getGroup(), items);
             item.fillItemGroup(item.getGroup(), items);
             items.forEach(stackList::add);
             items.forEach(stackList::add);
         } catch (NullPointerException e) {
         } catch (NullPointerException e) {
-            if (item == Items.ENCHANTED_BOOK) {
-                item.fillItemGroup(ItemGroup.TOOLS, items);
-                items.forEach(stackList::add);
-            }
+//            if (item == Items.ENCHANTED_BOOK) {
+//                item.fillItemGroup(ItemGroup.TOOLS, items);
+//                items.forEach(stackList::add);
+//            }
         }
         }
     }
     }
     
     
+    private void processItemStack(ItemStack item) {
+        stackList.add(item);
+    }
+    
     @Override
     @Override
     public void recipesLoaded(net.minecraft.item.crafting.RecipeManager recipeManager) {
     public void recipesLoaded(net.minecraft.item.crafting.RecipeManager recipeManager) {
-        AEIRecipeManager.instance().RecipesLoaded(recipeManager);
+        REIRecipeManager.instance().RecipesLoaded(recipeManager);
     }
     }
 }
 }

+ 6 - 2
src/main/java/me/shedaniel/api/IDisplayCategory.java

@@ -1,7 +1,9 @@
 package me.shedaniel.api;
 package me.shedaniel.api;
 
 
-import me.shedaniel.gui.widget.AEISlot;
 import me.shedaniel.gui.widget.Control;
 import me.shedaniel.gui.widget.Control;
+import me.shedaniel.gui.widget.REISlot;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
 
 
 import java.util.List;
 import java.util.List;
 
 
@@ -17,11 +19,13 @@ public interface IDisplayCategory<T extends IRecipe> {
     
     
     public void resetRecipes();
     public void resetRecipes();
     
     
-    public List<AEISlot> setupDisplay(int number);
+    public List<REISlot> setupDisplay(int number);
     
     
     public boolean canDisplay(T recipe);
     public boolean canDisplay(T recipe);
     
     
     public void drawExtras();
     public void drawExtras();
     
     
     public void addWidget(List<Control> controls, int number);
     public void addWidget(List<Control> controls, int number);
+    
+    public ItemStack getCategoryIcon();
 }
 }

+ 1 - 1
src/main/java/me/shedaniel/api/IAEIPlugin.java → src/main/java/me/shedaniel/api/IREIPlugin.java

@@ -3,7 +3,7 @@ package me.shedaniel.api;
 /**
 /**
  * Created by James on 7/27/2018.
  * Created by James on 7/27/2018.
  */
  */
-public interface IAEIPlugin {
+public interface IREIPlugin {
     
     
     public void register();
     public void register();
 }
 }

+ 2 - 2
src/main/java/me/shedaniel/gui/Drawable.java

@@ -22,10 +22,10 @@ public abstract class Drawable implements IDrawable {
     public abstract void draw();
     public abstract void draw();
     
     
     public boolean isHighlighted() {
     public boolean isHighlighted() {
-        Point mousePoint = AEIRenderHelper.getMouseLoc();
+        Point mousePoint = REIRenderHelper.getMouseLoc();
         if (rect.contains(mousePoint.x, mousePoint.y)) {
         if (rect.contains(mousePoint.x, mousePoint.y)) {
             if (this instanceof Control)
             if (this instanceof Control)
-                AEIRenderHelper.aeiGui.setLastHovered((Control) this);
+                REIRenderHelper.reiGui.setLastHovered((Control) this);
             return true;
             return true;
         }
         }
         return false;
         return false;

+ 88 - 48
src/main/java/me/shedaniel/gui/GuiItemList.java

@@ -1,9 +1,9 @@
 package me.shedaniel.gui;
 package me.shedaniel.gui;
 
 
 import me.shedaniel.ClientListener;
 import me.shedaniel.ClientListener;
-import me.shedaniel.gui.widget.AEISlot;
 import me.shedaniel.gui.widget.Button;
 import me.shedaniel.gui.widget.Button;
 import me.shedaniel.gui.widget.Control;
 import me.shedaniel.gui.widget.Control;
+import me.shedaniel.gui.widget.REISlot;
 import me.shedaniel.gui.widget.TextBox;
 import me.shedaniel.gui.widget.TextBox;
 import me.shedaniel.listenerdefinitions.IMixinGuiContainer;
 import me.shedaniel.listenerdefinitions.IMixinGuiContainer;
 import net.minecraft.client.MainWindow;
 import net.minecraft.client.MainWindow;
@@ -19,13 +19,17 @@ import net.minecraft.util.text.TextComponentTranslation;
 
 
 import java.awt.*;
 import java.awt.*;
 import java.util.ArrayList;
 import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 
 public class GuiItemList extends Drawable {
 public class GuiItemList extends Drawable {
     
     
     public static final int FOOTERSIZE = 44;
     public static final int FOOTERSIZE = 44;
     private GuiContainer overlayedGui;
     private GuiContainer overlayedGui;
     private static int page = 0;
     private static int page = 0;
-    private ArrayList<AEISlot> displaySlots;
+    private ArrayList<REISlot> displaySlots;
     protected ArrayList<Control> controls;
     protected ArrayList<Control> controls;
     private boolean needsResize = false;
     private boolean needsResize = false;
     Button buttonLeft;
     Button buttonLeft;
@@ -60,14 +64,14 @@ public class GuiItemList extends Drawable {
     }
     }
     
     
     private static Rectangle calculateRect(GuiContainer overlayedGui) {
     private static Rectangle calculateRect(GuiContainer overlayedGui) {
-        MainWindow res = AEIRenderHelper.getResolution();
+        MainWindow res = REIRenderHelper.getResolution();
         int startX = (((IMixinGuiContainer) overlayedGui).getGuiLeft() + ((IMixinGuiContainer) overlayedGui).getXSize()) + 10;
         int startX = (((IMixinGuiContainer) overlayedGui).getGuiLeft() + ((IMixinGuiContainer) overlayedGui).getXSize()) + 10;
         int width = res.getScaledWidth() - startX;
         int width = res.getScaledWidth() - startX;
         return new Rectangle(startX, 0, width, res.getScaledHeight());
         return new Rectangle(startX, 0, width, res.getScaledHeight());
     }
     }
     
     
     protected void resize() {
     protected void resize() {
-        MainWindow res = AEIRenderHelper.getResolution();
+        MainWindow res = REIRenderHelper.getResolution();
         
         
         if (overlayedGui != Minecraft.getInstance().currentScreen) {
         if (overlayedGui != Minecraft.getInstance().currentScreen) {
             if (Minecraft.getInstance().currentScreen instanceof GuiContainer) {
             if (Minecraft.getInstance().currentScreen instanceof GuiContainer) {
@@ -117,25 +121,42 @@ public class GuiItemList extends Drawable {
     }
     }
     
     
     private void calculateSlots() {
     private void calculateSlots() {
-        int x = rect.x;
-        int y = rect.y + 20;
-        MainWindow res = AEIRenderHelper.getResolution();
+        int x = rect.x, y = rect.y + 20;
+        MainWindow res = REIRenderHelper.getResolution();
         displaySlots.clear();
         displaySlots.clear();
-        int xOffset = 4;
-        int yOffset = 4;
+        int xOffset = 0, yOffset = 0, row = 0, perRow = 0, currentX = 0, currentY = 0;
         while (true) {
         while (true) {
-            AEISlot slot = new AEISlot(x + xOffset, y + yOffset);
-            slot.setCheatable(true);
             xOffset += 18;
             xOffset += 18;
-            displaySlots.add(slot);
-            if (x + xOffset + 18 > res.getScaledWidth()) {
-                xOffset = 4;
+            if (row == 0)
+                perRow++;
+            if (x + xOffset + 22 > res.getScaledWidth()) {
+                xOffset = 0;
                 yOffset += 18;
                 yOffset += 18;
+                row++;
             }
             }
             if (y + yOffset + 9 + FOOTERSIZE > rect.height) {
             if (y + yOffset + 9 + FOOTERSIZE > rect.height) {
+                xOffset = 0;
+                yOffset = 0;
                 break;
                 break;
             }
             }
         }
         }
+        x += (rect.width - perRow * 18) / 2;
+        y += (rect.height - FOOTERSIZE - 2 - row * 18) / 2;
+        while (true) {
+            REISlot slot = new REISlot(x + xOffset, y + yOffset);
+            slot.setCheatable(true);
+            xOffset += 18;
+            currentX++;
+            displaySlots.add(slot);
+            if (currentX >= perRow) {
+                xOffset = 0;
+                yOffset += 18;
+                currentX = 0;
+                currentY++;
+            }
+            if (currentY >= row)
+                break;
+        }
     }
     }
     
     
     @Override
     @Override
@@ -196,52 +217,70 @@ public class GuiItemList extends Drawable {
     
     
     private String getCheatModeText() {
     private String getCheatModeText() {
         if (cheatMode) {
         if (cheatMode) {
-            TextComponentTranslation cheat = new TextComponentTranslation("text.aei.cheat", new Object[]{null});
+            TextComponentTranslation cheat = new TextComponentTranslation("text.rei.cheat", new Object[]{null});
             return cheat.getFormattedText();
             return cheat.getFormattedText();
         }
         }
-        TextComponentTranslation noCheat = new TextComponentTranslation("text.aei.nocheat", new Object[]{null});
+        TextComponentTranslation noCheat = new TextComponentTranslation("text.rei.nocheat", new Object[]{null});
         return noCheat.getFormattedText();
         return noCheat.getFormattedText();
     }
     }
     
     
     protected void updateView() {
     protected void updateView() {
         String searchText = searchBox.getText();
         String searchText = searchBox.getText();
-        String modText = null;
-        if (searchText.contains("@")) {
-            int nextBreak = searchText.indexOf(' ', searchText.indexOf('@'));
-            if (nextBreak == 0 || nextBreak == -1)
-                nextBreak = searchText.length();
-            modText = searchText.substring(searchText.indexOf('@'), nextBreak);
-            searchText = searchText.replace(modText, "").trim();
-            modText = modText.replace("@", "").toLowerCase();
-        }
-        
         view.clear();
         view.clear();
-        if (searchText.equals("") || searchText == null) {
-            for(ItemStack stack : ClientListener.stackList) {
-                if (modText != null) {
-                    if (getMod(stack).contains(modText)) {
-                        view.add(stack);
-                    }
-                } else {
-                    view.add(stack);
-                }
-            }
-        } else {
-            for(ItemStack stack : ClientListener.stackList) {
-                if (stack.getItem().getName().getString().toLowerCase().contains(searchText))
-                    if (modText != null) {
-                        if (getMod(stack).contains(modText)) {
-                            view.add(stack);
-                        }
-                    } else {
-                        view.add(stack);
-                    }
-            }
-        }
+        List<ItemStack> stacks = new ArrayList<>();
+        Arrays.stream(searchText.split("\\|")).forEachOrdered(s -> {
+            List<SearchArgument> arguments = new ArrayList<>();
+            while (s.startsWith(" ")) s = s.substring(1);
+            while (s.endsWith(" ")) s = s.substring(0, s.length());
+            if (s.startsWith("@-") || s.startsWith("-@"))
+                arguments.add(new SearchArgument(SearchArgument.ArgumentType.MOD, s.substring(2), false));
+            else if (s.startsWith("@"))
+                arguments.add(new SearchArgument(SearchArgument.ArgumentType.MOD, s.substring(1), true));
+            else if (s.startsWith("#-") || s.startsWith("-#"))
+                arguments.add(new SearchArgument(SearchArgument.ArgumentType.TOOLTIP, s.substring(2), false));
+            else if (s.startsWith("#"))
+                arguments.add(new SearchArgument(SearchArgument.ArgumentType.TOOLTIP, s.substring(1), true));
+            else if (s.startsWith("-"))
+                arguments.add(new SearchArgument(SearchArgument.ArgumentType.TEXT, s.substring(1), false));
+            else
+                arguments.add(new SearchArgument(SearchArgument.ArgumentType.TEXT, s, true));
+            ClientListener.stackList.stream().filter(itemStack -> filterItem(itemStack, arguments)).forEachOrdered(stacks::add);
+        });
+        view.addAll(stacks.stream().distinct().collect(Collectors.toList()));
         page = 0;
         page = 0;
         fillSlots();
         fillSlots();
     }
     }
     
     
+    private boolean filterItem(ItemStack itemStack, List<SearchArgument> arguments) {
+        String mod = getMod(itemStack);
+        List<String> toolTipsList = REIRenderHelper.getOverlayedGui().getItemToolTip(itemStack);
+        String toolTipsMixed = toolTipsList.stream().skip(1).collect(Collectors.joining()).toLowerCase();
+        String allMixed = Stream.of(itemStack.getDisplayName().getString(), toolTipsMixed).collect(Collectors.joining()).toLowerCase();
+        for(SearchArgument searchArgument : arguments.stream().filter(searchArgument -> !searchArgument.isInclude()).collect(Collectors.toList())) {
+            if (searchArgument.getArgumentType().equals(SearchArgument.ArgumentType.MOD))
+                if (mod.toLowerCase().contains(searchArgument.getText().toLowerCase()))
+                    return false;
+            if (searchArgument.getArgumentType().equals(SearchArgument.ArgumentType.TOOLTIP))
+                if (toolTipsMixed.contains(searchArgument.getText().toLowerCase()))
+                    return false;
+            if (searchArgument.getArgumentType().equals(SearchArgument.ArgumentType.TEXT))
+                if (allMixed.contains(searchArgument.getText().toLowerCase()))
+                    return false;
+        }
+        for(SearchArgument searchArgument : arguments.stream().filter(SearchArgument::isInclude).collect(Collectors.toList())) {
+            if (searchArgument.getArgumentType().equals(SearchArgument.ArgumentType.MOD))
+                if (!mod.toLowerCase().contains(searchArgument.getText().toLowerCase()))
+                    return false;
+            if (searchArgument.getArgumentType().equals(SearchArgument.ArgumentType.TOOLTIP))
+                if (!toolTipsMixed.contains(searchArgument.getText().toLowerCase()))
+                    return false;
+            if (searchArgument.getArgumentType().equals(SearchArgument.ArgumentType.TEXT))
+                if (!allMixed.contains(searchArgument.getText().toLowerCase()))
+                    return false;
+        }
+        return true;
+    }
+    
     public void tick() {
     public void tick() {
         controls.forEach(f -> f.tick());
         controls.forEach(f -> f.tick());
     }
     }
@@ -261,4 +300,5 @@ public class GuiItemList extends Drawable {
         }
         }
         return "";
         return "";
     }
     }
+    
 }
 }

+ 48 - 36
src/main/java/me/shedaniel/gui/AEIRenderHelper.java → src/main/java/me/shedaniel/gui/REIRenderHelper.java

@@ -1,9 +1,9 @@
 package me.shedaniel.gui;
 package me.shedaniel.gui;
 
 
-import me.shedaniel.gui.widget.AEISlot;
 import me.shedaniel.gui.widget.Control;
 import me.shedaniel.gui.widget.Control;
 import me.shedaniel.gui.widget.IFocusable;
 import me.shedaniel.gui.widget.IFocusable;
-import me.shedaniel.impl.AEIRecipeManager;
+import me.shedaniel.gui.widget.REISlot;
+import me.shedaniel.impl.REIRecipeManager;
 import me.shedaniel.library.KeyBindManager;
 import me.shedaniel.library.KeyBindManager;
 import me.shedaniel.listenerdefinitions.IMixinGuiContainer;
 import me.shedaniel.listenerdefinitions.IMixinGuiContainer;
 import net.minecraft.client.MainWindow;
 import net.minecraft.client.MainWindow;
@@ -13,6 +13,7 @@ import net.minecraft.client.gui.inventory.GuiContainer;
 import net.minecraft.client.renderer.GlStateManager;
 import net.minecraft.client.renderer.GlStateManager;
 import net.minecraft.client.renderer.ItemRenderer;
 import net.minecraft.client.renderer.ItemRenderer;
 import net.minecraft.item.ItemStack;
 import net.minecraft.item.ItemStack;
+import org.dimdev.riftloader.RiftLoader;
 
 
 import java.awt.*;
 import java.awt.*;
 import java.util.ArrayList;
 import java.util.ArrayList;
@@ -23,9 +24,9 @@ import java.util.Optional;
 /**
 /**
  * Created by James on 7/28/2018.
  * Created by James on 7/28/2018.
  */
  */
-public class AEIRenderHelper {
+public class REIRenderHelper {
     static Point mouseLoc;
     static Point mouseLoc;
-    static public GuiItemList aeiGui;
+    static public GuiItemList reiGui;
     static GuiContainer overlayedGui;
     static GuiContainer overlayedGui;
     static List<TooltipData> tooltipsToRender = new ArrayList<>();
     static List<TooltipData> tooltipsToRender = new ArrayList<>();
     
     
@@ -40,25 +41,36 @@ public class AEIRenderHelper {
     }
     }
     
     
     public static MainWindow getResolution() {
     public static MainWindow getResolution() {
-        
         return Minecraft.getInstance().mainWindow;
         return Minecraft.getInstance().mainWindow;
     }
     }
     
     
-    public static void drawAEI(GuiContainer overlayedGui) {
-        AEIRenderHelper.overlayedGui = overlayedGui;
-        if (aeiGui == null) {
-            aeiGui = new GuiItemList(overlayedGui);
+    public static String tryGettingModName(String modid) {
+        if (modid.equalsIgnoreCase("minecraft"))
+            return "Minecraft";
+        return RiftLoader.instance.getMods().stream()
+                .filter(modInfo -> modInfo.id.equals(modid) || (modInfo.name != null && modInfo.name.equals(modid)))
+                .findFirst().map(modInfo -> {
+                    if (modInfo.name != null)
+                        return modInfo.name;
+                    return modid;
+                }).orElse(modid);
+    }
+    
+    public static void drawREI(GuiContainer overlayedGui) {
+        REIRenderHelper.overlayedGui = overlayedGui;
+        if (reiGui == null) {
+            reiGui = new GuiItemList(overlayedGui);
         }
         }
-        aeiGui.draw();
+        reiGui.draw();
         renderTooltips();
         renderTooltips();
     }
     }
     
     
-    public static void resize() {
-        if (aeiGui != null) {
-            aeiGui.resize();
+    public static void resize(int scaledWidth, int scaledHeight) {
+        if (reiGui != null) {
+            reiGui.resize();
         }
         }
         if (overlayedGui instanceof RecipeGui) {
         if (overlayedGui instanceof RecipeGui) {
-            overlayedGui.onResize(Minecraft.getInstance(), 0, 0);
+            overlayedGui.onResize(Minecraft.getInstance(), scaledWidth, scaledHeight);
         }
         }
     }
     }
     
     
@@ -94,8 +106,8 @@ public class AEIRenderHelper {
     }
     }
     
     
     public static boolean mouseClick(int x, int y, int button) {
     public static boolean mouseClick(int x, int y, int button) {
-        if (aeiGui.visible) {
-            for(Control control : aeiGui.controls) {
+        if (reiGui.visible) {
+            for(Control control : reiGui.controls) {
                 if (control.isHighlighted() && control.isEnabled() && control.onClick != null) {
                 if (control.isHighlighted() && control.isEnabled() && control.onClick != null) {
                     if (focusedControl != null)
                     if (focusedControl != null)
                         focusedControl.setFocused(false);
                         focusedControl.setFocused(false);
@@ -164,12 +176,12 @@ public class AEIRenderHelper {
     }
     }
     
     
     public static boolean mouseScrolled(double direction) {
     public static boolean mouseScrolled(double direction) {
-        if (!aeiGui.visible)
+        if (!reiGui.visible)
             return false;
             return false;
-        if (direction > 0 && aeiGui.buttonLeft.isEnabled())
-            aeiGui.buttonLeft.onClick.apply(0);
-        else if (direction < 0 && aeiGui.buttonRight.isEnabled())
-            aeiGui.buttonRight.onClick.apply(0);
+        if (direction > 0 && reiGui.buttonLeft.isEnabled())
+            reiGui.buttonLeft.onClick.apply(0);
+        else if (direction < 0 && reiGui.buttonRight.isEnabled())
+            reiGui.buttonRight.onClick.apply(0);
         return true;
         return true;
     }
     }
     
     
@@ -187,26 +199,26 @@ public class AEIRenderHelper {
     }
     }
     
     
     public static void updateSearch() {
     public static void updateSearch() {
-        aeiGui.updateView();
+        reiGui.updateView();
     }
     }
     
     
     public static void tick() {
     public static void tick() {
-        if (aeiGui != null && Minecraft.getInstance().currentScreen == overlayedGui)
-            aeiGui.tick();
+        if (reiGui != null && Minecraft.getInstance().currentScreen == overlayedGui)
+            reiGui.tick();
     }
     }
     
     
     public static void recipeKeybind() {
     public static void recipeKeybind() {
         if (!(Minecraft.getInstance().currentScreen instanceof GuiContainer))
         if (!(Minecraft.getInstance().currentScreen instanceof GuiContainer))
             return;
             return;
-        Control control = aeiGui.getLastHovered();
-        if (control != null && control.isHighlighted() && control instanceof AEISlot) {
-            AEISlot slot = (AEISlot) control;
-            AEIRecipeManager.instance().displayRecipesFor(slot.getStack());
+        Control control = reiGui.getLastHovered();
+        if (control != null && control.isHighlighted() && control instanceof REISlot) {
+            REISlot slot = (REISlot) control;
+            REIRecipeManager.instance().displayRecipesFor(slot.getStack());
             return;
             return;
         }
         }
         if (((IMixinGuiContainer) overlayedGui).getHoveredSlot() != null) {
         if (((IMixinGuiContainer) overlayedGui).getHoveredSlot() != null) {
             ItemStack stack = ((IMixinGuiContainer) overlayedGui).getHoveredSlot().getStack();
             ItemStack stack = ((IMixinGuiContainer) overlayedGui).getHoveredSlot().getStack();
-            AEIRecipeManager.instance().displayRecipesFor(stack);
+            REIRecipeManager.instance().displayRecipesFor(stack);
         }
         }
         
         
     }
     }
@@ -214,22 +226,22 @@ public class AEIRenderHelper {
     public static void useKeybind() {
     public static void useKeybind() {
         if (!(Minecraft.getInstance().currentScreen instanceof GuiContainer))
         if (!(Minecraft.getInstance().currentScreen instanceof GuiContainer))
             return;
             return;
-        Control control = aeiGui.getLastHovered();
-        if (control != null && control.isHighlighted() && control instanceof AEISlot) {
-            AEISlot slot = (AEISlot) control;
-            AEIRecipeManager.instance().displayUsesFor(slot.getStack());
+        Control control = reiGui.getLastHovered();
+        if (control != null && control.isHighlighted() && control instanceof REISlot) {
+            REISlot slot = (REISlot) control;
+            REIRecipeManager.instance().displayUsesFor(slot.getStack());
             return;
             return;
         }
         }
         if (((IMixinGuiContainer) overlayedGui).getHoveredSlot() != null) {
         if (((IMixinGuiContainer) overlayedGui).getHoveredSlot() != null) {
             ItemStack stack = ((IMixinGuiContainer) overlayedGui).getHoveredSlot().getStack();
             ItemStack stack = ((IMixinGuiContainer) overlayedGui).getHoveredSlot().getStack();
-            AEIRecipeManager.instance().displayUsesFor(stack);
+            REIRecipeManager.instance().displayUsesFor(stack);
         }
         }
         
         
     }
     }
     
     
     public static void hideKeybind() {
     public static void hideKeybind() {
-        if (Minecraft.getInstance().currentScreen == overlayedGui && aeiGui != null) {
-            aeiGui.visible = !aeiGui.visible;
+        if (Minecraft.getInstance().currentScreen == overlayedGui && reiGui != null) {
+            reiGui.visible = !reiGui.visible;
         }
         }
     }
     }
 }
 }

+ 80 - 26
src/main/java/me/shedaniel/gui/RecipeGui.java

@@ -2,14 +2,17 @@ package me.shedaniel.gui;
 
 
 import me.shedaniel.api.IDisplayCategory;
 import me.shedaniel.api.IDisplayCategory;
 import me.shedaniel.api.IRecipe;
 import me.shedaniel.api.IRecipe;
-import me.shedaniel.gui.widget.AEISlot;
 import me.shedaniel.gui.widget.Button;
 import me.shedaniel.gui.widget.Button;
 import me.shedaniel.gui.widget.Control;
 import me.shedaniel.gui.widget.Control;
+import me.shedaniel.gui.widget.REISlot;
+import me.shedaniel.gui.widget.Tab;
+import me.shedaniel.impl.REIRecipeManager;
 import net.minecraft.client.MainWindow;
 import net.minecraft.client.MainWindow;
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.GuiScreen;
 import net.minecraft.client.gui.GuiScreen;
 import net.minecraft.client.gui.inventory.GuiContainer;
 import net.minecraft.client.gui.inventory.GuiContainer;
 import net.minecraft.client.renderer.GlStateManager;
 import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.client.renderer.RenderHelper;
 import net.minecraft.inventory.Container;
 import net.minecraft.inventory.Container;
 import net.minecraft.util.ResourceLocation;
 import net.minecraft.util.ResourceLocation;
 import net.minecraft.util.math.MathHelper;
 import net.minecraft.util.math.MathHelper;
@@ -20,6 +23,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map;
 
 
 public class RecipeGui extends GuiContainer {
 public class RecipeGui extends GuiContainer {
+    
+    private static final ResourceLocation CREATIVE_INVENTORY_TABS = new ResourceLocation("textures/gui/container/creative_inventory/tabs.png");
     private static final ResourceLocation CHEST_GUI_TEXTURE = new ResourceLocation("almostenoughitems", "textures/gui/recipecontainer.png");
     private static final ResourceLocation CHEST_GUI_TEXTURE = new ResourceLocation("almostenoughitems", "textures/gui/recipecontainer.png");
     private final MainWindow mainWindow;
     private final MainWindow mainWindow;
     private final Container container;
     private final Container container;
@@ -28,12 +33,15 @@ public class RecipeGui extends GuiContainer {
     private int guiWidth = 176;
     private int guiWidth = 176;
     private int guiHeight = 222;
     private int guiHeight = 222;
     ArrayList<IDisplayCategory> categories = new ArrayList<>();
     ArrayList<IDisplayCategory> categories = new ArrayList<>();
-    private int categoryPointer = 0;
+    private int categoryTabPage = 0;
+    private IDisplayCategory selectedCategory;
     private int recipePointer = 0;
     private int recipePointer = 0;
-    private List<AEISlot> slots;
+    private List<REISlot> slots;
     private int cycleCounter = 0;
     private int cycleCounter = 0;
     private int[] itemPointer;
     private int[] itemPointer;
     List<Control> controls = new LinkedList<>();
     List<Control> controls = new LinkedList<>();
+    private List<Tab> tabs;
+    private boolean tabsEnabled = false;
     
     
     public RecipeGui(Container p_i1072_1_, GuiScreen prevScreen, Map<IDisplayCategory, List<IRecipe>> recipes) {
     public RecipeGui(Container p_i1072_1_, GuiScreen prevScreen, Map<IDisplayCategory, List<IRecipe>> recipes) {
         super(new RecipeContainer());
         super(new RecipeContainer());
@@ -49,7 +57,17 @@ public class RecipeGui extends GuiContainer {
     }
     }
     
     
     private void setupCategories() {
     private void setupCategories() {
-        categories.addAll(recipes.keySet());
+        for(IDisplayCategory adapter : REIRecipeManager.instance().getDisplayAdapters())
+            if (recipes.containsKey(adapter))
+                categories.add(adapter);
+        selectedCategory = categories.get(0);
+        categoryTabPage = 0;
+        tabs = new ArrayList<>();
+        for(int i = 0; i < 6; i++)
+            tabs.add(new Tab(i, 0, 0, 0, 28, 32));
+        tabs.forEach(tab -> tab.setOnClick(i -> {
+            return onClickTab(tab.getId());
+        }));
         updateRecipe();
         updateRecipe();
     }
     }
     
     
@@ -58,7 +76,7 @@ public class RecipeGui extends GuiContainer {
     public void render(int mouseX, int mouseY, float partialTicks) {
     public void render(int mouseX, int mouseY, float partialTicks) {
         super.render(mouseX, mouseY, partialTicks);
         super.render(mouseX, mouseY, partialTicks);
         int y = (int) ((mainWindow.getScaledHeight() / 2 - this.guiHeight / 2));
         int y = (int) ((mainWindow.getScaledHeight() / 2 - this.guiHeight / 2));
-        drawCenteredString(this.fontRenderer, categories.get(categoryPointer).getDisplayName(), guiLeft + guiWidth / 2, y + 11, -1);
+        drawCenteredString(this.fontRenderer, selectedCategory.getDisplayName(), guiLeft + guiWidth / 2, y + 11, -1);
         drawCenteredString(this.fontRenderer, String.format("%d/%d", 1 + getCurrentPage(), getTotalPages()), guiLeft + guiWidth / 2, y + 34, -1);
         drawCenteredString(this.fontRenderer, String.format("%d/%d", 1 + getCurrentPage(), getTotalPages()), guiLeft + guiWidth / 2, y + 34, -1);
         controls.forEach(Control::draw);
         controls.forEach(Control::draw);
     }
     }
@@ -70,7 +88,7 @@ public class RecipeGui extends GuiContainer {
     @Override
     @Override
     public void tick() {
     public void tick() {
         super.tick();
         super.tick();
-        slots.forEach(AEISlot::tick);
+        slots.forEach(REISlot::tick);
         controls.forEach(Control::tick);
         controls.forEach(Control::tick);
     }
     }
     
     
@@ -82,6 +100,7 @@ public class RecipeGui extends GuiContainer {
     }
     }
     
     
     private void updateRecipe() {
     private void updateRecipe() {
+        int categoryPointer = categories.indexOf(selectedCategory);
         IRecipe recipe = recipes.get(categories.get(categoryPointer)).get(recipePointer);
         IRecipe recipe = recipes.get(categories.get(categoryPointer)).get(recipePointer);
         categories.get(categoryPointer).resetRecipes();
         categories.get(categoryPointer).resetRecipes();
         categories.get(categoryPointer).addRecipe(recipe);
         categories.get(categoryPointer).addRecipe(recipe);
@@ -95,9 +114,7 @@ public class RecipeGui extends GuiContainer {
         guiLeft = (int) ((mainWindow.getScaledWidth() / 2 - this.guiWidth / 2));
         guiLeft = (int) ((mainWindow.getScaledWidth() / 2 - this.guiWidth / 2));
         guiTop = (int) ((mainWindow.getScaledHeight() / 2 - this.guiHeight / 2));
         guiTop = (int) ((mainWindow.getScaledHeight() / 2 - this.guiHeight / 2));
         
         
-        for(AEISlot slot : slots) {
-            slot.move(guiLeft, guiTop);
-        }
+        slots.forEach(reiSlot -> reiSlot.move(guiLeft, guiTop));
         
         
         Button btnCategoryLeft = new Button(guiLeft + 10, guiTop + 5, 15, 20, "<");
         Button btnCategoryLeft = new Button(guiLeft + 10, guiTop + 5, 15, 20, "<");
         Button btnCategoryRight = new Button(guiLeft + guiWidth - 25, guiTop + 5, 15, 20, ">");
         Button btnCategoryRight = new Button(guiLeft + guiWidth - 25, guiTop + 5, 15, 20, ">");
@@ -114,7 +131,7 @@ public class RecipeGui extends GuiContainer {
         controls.clear();
         controls.clear();
         controls.add(btnCategoryLeft);
         controls.add(btnCategoryLeft);
         controls.add(btnCategoryRight);
         controls.add(btnCategoryRight);
-        if (categories.size() <= 2) {
+        if (categories.size() <= 1) {
             btnCategoryLeft.setEnabled(false);
             btnCategoryLeft.setEnabled(false);
             btnCategoryRight.setEnabled(false);
             btnCategoryRight.setEnabled(false);
         }
         }
@@ -129,15 +146,46 @@ public class RecipeGui extends GuiContainer {
         
         
         List<Control> newControls = new LinkedList<>();
         List<Control> newControls = new LinkedList<>();
         categories.get(categoryPointer).addWidget(newControls, 0);
         categories.get(categoryPointer).addWidget(newControls, 0);
-        if (recipes.get(categories.get(categoryPointer)).size() >= categoryPointer + 2) {
+        if (recipes.get(categories.get(categoryPointer)).size() >= categoryPointer + 2)
             categories.get(categoryPointer).addWidget(newControls, 1);
             categories.get(categoryPointer).addWidget(newControls, 1);
-        }
         newControls.forEach(f -> f.move(guiLeft, guiTop));
         newControls.forEach(f -> f.move(guiLeft, guiTop));
         controls.addAll(newControls);
         controls.addAll(newControls);
+        
+        updateTabs();
+    }
+    
+    private void updateTabs() {
+        tabsEnabled = guiTop - 28 > 4;
+        if (tabsEnabled) {
+            tabs.forEach(tab -> tab.moveTo(guiLeft + 4, guiLeft + 2 + tabs.indexOf(tab) * 28, guiTop - 28));
+            for(int i = 0; i < tabs.size(); i++) {
+                int ref = i + categoryTabPage * 6;
+                if (categories.size() > ref) {
+                    tabs.get(i).setItem(categories.get(ref).getCategoryIcon(), categories.get(ref).getDisplayName(), categories.get(ref).equals(selectedCategory));
+                } else tabs.get(i).setItem(null, null, false);
+            }
+            controls.addAll(tabs);
+        }
+    }
+    
+    private boolean onClickTab(int index) {
+        System.out.println(index);
+        if (index + categoryTabPage * 6 == categories.indexOf(selectedCategory))
+            return false;
+        selectedCategory = categories.get(index + categoryTabPage * 6);
+        return false;
     }
     }
     
     
     @Override
     @Override
     protected void drawGuiContainerBackgroundLayer(float v, int i, int i1) {
     protected void drawGuiContainerBackgroundLayer(float v, int i, int i1) {
+        //Tabs
+        if (tabsEnabled) {
+            GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
+            RenderHelper.enableGUIStandardItemLighting();
+            this.mc.getTextureManager().bindTexture(CREATIVE_INVENTORY_TABS);
+            tabs.stream().filter(tab -> tab.getId() + categoryTabPage * 6 == categories.indexOf(selectedCategory)).forEach(Tab::drawTab);
+        }
+        
         drawDefaultBackground();
         drawDefaultBackground();
         GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
         GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
         this.mc.getTextureManager().bindTexture(CHEST_GUI_TEXTURE);
         this.mc.getTextureManager().bindTexture(CHEST_GUI_TEXTURE);
@@ -146,18 +194,20 @@ public class RecipeGui extends GuiContainer {
         int lvt_5_1_ = (int) ((mainWindow.getScaledHeight() / 2 - this.guiHeight / 2));
         int lvt_5_1_ = (int) ((mainWindow.getScaledHeight() / 2 - this.guiHeight / 2));
         
         
         this.drawTexturedModalRect(lvt_4_1_, lvt_5_1_, 0, 0, this.guiWidth, this.guiHeight);
         this.drawTexturedModalRect(lvt_4_1_, lvt_5_1_, 0, 0, this.guiWidth, this.guiHeight);
-        slots.forEach(AEISlot::draw);
-    }
-    
-    
-    @Override
-    protected void initGui() {
-        super.initGui();
+        slots.forEach(REISlot::draw);
+        
+        if (tabsEnabled)
+            tabs.stream().filter(tab -> tab.getId() + categoryTabPage * 6 != categories.indexOf(selectedCategory)).forEach(tab -> {
+                GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
+                RenderHelper.enableGUIStandardItemLighting();
+                this.mc.getTextureManager().bindTexture(CREATIVE_INVENTORY_TABS);
+                tab.drawTab();
+            });
     }
     }
     
     
     @Override
     @Override
     public boolean keyPressed(int p_keyPressed_1_, int p_keyPressed_2_, int p_keyPressed_3_) {
     public boolean keyPressed(int p_keyPressed_1_, int p_keyPressed_2_, int p_keyPressed_3_) {
-        if (p_keyPressed_1_ == 259 && prevScreen != null && AEIRenderHelper.focusedControl == null) {
+        if (p_keyPressed_1_ == 259 && prevScreen != null && REIRenderHelper.focusedControl == null) {
             Minecraft.getInstance().displayGuiScreen(prevScreen);
             Minecraft.getInstance().displayGuiScreen(prevScreen);
             return true;
             return true;
         }
         }
@@ -172,20 +222,24 @@ public class RecipeGui extends GuiContainer {
     
     
     private boolean btnCategoryLeft(int button) {
     private boolean btnCategoryLeft(int button) {
         recipePointer = 0;
         recipePointer = 0;
+        int categoryPointer = categories.indexOf(selectedCategory);
         categoryPointer--;
         categoryPointer--;
-        if (categoryPointer < 0) {
+        if (categoryPointer < 0)
             categoryPointer = categories.size() - 1;
             categoryPointer = categories.size() - 1;
-        }
+        selectedCategory = categories.get(categoryPointer);
+        categoryTabPage = categoryPointer / 6;
         updateRecipe();
         updateRecipe();
         return true;
         return true;
     }
     }
     
     
     private boolean btnCategoryRight(int button) {
     private boolean btnCategoryRight(int button) {
         recipePointer = 0;
         recipePointer = 0;
+        int categoryPointer = categories.indexOf(selectedCategory);
         categoryPointer++;
         categoryPointer++;
-        if (categoryPointer >= categories.size()) {
+        if (categoryPointer >= categories.size())
             categoryPointer = 0;
             categoryPointer = 0;
-        }
+        selectedCategory = categories.get(categoryPointer);
+        categoryTabPage = categoryPointer / 6;
         updateRecipe();
         updateRecipe();
         return true;
         return true;
     }
     }
@@ -201,7 +255,7 @@ public class RecipeGui extends GuiContainer {
     
     
     private boolean btnRecipeRight(int button) {
     private boolean btnRecipeRight(int button) {
         recipePointer += 2;
         recipePointer += 2;
-        if (recipePointer >= recipes.get(categories.get(categoryPointer)).size()) {
+        if (recipePointer >= recipes.get(selectedCategory).size()) {
             recipePointer = 0;
             recipePointer = 0;
         }
         }
         updateRecipe();
         updateRecipe();
@@ -213,6 +267,6 @@ public class RecipeGui extends GuiContainer {
     }
     }
     
     
     private int getTotalPages() {
     private int getTotalPages() {
-        return MathHelper.clamp(riseDoublesToInt(recipes.get(categories.get(categoryPointer)).size() / 2), 1, Integer.MAX_VALUE);
+        return MathHelper.clamp(riseDoublesToInt(recipes.get(selectedCategory).size() / 2), 1, Integer.MAX_VALUE);
     }
     }
 }
 }

+ 35 - 0
src/main/java/me/shedaniel/gui/SearchArgument.java

@@ -0,0 +1,35 @@
+package me.shedaniel.gui;
+
+public class SearchArgument {
+    
+    public enum ArgumentType {
+        TEXT, MOD, TOOLTIP
+    }
+    
+    private ArgumentType argumentType;
+    private String text;
+    private boolean include;
+    
+    public SearchArgument(ArgumentType argumentType, String text, boolean include) {
+        this.argumentType = argumentType;
+        this.text = text;
+        this.include = include;
+    }
+    
+    public ArgumentType getArgumentType() {
+        return argumentType;
+    }
+    
+    public String getText() {
+        return text;
+    }
+    
+    public boolean isInclude() {
+        return include;
+    }
+    
+    @Override
+    public String toString() {
+        return String.format("Argument[%s]: name = %s, include = %b", argumentType.name(), text, include);
+    }
+}

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

@@ -1,6 +1,6 @@
 package me.shedaniel.gui.widget;
 package me.shedaniel.gui.widget;
 
 
-import me.shedaniel.gui.AEIRenderHelper;
+import me.shedaniel.gui.REIRenderHelper;
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.FontRenderer;
 import net.minecraft.client.gui.FontRenderer;
 import net.minecraft.client.gui.inventory.GuiContainer;
 import net.minecraft.client.gui.inventory.GuiContainer;
@@ -36,7 +36,7 @@ public class Button extends Control {
     public void draw() {
     public void draw() {
         GlStateManager.pushMatrix();
         GlStateManager.pushMatrix();
         GlStateManager.disableLighting();
         GlStateManager.disableLighting();
-        GuiContainer gui = AEIRenderHelper.getOverlayedGui();
+        GuiContainer gui = REIRenderHelper.getOverlayedGui();
         Minecraft lvt_4_1_ = Minecraft.getInstance();
         Minecraft lvt_4_1_ = Minecraft.getInstance();
         FontRenderer lvt_5_1_ = lvt_4_1_.fontRenderer;
         FontRenderer lvt_5_1_ = lvt_4_1_.fontRenderer;
         lvt_4_1_.getTextureManager().bindTexture(BUTTON_TEXTURES);
         lvt_4_1_.getTextureManager().bindTexture(BUTTON_TEXTURES);

+ 19 - 0
src/main/java/me/shedaniel/gui/widget/Control.java

@@ -91,6 +91,25 @@ public abstract class Control extends Drawable {
         lvt_9_1_.draw();
         lvt_9_1_.draw();
     }
     }
     
     
+    protected void drawTexturedModalRect(int x, int y, int u, int v, int width, int height, float zLevel) {
+        float lvt_7_1_ = 0.00390625F;
+        float lvt_8_1_ = 0.00390625F;
+        Tessellator lvt_9_1_ = Tessellator.getInstance();
+        BufferBuilder lvt_10_1_ = lvt_9_1_.getBuffer();
+        lvt_10_1_.begin(7, DefaultVertexFormats.POSITION_TEX);
+        lvt_10_1_.pos((double) (x + 0), (double) (y + height), zLevel).tex((double) ((float) (u + 0) * 0.00390625F), (double) ((float) (v + height) * 0.00390625F)).endVertex();
+        lvt_10_1_.pos((double) (x + width), (double) (y + height), zLevel).tex((double) ((float) (u + width) * 0.00390625F), (double) ((float) (v + height) * 0.00390625F)).endVertex();
+        lvt_10_1_.pos((double) (x + width), (double) (y + 0), zLevel).tex((double) ((float) (u + width) * 0.00390625F), (double) ((float) (v + 0) * 0.00390625F)).endVertex();
+        lvt_10_1_.pos((double) (x + 0), (double) (y + 0), zLevel).tex((double) ((float) (u + 0) * 0.00390625F), (double) ((float) (v + 0) * 0.00390625F)).endVertex();
+        lvt_9_1_.draw();
+    }
+    
+    
     public void tick() {
     public void tick() {
     }
     }
+    
+    public void setOnClick(IntFunction<Boolean> onClick) {
+        this.onClick = onClick;
+    }
+    
 }
 }

+ 20 - 19
src/main/java/me/shedaniel/gui/widget/AEISlot.java → src/main/java/me/shedaniel/gui/widget/REISlot.java

@@ -1,7 +1,8 @@
 package me.shedaniel.gui.widget;
 package me.shedaniel.gui.widget;
 
 
 import com.google.common.collect.Lists;
 import com.google.common.collect.Lists;
-import me.shedaniel.gui.AEIRenderHelper;
+import me.shedaniel.gui.REIRenderHelper;
+import me.shedaniel.impl.REIRecipeManager;
 import me.shedaniel.listenerdefinitions.IMixinGuiContainer;
 import me.shedaniel.listenerdefinitions.IMixinGuiContainer;
 import me.shedaniel.network.CheatPacket;
 import me.shedaniel.network.CheatPacket;
 import me.shedaniel.network.DeletePacket;
 import me.shedaniel.network.DeletePacket;
@@ -20,7 +21,7 @@ import java.util.List;
 /**
 /**
  * Created by James on 7/28/2018.
  * Created by James on 7/28/2018.
  */
  */
-public class AEISlot extends Control {
+public class REISlot extends Control {
     private static final ResourceLocation RECIPE_GUI = new ResourceLocation("almostenoughitems", "textures/gui/recipecontainer.png");
     private static final ResourceLocation RECIPE_GUI = new ResourceLocation("almostenoughitems", "textures/gui/recipecontainer.png");
     private boolean cheatable = false;
     private boolean cheatable = false;
     private List<ItemStack> itemList = new LinkedList<>();
     private List<ItemStack> itemList = new LinkedList<>();
@@ -62,7 +63,7 @@ public class AEISlot extends Control {
     private boolean drawBackground = false;
     private boolean drawBackground = false;
     private Point backgroundUV = new Point(0, 222);
     private Point backgroundUV = new Point(0, 222);
     
     
-    public AEISlot(int x, int y) {
+    public REISlot(int x, int y) {
         super(x, y, 18, 18);
         super(x, y, 18, 18);
         this.onClick = this::onClick;
         this.onClick = this::onClick;
     }
     }
@@ -96,16 +97,16 @@ public class AEISlot extends Control {
             drawTooltip();
             drawTooltip();
     }
     }
     
     
-    private void drawTooltip() {
+    protected void drawTooltip() {
         List<String> toolTip = getTooltip();
         List<String> toolTip = getTooltip();
-        toolTip.add("§9" + getMod());
-        Point mouse = AEIRenderHelper.getMouseLoc();
-        AEIRenderHelper.addToolTip(toolTip, mouse.x, mouse.y);
+        toolTip.add("§9§o" + getMod());
+        Point mouse = REIRenderHelper.getMouseLoc();
+        REIRenderHelper.addToolTip(toolTip, mouse.x, mouse.y);
     }
     }
     
     
     private boolean onClick(int button) {
     private boolean onClick(int button) {
         EntityPlayer player = Minecraft.getInstance().player;
         EntityPlayer player = Minecraft.getInstance().player;
-        if (AEIRenderHelper.aeiGui.canCheat() && !(player.inventory.getItemStack().isEmpty())) {
+        if (REIRenderHelper.reiGui.canCheat() && !(player.inventory.getItemStack().isEmpty())) {
             //Delete the itemstack.
             //Delete the itemstack.
             Minecraft.getInstance().getConnection().sendPacket(new DeletePacket());
             Minecraft.getInstance().getConnection().sendPacket(new DeletePacket());
             return true;
             return true;
@@ -114,7 +115,7 @@ public class AEISlot extends Control {
             return false;
             return false;
         }
         }
         
         
-        if (AEIRenderHelper.aeiGui.canCheat() && this.cheatable) {
+        if (REIRenderHelper.reiGui.canCheat() && this.cheatable) {
             if (getStack() != null && !getStack().isEmpty()) {
             if (getStack() != null && !getStack().isEmpty()) {
                 ItemStack cheatedStack = getStack().copy();
                 ItemStack cheatedStack = getStack().copy();
                 if (button == 0)
                 if (button == 0)
@@ -126,36 +127,36 @@ public class AEISlot extends Control {
                 return true;
                 return true;
             }
             }
         } else {
         } else {
-            AEIRenderHelper.recipeKeybind();
+            REIRenderHelper.recipeKeybind();
         }
         }
         return false;
         return false;
     }
     }
     
     
     
     
     private void drawStack(int x, int y) {
     private void drawStack(int x, int y) {
-        GuiContainer gui = AEIRenderHelper.getOverlayedGui();
-        AEIRenderHelper.getItemRender().zLevel = 200.0F;
-        AEIRenderHelper.getItemRender().renderItemAndEffectIntoGUI(getStack(), x, y);
+        GuiContainer gui = REIRenderHelper.getOverlayedGui();
+        REIRenderHelper.getItemRender().zLevel = 200.0F;
+        REIRenderHelper.getItemRender().renderItemAndEffectIntoGUI(getStack(), x, y);
         assert gui != null;
         assert gui != null;
         if (((IMixinGuiContainer) gui).getDraggedStack().isEmpty())
         if (((IMixinGuiContainer) gui).getDraggedStack().isEmpty())
-            AEIRenderHelper.getItemRender().renderItemOverlayIntoGUI(Minecraft.getInstance().fontRenderer, getStack(), x, y - 0, "");
+            REIRenderHelper.getItemRender().renderItemOverlayIntoGUI(Minecraft.getInstance().fontRenderer, getStack(), x, y - 0, "");
         else
         else
-            AEIRenderHelper.getItemRender().renderItemOverlayIntoGUI(Minecraft.getInstance().fontRenderer, getStack(), x, y - 8, "");
-        AEIRenderHelper.getItemRender().zLevel = 0.0F;
+            REIRenderHelper.getItemRender().renderItemOverlayIntoGUI(Minecraft.getInstance().fontRenderer, getStack(), x, y - 8, "");
+        REIRenderHelper.getItemRender().zLevel = 0.0F;
     }
     }
     
     
     public String getMod() {
     public String getMod() {
         if (!getStack().isEmpty()) {
         if (!getStack().isEmpty()) {
             ResourceLocation location = IRegistry.ITEM.getKey(getStack().getItem());
             ResourceLocation location = IRegistry.ITEM.getKey(getStack().getItem());
             assert location != null;
             assert location != null;
-            return location.getNamespace();
+            return REIRenderHelper.tryGettingModName(location.getNamespace());
         }
         }
         return "";
         return "";
     }
     }
     
     
-    private List<String> getTooltip() {
+    protected List<String> getTooltip() {
         Minecraft mc = Minecraft.getInstance();
         Minecraft mc = Minecraft.getInstance();
-        GuiContainer gui = AEIRenderHelper.getOverlayedGui();
+        GuiContainer gui = REIRenderHelper.getOverlayedGui();
         List<String> toolTip = Lists.newArrayList();
         List<String> toolTip = Lists.newArrayList();
         if (gui != null) {
         if (gui != null) {
             toolTip = gui.getItemToolTip(getStack());
             toolTip = gui.getItemToolTip(getStack());

+ 101 - 0
src/main/java/me/shedaniel/gui/widget/Tab.java

@@ -0,0 +1,101 @@
+package me.shedaniel.gui.widget;
+
+import me.shedaniel.gui.REIRenderHelper;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.client.renderer.ItemRenderer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+
+import java.awt.*;
+import java.util.ArrayList;
+import java.util.List;
+
+public class Tab extends Control {
+    
+    private boolean shown = false, selected = false;
+    private ItemStack item;
+    private int id, guiLeft;
+    private String categoryName;
+    
+    public Tab(int id, int guiLeft, int x, int y, int width, int height) {
+        super(x, y, width, height);
+        this.id = id;
+        this.guiLeft = guiLeft;
+        itemRender = Minecraft.getInstance().getItemRenderer();
+    }
+    
+    public void moveTo(int guiLeft, int x, int y) {
+        this.rect = new Rectangle(x, y, rect.width, rect.height);
+        this.guiLeft = guiLeft;
+    }
+    
+    public int getId() {
+        return id;
+    }
+    
+    @Override
+    public boolean equals(Object o) {
+        if (o instanceof Tab) {
+            Tab anotherTab = (Tab) o;
+            return anotherTab.id == this.id;
+        }
+        return false;
+    }
+    
+    public void setItem(ItemStack item, String categoryName, boolean selected) {
+        if (item == null) {
+            shown = false;
+            this.item = null;
+        } else {
+            shown = true;
+            this.item = item;
+        }
+        this.selected = selected;
+        this.categoryName = categoryName;
+    }
+    
+    public boolean isShown() {
+        return shown;
+    }
+    
+    public ItemStack getItemStack() {
+        return item;
+    }
+    
+    protected float zLevel;
+    protected ItemRenderer itemRender;
+    
+    @Override
+    public void draw() {
+    
+    }
+    
+    public void drawTab() {
+        if (shown) {
+            int l = this.guiLeft + 176 - 28 * (6 - id) - 4;
+            int i1 = this.rect.y + 8;
+            
+            GlStateManager.disableLighting();
+            this.drawTexturedModalRect(rect.x, rect.y - (selected ? 0 : 2), 28, (selected ? 32 : 0), 28, (selected ? 32 : 31));
+            this.zLevel = 100.0F;
+            this.itemRender.zLevel = 100.0F;
+            GlStateManager.enableLighting();
+            GlStateManager.enableRescaleNormal();
+            this.itemRender.renderItemAndEffectIntoGUI(getItemStack(), l, i1);
+            this.itemRender.renderItemOverlays(Minecraft.getInstance().fontRenderer, getItemStack(), l, i1);
+            GlStateManager.disableLighting();
+            this.itemRender.zLevel = 0.0F;
+            this.zLevel = 0.0F;
+            if (isHighlighted())
+                drawTooltip();
+        }
+    }
+    
+    private void drawTooltip() {
+        List<String> toolTip = new ArrayList<>();
+        toolTip.add(categoryName);
+        Point mouse = REIRenderHelper.getMouseLoc();
+        REIRenderHelper.addToolTip(toolTip, mouse.x, mouse.y);
+    }
+}

+ 5 - 5
src/main/java/me/shedaniel/gui/widget/TextBox.java

@@ -1,6 +1,6 @@
 package me.shedaniel.gui.widget;
 package me.shedaniel.gui.widget;
 
 
-import me.shedaniel.gui.AEIRenderHelper;
+import me.shedaniel.gui.REIRenderHelper;
 import net.minecraft.client.gui.GuiTextField;
 import net.minecraft.client.gui.GuiTextField;
 
 
 import java.awt.*;
 import java.awt.*;
@@ -14,7 +14,7 @@ public class TextBox extends Control implements IFocusable {
     
     
     public TextBox(int x, int y, int width, int height) {
     public TextBox(int x, int y, int width, int height) {
         super(x, y, width, height);
         super(x, y, width, height);
-        textField = new GuiTextField(-1, AEIRenderHelper.getFontRenderer(), x, y, width, height);
+        textField = new GuiTextField(-1, REIRenderHelper.getFontRenderer(), x, y, width, height);
         this.onClick = this::doMouseClick;
         this.onClick = this::doMouseClick;
         this.onKeyDown = this::onKeyPressed;
         this.onKeyDown = this::onKeyPressed;
         this.charPressed = this::charTyped;
         this.charPressed = this::charTyped;
@@ -36,7 +36,7 @@ public class TextBox extends Control implements IFocusable {
     }
     }
     
     
     protected boolean doMouseClick(int button) {
     protected boolean doMouseClick(int button) {
-        Point mouseLoc = AEIRenderHelper.getMouseLoc();
+        Point mouseLoc = REIRenderHelper.getMouseLoc();
         if (!hasFocus())
         if (!hasFocus())
             setFocused(true);
             setFocused(true);
         return textField.mouseClicked(mouseLoc.x, mouseLoc.y, 0);
         return textField.mouseClicked(mouseLoc.x, mouseLoc.y, 0);
@@ -45,7 +45,7 @@ public class TextBox extends Control implements IFocusable {
     protected boolean onKeyPressed(int first, int second, int third) {
     protected boolean onKeyPressed(int first, int second, int third) {
         boolean handled = textField.keyPressed(first, second, third);
         boolean handled = textField.keyPressed(first, second, third);
         if (handled) {
         if (handled) {
-            AEIRenderHelper.updateSearch();
+            REIRenderHelper.updateSearch();
         }
         }
         
         
         return handled;
         return handled;
@@ -61,7 +61,7 @@ public class TextBox extends Control implements IFocusable {
     
     
     protected void charTyped(char p_charTyped_1_, int p_charTyped_2_) {
     protected void charTyped(char p_charTyped_1_, int p_charTyped_2_) {
         textField.charTyped(p_charTyped_1_, p_charTyped_2_);
         textField.charTyped(p_charTyped_1_, p_charTyped_2_);
-        AEIRenderHelper.updateSearch();
+        REIRenderHelper.updateSearch();
     }
     }
     
     
     @Override
     @Override

+ 4 - 0
src/main/java/me/shedaniel/gui/widget/WidgetArrow.java

@@ -1,6 +1,8 @@
 package me.shedaniel.gui.widget;
 package me.shedaniel.gui.widget;
 
 
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.Minecraft;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.client.renderer.RenderHelper;
 import net.minecraft.util.ResourceLocation;
 import net.minecraft.util.ResourceLocation;
 
 
 public class WidgetArrow extends Control {
 public class WidgetArrow extends Control {
@@ -16,6 +18,8 @@ public class WidgetArrow extends Control {
     
     
     @Override
     @Override
     public void draw() {
     public void draw() {
+        GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
+        RenderHelper.disableStandardItemLighting();
         Minecraft.getInstance().getTextureManager().bindTexture(RECIPE_GUI);
         Minecraft.getInstance().getTextureManager().bindTexture(RECIPE_GUI);
         this.drawTexturedModalRect(rect.x, rect.y, 18, 222, 22, 18);
         this.drawTexturedModalRect(rect.x, rect.y, 18, 222, 22, 18);
         if (animated) {
         if (animated) {

+ 14 - 14
src/main/java/me/shedaniel/impl/AEIRecipeManager.java → src/main/java/me/shedaniel/impl/REIRecipeManager.java

@@ -1,6 +1,6 @@
 package me.shedaniel.impl;
 package me.shedaniel.impl;
 
 
-import me.shedaniel.api.IAEIPlugin;
+import me.shedaniel.api.IREIPlugin;
 import me.shedaniel.api.IDisplayCategory;
 import me.shedaniel.api.IDisplayCategory;
 import me.shedaniel.api.IRecipe;
 import me.shedaniel.api.IRecipe;
 import me.shedaniel.api.IRecipeManager;
 import me.shedaniel.api.IRecipeManager;
@@ -9,8 +9,6 @@ import net.minecraft.client.Minecraft;
 import net.minecraft.item.Item;
 import net.minecraft.item.Item;
 import net.minecraft.item.ItemStack;
 import net.minecraft.item.ItemStack;
 import net.minecraft.item.crafting.RecipeManager;
 import net.minecraft.item.crafting.RecipeManager;
-import net.minecraft.item.crafting.ShapelessRecipe;
-import net.minecraft.util.ResourceLocation;
 import org.dimdev.riftloader.RiftLoader;
 import org.dimdev.riftloader.RiftLoader;
 
 
 import java.util.HashMap;
 import java.util.HashMap;
@@ -21,22 +19,26 @@ import java.util.Map;
 /**
 /**
  * Created by James on 8/7/2018.
  * Created by James on 8/7/2018.
  */
  */
-public class AEIRecipeManager implements IRecipeManager {
+public class REIRecipeManager implements IRecipeManager {
     private Map<String, List<IRecipe>> recipeList;
     private Map<String, List<IRecipe>> recipeList;
     private List<IDisplayCategory> displayAdapters;
     private List<IDisplayCategory> displayAdapters;
     public static RecipeManager recipeManager;
     public static RecipeManager recipeManager;
     
     
-    private static AEIRecipeManager myInstance;
+    private static REIRecipeManager myInstance;
     
     
-    private AEIRecipeManager() {
+    private REIRecipeManager() {
         recipeList = new HashMap<>();
         recipeList = new HashMap<>();
         displayAdapters = new LinkedList<>();
         displayAdapters = new LinkedList<>();
     }
     }
     
     
-    public static AEIRecipeManager instance() {
+    public List<IDisplayCategory> getDisplayAdapters() {
+        return displayAdapters;
+    }
+    
+    public static REIRecipeManager instance() {
         if (myInstance == null) {
         if (myInstance == null) {
             System.out.println("Newing me up.");
             System.out.println("Newing me up.");
-            myInstance = new AEIRecipeManager();
+            myInstance = new REIRecipeManager();
         }
         }
         return myInstance;
         return myInstance;
     }
     }
@@ -50,8 +52,6 @@ public class AEIRecipeManager implements IRecipeManager {
             recipeList.put(id, recipes);
             recipeList.put(id, recipes);
             recipes.add(recipe);
             recipes.add(recipe);
         }
         }
-        
-        
     }
     }
     
     
     @Override
     @Override
@@ -135,12 +135,12 @@ public class AEIRecipeManager implements IRecipeManager {
     public void RecipesLoaded(RecipeManager manager) {
     public void RecipesLoaded(RecipeManager manager) {
         recipeList.clear();
         recipeList.clear();
         displayAdapters.clear();
         displayAdapters.clear();
-        AEIRecipeManager.instance().recipeManager = manager;
-        RiftLoader.instance.getListeners(IAEIPlugin.class).forEach(IAEIPlugin::register);
+        REIRecipeManager.instance().recipeManager = manager;
+        RiftLoader.instance.getListeners(IREIPlugin.class).forEach(IREIPlugin::register);
     }
     }
     
     
     public void displayRecipesFor(ItemStack stack) {
     public void displayRecipesFor(ItemStack stack) {
-        Map<IDisplayCategory, List<IRecipe>> recipes = AEIRecipeManager.instance().getRecipesFor(stack);
+        Map<IDisplayCategory, List<IRecipe>> recipes = REIRecipeManager.instance().getRecipesFor(stack);
         if (recipes.isEmpty())
         if (recipes.isEmpty())
             return;
             return;
         RecipeGui gui = new RecipeGui(null, Minecraft.getInstance().currentScreen, recipes);
         RecipeGui gui = new RecipeGui(null, Minecraft.getInstance().currentScreen, recipes);
@@ -148,7 +148,7 @@ public class AEIRecipeManager implements IRecipeManager {
     }
     }
     
     
     public void displayUsesFor(ItemStack stack) {
     public void displayUsesFor(ItemStack stack) {
-        Map<IDisplayCategory, List<IRecipe>> recipes = AEIRecipeManager.instance().getUsesFor(stack);
+        Map<IDisplayCategory, List<IRecipe>> recipes = REIRecipeManager.instance().getUsesFor(stack);
         if (recipes.isEmpty())
         if (recipes.isEmpty())
             return;
             return;
         RecipeGui gui = new RecipeGui(null, Minecraft.getInstance().currentScreen, recipes);
         RecipeGui gui = new RecipeGui(null, Minecraft.getInstance().currentScreen, recipes);

+ 1 - 1
src/main/java/me/shedaniel/listenerdefinitions/MinecraftResize.java

@@ -4,5 +4,5 @@ package me.shedaniel.listenerdefinitions;
  * Created by James on 7/28/2018.
  * Created by James on 7/28/2018.
  */
  */
 public interface MinecraftResize {
 public interface MinecraftResize {
-    public void resize();
+    public void resize(int scaledWidth, int scaledHeight);
 }
 }

+ 8 - 0
src/main/java/me/shedaniel/listenerdefinitions/PotionCraftingAdder.java

@@ -0,0 +1,8 @@
+package me.shedaniel.listenerdefinitions;
+
+import net.minecraft.item.Item;
+import net.minecraft.potion.PotionType;
+
+public interface PotionCraftingAdder {
+    public void addPotionRecipe(PotionType inputType, Item reagent, PotionType outputType);
+}

+ 8 - 8
src/main/java/me/shedaniel/listeners/DrawContainerListener.java

@@ -1,6 +1,6 @@
 package me.shedaniel.listeners;
 package me.shedaniel.listeners;
 
 
-import me.shedaniel.gui.AEIRenderHelper;
+import me.shedaniel.gui.REIRenderHelper;
 import me.shedaniel.listenerdefinitions.*;
 import me.shedaniel.listenerdefinitions.*;
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.GuiScreen;
 import net.minecraft.client.gui.GuiScreen;
@@ -16,8 +16,8 @@ public class DrawContainerListener implements DrawContainer, GuiCickListener, Gu
     @Override
     @Override
     public void draw(int x, int y, float dunno, GuiContainer gui) {
     public void draw(int x, int y, float dunno, GuiContainer gui) {
         if (!(gui instanceof GuiContainerCreative) || ((GuiContainerCreative) gui).getSelectedTabIndex() == ItemGroup.INVENTORY.getIndex()) {
         if (!(gui instanceof GuiContainerCreative) || ((GuiContainerCreative) gui).getSelectedTabIndex() == ItemGroup.INVENTORY.getIndex()) {
-            AEIRenderHelper.setMouseLoc(x, y);
-            AEIRenderHelper.drawAEI(gui);
+            REIRenderHelper.setMouseLoc(x, y);
+            REIRenderHelper.drawREI(gui);
         }
         }
     }
     }
     
     
@@ -25,7 +25,7 @@ public class DrawContainerListener implements DrawContainer, GuiCickListener, Gu
     public boolean onClick(int x, int y, int button) {
     public boolean onClick(int x, int y, int button) {
         GuiScreen gui = Minecraft.getInstance().currentScreen;
         GuiScreen gui = Minecraft.getInstance().currentScreen;
         if (!(gui instanceof GuiContainerCreative) || ((GuiContainerCreative) gui).getSelectedTabIndex() == ItemGroup.INVENTORY.getIndex())
         if (!(gui instanceof GuiContainerCreative) || ((GuiContainerCreative) gui).getSelectedTabIndex() == ItemGroup.INVENTORY.getIndex())
-            return AEIRenderHelper.mouseClick(x, y, button);
+            return REIRenderHelper.mouseClick(x, y, button);
         return false;
         return false;
     }
     }
     
     
@@ -33,7 +33,7 @@ public class DrawContainerListener implements DrawContainer, GuiCickListener, Gu
     public boolean keyDown(int p_keyPressed_1_, int p_keyPressed_2_, int p_keyPressed_3_) {
     public boolean keyDown(int p_keyPressed_1_, int p_keyPressed_2_, int p_keyPressed_3_) {
         GuiScreen gui = Minecraft.getInstance().currentScreen;
         GuiScreen gui = Minecraft.getInstance().currentScreen;
         if (!(gui instanceof GuiContainerCreative) || ((GuiContainerCreative) gui).getSelectedTabIndex() == ItemGroup.INVENTORY.getIndex())
         if (!(gui instanceof GuiContainerCreative) || ((GuiContainerCreative) gui).getSelectedTabIndex() == ItemGroup.INVENTORY.getIndex())
-            return AEIRenderHelper.keyDown(p_keyPressed_1_, p_keyPressed_2_, p_keyPressed_3_);
+            return REIRenderHelper.keyDown(p_keyPressed_1_, p_keyPressed_2_, p_keyPressed_3_);
         return false;
         return false;
     }
     }
     
     
@@ -41,20 +41,20 @@ public class DrawContainerListener implements DrawContainer, GuiCickListener, Gu
     public boolean charInput(long p_onCharEvent_1_, int p_onCharEvent_3_, int p_onCharEvent_4_) {
     public boolean charInput(long p_onCharEvent_1_, int p_onCharEvent_3_, int p_onCharEvent_4_) {
         GuiScreen gui = Minecraft.getInstance().currentScreen;
         GuiScreen gui = Minecraft.getInstance().currentScreen;
         if (!(gui instanceof GuiContainerCreative) || ((GuiContainerCreative) gui).getSelectedTabIndex() == ItemGroup.INVENTORY.getIndex())
         if (!(gui instanceof GuiContainerCreative) || ((GuiContainerCreative) gui).getSelectedTabIndex() == ItemGroup.INVENTORY.getIndex())
-            return AEIRenderHelper.charInput(p_onCharEvent_1_, p_onCharEvent_3_, p_onCharEvent_4_);
+            return REIRenderHelper.charInput(p_onCharEvent_1_, p_onCharEvent_3_, p_onCharEvent_4_);
         return false;
         return false;
     }
     }
     
     
     @Override
     @Override
     public void clientTick(final Minecraft minecraft) {
     public void clientTick(final Minecraft minecraft) {
-        AEIRenderHelper.tick();
+        REIRenderHelper.tick();
     }
     }
     
     
     @Override
     @Override
     public boolean mouseScrolled(double direction) {
     public boolean mouseScrolled(double direction) {
         GuiScreen gui = Minecraft.getInstance().currentScreen;
         GuiScreen gui = Minecraft.getInstance().currentScreen;
         if (!(gui instanceof GuiContainerCreative) || ((GuiContainerCreative) gui).getSelectedTabIndex() == ItemGroup.INVENTORY.getIndex())
         if (!(gui instanceof GuiContainerCreative) || ((GuiContainerCreative) gui).getSelectedTabIndex() == ItemGroup.INVENTORY.getIndex())
-            return AEIRenderHelper.mouseScrolled(direction);
+            return REIRenderHelper.mouseScrolled(direction);
         return false;
         return false;
     }
     }
 }
 }

+ 1 - 2
src/main/java/me/shedaniel/listeners/InitListener.java

@@ -14,9 +14,8 @@ public class InitListener implements InitializationListener {
     
     
     @Override
     @Override
     public void onInitialization() {
     public void onInitialization() {
-        LOGGER.info("Adding AEI Mixins");
+        LOGGER.info("Adding REI Mixins");
         MixinBootstrap.init();
         MixinBootstrap.init();
         Mixins.addConfiguration("mixins.roughlyenoughitems.json");
         Mixins.addConfiguration("mixins.roughlyenoughitems.json");
-        
     }
     }
 }
 }

+ 3 - 3
src/main/java/me/shedaniel/listeners/ResizeListener.java

@@ -1,6 +1,6 @@
 package me.shedaniel.listeners;
 package me.shedaniel.listeners;
 
 
-import me.shedaniel.gui.AEIRenderHelper;
+import me.shedaniel.gui.REIRenderHelper;
 import me.shedaniel.listenerdefinitions.MinecraftResize;
 import me.shedaniel.listenerdefinitions.MinecraftResize;
 
 
 /**
 /**
@@ -8,7 +8,7 @@ import me.shedaniel.listenerdefinitions.MinecraftResize;
  */
  */
 public class ResizeListener implements MinecraftResize {
 public class ResizeListener implements MinecraftResize {
     @Override
     @Override
-    public void resize() {
-        AEIRenderHelper.resize();
+    public void resize(int scaledWidth, int scaledHeight) {
+        REIRenderHelper.resize(scaledWidth, scaledHeight);
     }
     }
 }
 }

+ 1 - 0
src/main/java/me/shedaniel/mixins/MixinGuiContainerCreative.java

@@ -78,6 +78,7 @@ public abstract class MixinGuiContainerCreative extends InventoryEffectRenderer
         return super.keyPressed(p_keyPressed_1_, p_keyPressed_2_, p_keyPressed_3_);
         return super.keyPressed(p_keyPressed_1_, p_keyPressed_2_, p_keyPressed_3_);
     }
     }
     
     
+    @Overwrite
     public boolean mouseScrolled(double p_mouseScrolled_1_) {
     public boolean mouseScrolled(double p_mouseScrolled_1_) {
         if (!this.needsScrollBars()) {
         if (!this.needsScrollBars()) {
             return super.mouseScrolled(p_mouseScrolled_1_);
             return super.mouseScrolled(p_mouseScrolled_1_);

+ 7 - 2
src/main/java/me/shedaniel/mixins/MixinMinecraftResize.java

@@ -4,6 +4,7 @@ import me.shedaniel.listenerdefinitions.MinecraftResize;
 import net.minecraft.client.MainWindow;
 import net.minecraft.client.MainWindow;
 import org.dimdev.riftloader.RiftLoader;
 import org.dimdev.riftloader.RiftLoader;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.Shadow;
 import org.spongepowered.asm.mixin.injection.At;
 import org.spongepowered.asm.mixin.injection.At;
 import org.spongepowered.asm.mixin.injection.Inject;
 import org.spongepowered.asm.mixin.injection.Inject;
 import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
 import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@@ -12,11 +13,15 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
  * Created by James on 7/28/2018.
  * Created by James on 7/28/2018.
  */
  */
 @Mixin(MainWindow.class)
 @Mixin(MainWindow.class)
-public class MixinMinecraftResize {
+public abstract class MixinMinecraftResize implements AutoCloseable {
+    @Shadow private int scaledHeight;
+    
+    @Shadow private int scaledWidth;
+    
     @Inject(method = "updateSize", at = @At("RETURN"))
     @Inject(method = "updateSize", at = @At("RETURN"))
     private void onResize(CallbackInfo ci) {
     private void onResize(CallbackInfo ci) {
         for(MinecraftResize listener : RiftLoader.instance.getListeners(MinecraftResize.class)) {
         for(MinecraftResize listener : RiftLoader.instance.getListeners(MinecraftResize.class)) {
-            listener.resize();
+            listener.resize(this.scaledWidth, this.scaledHeight);
         }
         }
     }
     }
     
     

+ 21 - 0
src/main/java/me/shedaniel/mixins/MixinPotionBrewing.java

@@ -0,0 +1,21 @@
+package me.shedaniel.mixins;
+
+import me.shedaniel.listenerdefinitions.PotionCraftingAdder;
+import net.minecraft.item.Item;
+import net.minecraft.potion.PotionBrewing;
+import net.minecraft.potion.PotionType;
+import org.dimdev.riftloader.RiftLoader;
+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(PotionBrewing.class)
+public class MixinPotionBrewing {
+    
+    @Inject(method = "addMix", at = @At("RETURN"))
+    private static void addMix(PotionType inputPotion, Item reagent, PotionType outputPotion, CallbackInfo info) {
+        RiftLoader.instance.getListeners(PotionCraftingAdder.class).forEach(potionCraftingAdder -> potionCraftingAdder.addPotionRecipe(inputPotion, reagent, outputPotion));
+    }
+    
+}

+ 33 - 0
src/main/java/me/shedaniel/plugin/RandomRecipe.java

@@ -0,0 +1,33 @@
+package me.shedaniel.plugin;
+
+import me.shedaniel.api.IRecipe;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
+
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+
+public class RandomRecipe implements IRecipe<ItemStack> {
+    
+    private String id;
+    
+    public RandomRecipe(String id) {
+        this.id = id;
+    }
+    
+    @Override
+    public String getId() {
+        return id;
+    }
+    
+    @Override
+    public List<ItemStack> getOutput() {
+        return new LinkedList<>(Arrays.asList(new ItemStack[]{new ItemStack(Blocks.BEETROOTS.asItem())}));
+    }
+    
+    @Override
+    public List<List<ItemStack>> getInput() {
+        return new LinkedList<>(Arrays.asList(new LinkedList<>(Arrays.asList(new ItemStack[]{new ItemStack(Blocks.OAK_LOG.asItem())}))));
+    }
+}

+ 72 - 0
src/main/java/me/shedaniel/plugin/TestRandomCategory.java

@@ -0,0 +1,72 @@
+package me.shedaniel.plugin;
+
+import me.shedaniel.api.IDisplayCategory;
+import me.shedaniel.gui.widget.Control;
+import me.shedaniel.gui.widget.REISlot;
+import me.shedaniel.plugin.crafting.VanillaCraftingRecipe;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+public class TestRandomCategory implements IDisplayCategory<RandomRecipe> {
+    
+    private String id;
+    private List<RandomRecipe> recipes;
+    private ItemStack item;
+    
+    public TestRandomCategory(String id, ItemStack item) {
+        this.id = id;
+        this.item = item;
+    }
+    
+    @Override
+    public String getId() {
+        return id;
+    }
+    
+    @Override
+    public String getDisplayName() {
+        return id;
+    }
+    
+    @Override
+    public void addRecipe(RandomRecipe recipe) {
+        if (this.recipes == null)
+            this.recipes = new ArrayList<>();
+        this.recipes.add(recipe);
+    }
+    
+    @Override
+    public void resetRecipes() {
+        this.recipes = new ArrayList<>();
+    }
+    
+    @Override
+    public List<REISlot> setupDisplay(int number) {
+        return new LinkedList<>();
+    }
+    
+    @Override
+    public boolean canDisplay(RandomRecipe recipe) {
+        return false;
+    }
+    
+    @Override
+    public void drawExtras() {
+    
+    }
+    
+    @Override
+    public void addWidget(List<Control> controls, int number) {
+    
+    }
+    
+    @Override
+    public ItemStack getCategoryIcon() {
+        return item;
+    }
+}

+ 51 - 13
src/main/java/me/shedaniel/plugin/VanillaPlugin.java

@@ -1,31 +1,47 @@
 package me.shedaniel.plugin;
 package me.shedaniel.plugin;
 
 
-import me.shedaniel.api.IAEIPlugin;
-import me.shedaniel.impl.AEIRecipeManager;
+import me.shedaniel.api.IREIPlugin;
+import me.shedaniel.impl.REIRecipeManager;
+import me.shedaniel.listenerdefinitions.PotionCraftingAdder;
 import me.shedaniel.plugin.crafting.VanillaCraftingCategory;
 import me.shedaniel.plugin.crafting.VanillaCraftingCategory;
 import me.shedaniel.plugin.crafting.VanillaCraftingRecipe;
 import me.shedaniel.plugin.crafting.VanillaCraftingRecipe;
 import me.shedaniel.plugin.crafting.VanillaShapedCraftingRecipe;
 import me.shedaniel.plugin.crafting.VanillaShapedCraftingRecipe;
 import me.shedaniel.plugin.crafting.VanillaShapelessCraftingRecipe;
 import me.shedaniel.plugin.crafting.VanillaShapelessCraftingRecipe;
 import me.shedaniel.plugin.furnace.VanillaFurnaceCategory;
 import me.shedaniel.plugin.furnace.VanillaFurnaceCategory;
 import me.shedaniel.plugin.furnace.VanillaFurnaceRecipe;
 import me.shedaniel.plugin.furnace.VanillaFurnaceRecipe;
-import net.minecraft.item.crafting.FurnaceRecipe;
-import net.minecraft.item.crafting.IRecipe;
-import net.minecraft.item.crafting.ShapedRecipe;
-import net.minecraft.item.crafting.ShapelessRecipe;
+import me.shedaniel.plugin.potion.VanillaPotionCategory;
+import me.shedaniel.plugin.potion.VanillaPotionRecipe;
+import net.minecraft.init.Items;
+import net.minecraft.init.PotionTypes;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.item.crafting.*;
+import net.minecraft.potion.PotionType;
+import net.minecraft.potion.PotionUtils;
+import net.minecraft.util.registry.IRegistry;
 
 
-import java.util.Arrays;
 import java.util.LinkedList;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.List;
+import java.util.stream.Collectors;
 
 
-public class VanillaPlugin implements IAEIPlugin {
+public class VanillaPlugin implements IREIPlugin, PotionCraftingAdder {
+    
+    private List<VanillaPotionRecipe> potionRecipes = new LinkedList<>();
+    
     @Override
     @Override
     public void register() {
     public void register() {
         List<VanillaCraftingRecipe> recipes = new LinkedList<>();
         List<VanillaCraftingRecipe> recipes = new LinkedList<>();
         List<VanillaFurnaceRecipe> furnaceRecipes = new LinkedList<>();
         List<VanillaFurnaceRecipe> furnaceRecipes = new LinkedList<>();
-        AEIRecipeManager.instance().addDisplayAdapter(new VanillaCraftingCategory());
-        AEIRecipeManager.instance().addDisplayAdapter(new VanillaFurnaceCategory());
+        REIRecipeManager.instance().addDisplayAdapter(new VanillaCraftingCategory());
+        REIRecipeManager.instance().addDisplayAdapter(new VanillaFurnaceCategory());
+        REIRecipeManager.instance().addDisplayAdapter(new VanillaPotionCategory());
+//        REIRecipeManager.instance().addDisplayAdapter(new TestRandomCategory("a", new ItemStack(Blocks.ACACIA_BUTTON.asItem())));
+//        REIRecipeManager.instance().addDisplayAdapter(new TestRandomCategory("b", new ItemStack(Blocks.ACACIA_LOG.asItem())));
+//        REIRecipeManager.instance().addDisplayAdapter(new TestRandomCategory("c", new ItemStack(Blocks.ACACIA_LOG.asItem())));
+//        REIRecipeManager.instance().addDisplayAdapter(new TestRandomCategory("d", new ItemStack(Blocks.ACACIA_LOG.asItem())));
+//        REIRecipeManager.instance().addDisplayAdapter(new TestRandomCategory("e", new ItemStack(Blocks.ACACIA_LOG.asItem())));
         
         
-        for(IRecipe recipe : AEIRecipeManager.instance().recipeManager.getRecipes()) {
+        for(IRecipe recipe : REIRecipeManager.instance().recipeManager.getRecipes()) {
             if (recipe instanceof ShapelessRecipe) {
             if (recipe instanceof ShapelessRecipe) {
                 recipes.add(new VanillaShapelessCraftingRecipe((ShapelessRecipe) recipe));
                 recipes.add(new VanillaShapelessCraftingRecipe((ShapelessRecipe) recipe));
             }
             }
@@ -36,8 +52,30 @@ public class VanillaPlugin implements IAEIPlugin {
                 furnaceRecipes.add(new VanillaFurnaceRecipe((FurnaceRecipe) recipe));
                 furnaceRecipes.add(new VanillaFurnaceRecipe((FurnaceRecipe) recipe));
             }
             }
         }
         }
+        IRegistry.POTION.stream().filter(potionType -> !potionType.equals(PotionTypes.EMPTY)).forEach(potionType -> {
+            ItemStack basePotion = PotionUtils.addPotionToItemStack(new ItemStack(Items.POTION), potionType),
+                    splashPotion = PotionUtils.addPotionToItemStack(new ItemStack(Items.SPLASH_POTION), potionType),
+                    lingeringPotion = PotionUtils.addPotionToItemStack(new ItemStack(Items.LINGERING_POTION), potionType);
+            potionRecipes.add(new VanillaPotionRecipe(new ItemStack[]{basePotion}, Ingredient.fromItems(Items.GUNPOWDER).getMatchingStacks(),
+                    new ItemStack[]{splashPotion}));
+            potionRecipes.add(new VanillaPotionRecipe(new ItemStack[]{splashPotion}, Ingredient.fromItems(Items.DRAGON_BREATH).getMatchingStacks(),
+                    new ItemStack[]{lingeringPotion}));
+        });
         
         
-        AEIRecipeManager.instance().addRecipe("vanilla", recipes);
-        AEIRecipeManager.instance().addRecipe("furnace", furnaceRecipes);
+        REIRecipeManager.instance().addRecipe("vanilla", recipes);
+        REIRecipeManager.instance().addRecipe("furnace", furnaceRecipes);
+        REIRecipeManager.instance().addRecipe("potion", potionRecipes.stream().collect(Collectors.toList()));
+//        REIRecipeManager.instance().addPotionRecipe("a", new RandomRecipe("a"));
+//        REIRecipeManager.instance().addPotionRecipe("b", new RandomRecipe("b"));
+//        REIRecipeManager.instance().addPotionRecipe("c", new RandomRecipe("c"));
+//        REIRecipeManager.instance().addPotionRecipe("d", new RandomRecipe("d"));
+//        REIRecipeManager.instance().addPotionRecipe("e", new RandomRecipe("e"));
+    }
+    
+    @Override
+    public void addPotionRecipe(PotionType inputType, Item reagent, PotionType outputType) {
+        potionRecipes.add(new VanillaPotionRecipe(new ItemStack[]{PotionUtils.addPotionToItemStack(new ItemStack(Items.POTION), inputType)},
+                Ingredient.fromItems(reagent).getMatchingStacks(),
+                new ItemStack[]{PotionUtils.addPotionToItemStack(new ItemStack(Items.POTION), outputType)}));
     }
     }
 }
 }

+ 15 - 6
src/main/java/me/shedaniel/plugin/crafting/VanillaCraftingCategory.java

@@ -1,11 +1,14 @@
 package me.shedaniel.plugin.crafting;
 package me.shedaniel.plugin.crafting;
 
 
 import me.shedaniel.api.IDisplayCategory;
 import me.shedaniel.api.IDisplayCategory;
-import me.shedaniel.gui.widget.AEISlot;
+import me.shedaniel.gui.widget.REISlot;
 import me.shedaniel.gui.widget.Control;
 import me.shedaniel.gui.widget.Control;
 import me.shedaniel.gui.widget.WidgetArrow;
 import me.shedaniel.gui.widget.WidgetArrow;
 import net.minecraft.client.MainWindow;
 import net.minecraft.client.MainWindow;
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.Minecraft;
+import net.minecraft.client.resources.I18n;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.Item;
 import net.minecraft.item.ItemStack;
 import net.minecraft.item.ItemStack;
 
 
 import java.util.ArrayList;
 import java.util.ArrayList;
@@ -23,7 +26,7 @@ public class VanillaCraftingCategory implements IDisplayCategory<VanillaCrafting
     
     
     @Override
     @Override
     public String getDisplayName() {
     public String getDisplayName() {
-        return "Crafting";
+        return I18n.format("category.rei.crafting");
     }
     }
     
     
     @Override
     @Override
@@ -39,13 +42,13 @@ public class VanillaCraftingCategory implements IDisplayCategory<VanillaCrafting
     }
     }
     
     
     @Override
     @Override
-    public List<AEISlot> setupDisplay(int number) {
-        List<AEISlot> slots = new LinkedList<>();
+    public List<REISlot> setupDisplay(int number) {
+        List<REISlot> slots = new LinkedList<>();
         int count = 0;
         int count = 0;
         List<List<ItemStack>> input = recipes.get(number).getInput();
         List<List<ItemStack>> input = recipes.get(number).getInput();
         for(int y = 0; y < 3; y++) {
         for(int y = 0; y < 3; y++) {
             for(int x = 0; x < 3; x++) {
             for(int x = 0; x < 3; x++) {
-                AEISlot slot = new AEISlot(20 + x * 18, 75 + y * 18 + number * 75);
+                REISlot slot = new REISlot(20 + x * 18, 75 + y * 18 + number * 75);
                 slot.setDrawBackground(true);
                 slot.setDrawBackground(true);
                 slots.add(slot);
                 slots.add(slot);
                 count++;
                 count++;
@@ -58,7 +61,7 @@ public class VanillaCraftingCategory implements IDisplayCategory<VanillaCrafting
             } else if (!input.get(i).isEmpty())
             } else if (!input.get(i).isEmpty())
                 slots.get(i).setStackList(input.get(i));
                 slots.get(i).setStackList(input.get(i));
         }
         }
-        AEISlot slot = new AEISlot(130, 75 + 18 + number * 75);
+        REISlot slot = new REISlot(130, 75 + 18 + number * 75);
         
         
         slot.setDrawBackground(true);
         slot.setDrawBackground(true);
         slot.setStack(recipes.get(number).getOutput().get(0).copy());
         slot.setStack(recipes.get(number).getOutput().get(0).copy());
@@ -103,4 +106,10 @@ public class VanillaCraftingCategory implements IDisplayCategory<VanillaCrafting
         }
         }
         return num;
         return num;
     }
     }
+    
+    @Override
+    public ItemStack getCategoryIcon() {
+        return new ItemStack(Blocks.CRAFTING_TABLE.asItem());
+    }
+    
 }
 }

+ 15 - 9
src/main/java/me/shedaniel/plugin/furnace/VanillaFurnaceCategory.java

@@ -1,10 +1,11 @@
 package me.shedaniel.plugin.furnace;
 package me.shedaniel.plugin.furnace;
 
 
 import me.shedaniel.api.IDisplayCategory;
 import me.shedaniel.api.IDisplayCategory;
-import me.shedaniel.gui.widget.AEISlot;
+import me.shedaniel.gui.widget.REISlot;
 import me.shedaniel.gui.widget.Control;
 import me.shedaniel.gui.widget.Control;
 import me.shedaniel.gui.widget.WidgetArrow;
 import me.shedaniel.gui.widget.WidgetArrow;
-import me.shedaniel.plugin.crafting.VanillaCraftingRecipe;
+import net.minecraft.client.resources.I18n;
+import net.minecraft.init.Blocks;
 import net.minecraft.item.Item;
 import net.minecraft.item.Item;
 import net.minecraft.item.ItemStack;
 import net.minecraft.item.ItemStack;
 import net.minecraft.tileentity.TileEntityFurnace;
 import net.minecraft.tileentity.TileEntityFurnace;
@@ -24,7 +25,7 @@ public class VanillaFurnaceCategory implements IDisplayCategory<VanillaFurnaceRe
     
     
     @Override
     @Override
     public String getDisplayName() {
     public String getDisplayName() {
-        return "Smelting";
+        return I18n.format("category.rei.smelting");
     }
     }
     
     
     @Override
     @Override
@@ -40,20 +41,20 @@ public class VanillaFurnaceCategory implements IDisplayCategory<VanillaFurnaceRe
     }
     }
     
     
     @Override
     @Override
-    public List<AEISlot> setupDisplay(int number) {
-        List<AEISlot> slots = new LinkedList<>();
-        AEISlot inputSlot = new AEISlot(50, 70 + number * 75);
+    public List<REISlot> setupDisplay(int number) {
+        List<REISlot> slots = new LinkedList<>();
+        REISlot inputSlot = new REISlot(50, 70 + number * 75);
         inputSlot.setStackList(recipes.get(number).getInput().get(0));
         inputSlot.setStackList(recipes.get(number).getInput().get(0));
         inputSlot.setDrawBackground(true);
         inputSlot.setDrawBackground(true);
         
         
-        AEISlot outputSlot = new AEISlot(110, 70 + number * 75);
+        REISlot outputSlot = new REISlot(110, 70 + number * 75);
         outputSlot.setStackList(recipes.get(number).getOutput());
         outputSlot.setStackList(recipes.get(number).getOutput());
         outputSlot.setDrawBackground(true);
         outputSlot.setDrawBackground(true);
         
         
-        AEISlot fuelSlot = new AEISlot(80, 100 + number * 75);
+        REISlot fuelSlot = new REISlot(80, 100 + number * 75);
         fuelSlot.setStackList(getFuel());
         fuelSlot.setStackList(getFuel());
         fuelSlot.setDrawBackground(true);
         fuelSlot.setDrawBackground(true);
-        fuelSlot.setExtraTooltip("Fuel");
+        fuelSlot.setExtraTooltip(I18n.format("category.rei.smelting.fuel"));
         
         
         slots.add(inputSlot);
         slots.add(inputSlot);
         slots.add(outputSlot);
         slots.add(outputSlot);
@@ -80,4 +81,9 @@ public class VanillaFurnaceCategory implements IDisplayCategory<VanillaFurnaceRe
     private List<ItemStack> getFuel() {
     private List<ItemStack> getFuel() {
         return TileEntityFurnace.getBurnTimes().keySet().stream().map(Item::getDefaultInstance).collect(Collectors.toList());
         return TileEntityFurnace.getBurnTimes().keySet().stream().map(Item::getDefaultInstance).collect(Collectors.toList());
     }
     }
+    
+    @Override
+    public ItemStack getCategoryIcon() {
+        return new ItemStack(Blocks.FURNACE.asItem());
+    }
 }
 }

+ 189 - 0
src/main/java/me/shedaniel/plugin/potion/VanillaPotionCategory.java

@@ -0,0 +1,189 @@
+package me.shedaniel.plugin.potion;
+
+import me.shedaniel.api.IDisplayCategory;
+import me.shedaniel.gui.REIRenderHelper;
+import me.shedaniel.gui.widget.Control;
+import me.shedaniel.gui.widget.REISlot;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.client.resources.I18n;
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.ResourceLocation;
+
+import java.awt.*;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+public class VanillaPotionCategory implements IDisplayCategory<VanillaPotionRecipe> {
+    private List<VanillaPotionRecipe> recipes = new ArrayList<>();
+    
+    @Override
+    public String getId() {
+        return "potion";
+    }
+    
+    @Override
+    public String getDisplayName() {
+        return I18n.format("category.rei.brewing");
+    }
+    
+    @Override
+    public void addRecipe(VanillaPotionRecipe recipe) {
+        recipes.add(recipe);
+    }
+    
+    @Override
+    public void resetRecipes() {
+        recipes = new ArrayList<>();
+    }
+    
+    @Override
+    public List<REISlot> setupDisplay(int number) {
+        List<REISlot> list = new LinkedList<>();
+        REISlot blazePowderSlot = new REISlot(32, 62 + number * 75);
+        blazePowderSlot.setDrawBackground(false);
+        blazePowderSlot.setStack(new ItemStack(Items.BLAZE_POWDER));
+        list.add(blazePowderSlot);
+        REISlot inputSlot = new REISlot(30 + 41, 62 + number * 75);
+        inputSlot.setDrawBackground(true);
+        inputSlot.setStackList(recipes.get(number).getInput().get(0));
+        list.add(inputSlot);
+        REISlot reactWithSlot = new REISlot(30 + 64, 62 + number * 75);
+        reactWithSlot.setDrawBackground(false);
+        reactWithSlot.setStackList(recipes.get(number).getInput().get(1));
+        list.add(reactWithSlot);
+        REISlot outputSlotOne = new REISlot(30 + 41, 62 + 34 + number * 75);
+        outputSlotOne.setDrawBackground(false);
+        outputSlotOne.setStackList(recipes.get(number).getOutput(0));
+        list.add(outputSlotOne);
+        REISlot outputSlotTwo = new REISlot(30 + 64, 62 + 41 + number * 75);
+        outputSlotTwo.setDrawBackground(false);
+        outputSlotTwo.setStackList(recipes.get(number).getOutput(1));
+        list.add(outputSlotTwo);
+        return new LinkedList<>();
+    }
+    
+    @Override
+    public boolean canDisplay(VanillaPotionRecipe recipe) {
+        return false;
+    }
+    
+    @Override
+    public void drawExtras() {
+    
+    }
+    
+    private static final ResourceLocation RECIPE_GUI = new ResourceLocation("textures/gui/container/brewing_stand.png");
+    
+    @Override
+    public void addWidget(List<Control> controls, int number) {
+        controls.add(new PotionScreen(30, 60 + number * 75));
+        PotionSlot blazePowderSlot = new PotionSlot(32, 62 + number * 75);
+        blazePowderSlot.setDrawBackground(false);
+        blazePowderSlot.setExtraTooltip(getTooltip(SlotType.BLAZE_POWDER));
+        blazePowderSlot.setStack(new ItemStack(Items.BLAZE_POWDER));
+        controls.add(blazePowderSlot);
+        PotionSlot inputSlot = new PotionSlot(30 + 41, 62 + number * 75);
+        inputSlot.setDrawBackground(true);
+        inputSlot.setExtraTooltip(getTooltip(SlotType.INPUT));
+        inputSlot.setStackList(recipes.get(number).getInput().get(0));
+        controls.add(inputSlot);
+        PotionSlot reactWithSlot = new PotionSlot(30 + 63, 62 + number * 75);
+        reactWithSlot.setDrawBackground(false);
+        reactWithSlot.setExtraTooltip(getTooltip(SlotType.REACT));
+        reactWithSlot.setStackList(recipes.get(number).getInput().get(1));
+        controls.add(reactWithSlot);
+        PotionSlot outputSlotOne = new PotionSlot(30 + 40, 62 + 34 + number * 75);
+        outputSlotOne.setDrawBackground(false);
+        outputSlotOne.setExtraTooltip(getTooltip(SlotType.OUTPUT));
+        outputSlotOne.setDrawMiniBackground(true);
+        outputSlotOne.setStackList(recipes.get(number).getOutput(0));
+        controls.add(outputSlotOne);
+        PotionSlot outputSlotTwo = new PotionSlot(30 + 63, 62 + 41 + number * 75);
+        outputSlotTwo.setDrawBackground(false);
+        outputSlotTwo.setExtraTooltip(getTooltip(SlotType.OUTPUT));
+        outputSlotTwo.setDrawMiniBackground(true);
+        outputSlotTwo.setStackList(recipes.get(number).getOutput(1));
+        controls.add(outputSlotTwo);
+        PotionSlot outputSlotThree = new PotionSlot(30 + 86, 62 + 34 + number * 75);
+        outputSlotThree.setDrawBackground(false);
+        outputSlotThree.setExtraTooltip(getTooltip(SlotType.OUTPUT));
+        outputSlotThree.setDrawMiniBackground(true);
+        outputSlotThree.setStackList(recipes.get(number).getOutput(2));
+        controls.add(outputSlotThree);
+    }
+    
+    @Override
+    public ItemStack getCategoryIcon() {
+        return new ItemStack(Blocks.BREWING_STAND.asItem());
+    }
+    
+    private class PotionScreen extends Control {
+        
+        public PotionScreen(int x, int y) {
+            super(x, y, 103, 60);
+        }
+        
+        @Override
+        public void draw() {
+            GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
+            GlStateManager.disableLighting();
+            Minecraft.getInstance().getTextureManager().bindTexture(RECIPE_GUI);
+            this.drawTexturedModalRect(rect.x, rect.y, 16, 15, 103, 60, 0);
+            this.drawTexturedModalRect(rect.x + 97 - 16, rect.y + 16 - 15, 176, 0, 9, (int) (((double) System.currentTimeMillis() % 2800d / 2800d) * 28), 0);
+            this.drawTexturedModalRect(rect.x + 45, rect.y, 110, 15, 15, 27, 0);
+            this.drawTexturedModalRect(rect.x + 44, rect.y + 29, 176, 29, (int) (((double) System.currentTimeMillis() % 2800d / 2800d) * 18), 4, 0);
+        }
+    }
+    
+    private class PotionSlot extends REISlot {
+        
+        protected boolean drawMiniBackground = false;
+        
+        public PotionSlot(int x, int y) {
+            super(x, y);
+        }
+        
+        public void setDrawMiniBackground(boolean drawMiniBackground) {
+            this.drawMiniBackground = drawMiniBackground;
+        }
+        
+        @Override
+        public void draw() {
+            if (getStack().isEmpty())
+                return;
+            if (drawMiniBackground) {
+                Minecraft.getInstance().getTextureManager().bindTexture(RECIPE_GUI);
+                drawTexturedModalRect(rect.x + 1, rect.y + 1, 0 + 2, 222 + 2, rect.width - 4, rect.height - 4);
+            }
+            super.draw();
+        }
+        
+        @Override
+        protected void drawTooltip() {
+            List<String> toolTip = getTooltip();
+            toolTip.add(I18n.format("text.rei.mod", getMod()));
+            Point mouse = REIRenderHelper.getMouseLoc();
+            Minecraft.getInstance().currentScreen.drawHoveringText(toolTip, mouse.x, mouse.y);
+        }
+    }
+    
+    public static String getTooltip(SlotType slotType) {
+        switch (slotType) {
+            case INPUT:
+                return I18n.format("category.rei.brewing.input");
+            case REACT:
+                return I18n.format("category.rei.brewing.reactant");
+            case OUTPUT:
+                return I18n.format("category.rei.brewing.result");
+        }
+        return null;
+    }
+    
+    public enum SlotType {
+        INPUT, REACT, OUTPUT, BLAZE_POWDER;
+    }
+}

+ 48 - 0
src/main/java/me/shedaniel/plugin/potion/VanillaPotionRecipe.java

@@ -0,0 +1,48 @@
+package me.shedaniel.plugin.potion;
+
+import me.shedaniel.api.IRecipe;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+
+public class VanillaPotionRecipe implements IRecipe<ItemStack> {
+    
+    private ItemStack[] input, reactWith, output;
+    
+    @Override
+    public String getId() {
+        return "potion";
+    }
+    
+    public VanillaPotionRecipe(ItemStack[] input, ItemStack[] reactWith, ItemStack[] output) {
+        this.input = input;
+        this.reactWith = reactWith;
+        this.output = output;
+    }
+    
+    @Override
+    public List<ItemStack> getOutput() {
+        return Arrays.asList(output);
+    }
+    
+    @Override
+    public List<List<ItemStack>> getInput() {
+        List<List<ItemStack>> input = new LinkedList<>();
+        input.add(new ArrayList<>(Arrays.asList(this.input)));
+        input.add(new ArrayList<>(Arrays.asList(this.reactWith)));
+        return input;
+    }
+    
+    public List<ItemStack> getOutput(int slot) {
+        List<ItemStack> stack = new ArrayList<>();
+        for(int i = 0; i < slot * 2; i++)
+            stack.add(new ItemStack(Blocks.AIR));
+        for(int i = 0; i < 6 - slot * 2; i++)
+            stack.addAll(getOutput());
+        return stack;
+    }
+}

+ 14 - 6
src/main/resources/assets/almostenoughitems/lang/en_us.json

@@ -1,8 +1,16 @@
 {
 {
-  "key.aei.category":"Almost Enough Items",
-  "key.aei.recipe":"Show Recipe",
-  "key.aei.hide":"Hide/Show AEI",
-  "key.aei.use":"Show Uses",
-  "text.aei.cheat":"Cheat",
-  "text.aei.nocheat":"§4§mCheat"
+  "key.rei.category":"Roughly Enough Items",
+  "key.rei.recipe":"Show Recipe",
+  "key.rei.hide":"Hide/Show REI",
+  "key.rei.use":"Show Uses",
+  "text.rei.cheat":"Cheat",
+  "text.rei.nocheat":"§4§mCheat",
+  "text.rei.mod": "§9§o%s",
+  "category.rei.crafting": "Crafting",
+  "category.rei.smelting": "Smelting",
+  "category.rei.smelting.fuel": "§eFuel",
+  "category.rei.brewing": "Brewing",
+  "category.rei.brewing.input": "§eOriginal Potion",
+  "category.rei.brewing.reactant": "§eIngredient",
+  "category.rei.brewing.result": "§eResulted Potion"
 }
 }

+ 6 - 6
src/main/resources/assets/almostenoughitems/lang/fr_fr.json

@@ -1,8 +1,8 @@
 {
 {
-  "key.aei.category":"Almost Enough Items",
-  "key.aei.recipe":"Afficher la recette",
-  "key.aei.hide":"Masquer/afficher AEI",
-  "key.aei.use":"Afficher les utilisations",
-  "text.aei.cheat":"Triche",
-  "text.aei.nocheat":"§4§mTriche"
+  "key.rei.category":"Roughly Enough Items",
+  "key.rei.recipe":"Afficher la recette",
+  "key.rei.hide":"Masquer/afficher REI",
+  "key.rei.use":"Afficher les utilisations",
+  "text.rei.cheat":"Triche",
+  "text.rei.nocheat":"§4§mTriche"
 }
 }

+ 2 - 1
src/main/resources/mixins.roughlyenoughitems.json

@@ -6,7 +6,8 @@
   "package": "me.shedaniel.mixins",
   "package": "me.shedaniel.mixins",
   "refmap": "mixins.roughlyenoughitems.refmap.json",
   "refmap": "mixins.roughlyenoughitems.refmap.json",
   "mixins": [
   "mixins": [
-    "MixinDoneLoading"
+    "MixinDoneLoading",
+    "MixinPotionBrewing"
   ],
   ],
   "client": [
   "client": [
     "MixinGuiContainer",
     "MixinGuiContainer",

+ 1 - 1
src/main/resources/pack.mcmeta

@@ -1,6 +1,6 @@
 {
 {
   "pack": {
   "pack": {
     "pack_format": 4,
     "pack_format": 4,
-    "description": "Rift Mod List"
+    "description": "Roughly Enough Items"
   }
   }
 }
 }

+ 1 - 1
src/main/resources/riftmod.json

@@ -1,7 +1,7 @@
 {
 {
   "id": "roughlyenoughitems",
   "id": "roughlyenoughitems",
   "name": "RoughlyEnoughItems",
   "name": "RoughlyEnoughItems",
-  "version": "1.0b-SNAPSHOT",
+  "version": "1.0-SNAPSHOT",
   "authors": [
   "authors": [
     "ZenDarva",
     "ZenDarva",
     "Danielshe"
     "Danielshe"