Unknown 6 жил өмнө
parent
commit
86e9c7588d
83 өөрчлөгдсөн 249 нэмэгдсэн , 4609 устгасан
  1. 1 0
      .gitignore
  2. 1 1
      build.gradle
  3. 0 106
      src/main/java/me/shedaniel/ClientListener.java
  4. 0 122
      src/main/java/me/shedaniel/Core.java
  5. 0 32
      src/main/java/me/shedaniel/api/IDisplayCategory.java
  6. 0 19
      src/main/java/me/shedaniel/api/IDisplayCategoryCraftable.java
  7. 0 12
      src/main/java/me/shedaniel/api/IDrawable.java
  8. 0 16
      src/main/java/me/shedaniel/api/IREIPlugin.java
  9. 0 20
      src/main/java/me/shedaniel/api/IRecipe.java
  10. 0 21
      src/main/java/me/shedaniel/api/IRecipeManager.java
  11. 0 8
      src/main/java/me/shedaniel/api/TriBooleanSupplier.java
  12. 0 22
      src/main/java/me/shedaniel/config/REIConfig.java
  13. 0 21
      src/main/java/me/shedaniel/config/REIItemListOrdering.java
  14. 0 8
      src/main/java/me/shedaniel/config/REIRuntimeConfig.java
  15. 0 154
      src/main/java/me/shedaniel/gui/ConfigGui.java
  16. 0 35
      src/main/java/me/shedaniel/gui/Drawable.java
  17. 0 397
      src/main/java/me/shedaniel/gui/GuiItemList.java
  18. 0 280
      src/main/java/me/shedaniel/gui/REIRenderHelper.java
  19. 0 14
      src/main/java/me/shedaniel/gui/RecipeContainer.java
  20. 0 287
      src/main/java/me/shedaniel/gui/RecipeGui.java
  21. 0 36
      src/main/java/me/shedaniel/gui/SearchArgument.java
  22. 0 63
      src/main/java/me/shedaniel/gui/widget/Button.java
  23. 0 127
      src/main/java/me/shedaniel/gui/widget/Control.java
  24. 0 76
      src/main/java/me/shedaniel/gui/widget/CraftableToggleButton.java
  25. 0 12
      src/main/java/me/shedaniel/gui/widget/IFocusable.java
  26. 0 59
      src/main/java/me/shedaniel/gui/widget/KeyBindButton.java
  27. 0 188
      src/main/java/me/shedaniel/gui/widget/REISlot.java
  28. 0 73
      src/main/java/me/shedaniel/gui/widget/SmallButton.java
  29. 0 101
      src/main/java/me/shedaniel/gui/widget/Tab.java
  30. 0 85
      src/main/java/me/shedaniel/gui/widget/TextBox.java
  31. 0 50
      src/main/java/me/shedaniel/gui/widget/WidgetArrow.java
  32. 0 220
      src/main/java/me/shedaniel/impl/REIRecipeManager.java
  33. 0 23
      src/main/java/me/shedaniel/library/KeyBindFunction.java
  34. 0 8
      src/main/java/me/shedaniel/library/Sink.java
  35. 0 10
      src/main/java/me/shedaniel/listenerdefinitions/CharInput.java
  36. 0 7
      src/main/java/me/shedaniel/listenerdefinitions/ClientTickable.java
  37. 0 10
      src/main/java/me/shedaniel/listenerdefinitions/DoneLoading.java
  38. 0 12
      src/main/java/me/shedaniel/listenerdefinitions/DrawContainer.java
  39. 0 10
      src/main/java/me/shedaniel/listenerdefinitions/GuiClick.java
  40. 0 10
      src/main/java/me/shedaniel/listenerdefinitions/GuiKeyDown.java
  41. 0 7
      src/main/java/me/shedaniel/listenerdefinitions/GuiMouseScroll.java
  42. 0 4
      src/main/java/me/shedaniel/listenerdefinitions/IEvent.java
  43. 0 20
      src/main/java/me/shedaniel/listenerdefinitions/IMixinContainerGui.java
  44. 0 9
      src/main/java/me/shedaniel/listenerdefinitions/IMixinRecipeBookGui.java
  45. 0 10
      src/main/java/me/shedaniel/listenerdefinitions/MinecraftResize.java
  46. 0 10
      src/main/java/me/shedaniel/listenerdefinitions/PotionCraftingAdder.java
  47. 0 9
      src/main/java/me/shedaniel/listenerdefinitions/RecipeLoadListener.java
  48. 0 65
      src/main/java/me/shedaniel/listeners/DrawContainerListener.java
  49. 0 21
      src/main/java/me/shedaniel/mixins/MixinBrewingRecipeRegistry.java
  50. 0 97
      src/main/java/me/shedaniel/mixins/MixinContainerGui.java
  51. 0 64
      src/main/java/me/shedaniel/mixins/MixinCreativePlayerInventoryGui.java
  52. 0 23
      src/main/java/me/shedaniel/mixins/MixinDoneLoading.java
  53. 0 29
      src/main/java/me/shedaniel/mixins/MixinKeyboardListener.java
  54. 0 31
      src/main/java/me/shedaniel/mixins/MixinMinecraftResize.java
  55. 0 20
      src/main/java/me/shedaniel/mixins/MixinRecipeBookGui.java
  56. 0 27
      src/main/java/me/shedaniel/mixins/MixinRecipeManager.java
  57. 0 49
      src/main/java/me/shedaniel/network/CheatPacket.java
  58. 0 33
      src/main/java/me/shedaniel/network/DeletePacket.java
  59. 0 40
      src/main/java/me/shedaniel/plugin/RandomRecipe.java
  60. 0 70
      src/main/java/me/shedaniel/plugin/TestRandomCategory.java
  61. 0 105
      src/main/java/me/shedaniel/plugin/VanillaPlugin.java
  62. 0 126
      src/main/java/me/shedaniel/plugin/blastfurnace/VanillaBlastFurnaceCategory.java
  63. 0 58
      src/main/java/me/shedaniel/plugin/blastfurnace/VanillaBlastFurnaceRecipe.java
  64. 0 157
      src/main/java/me/shedaniel/plugin/crafting/VanillaCraftingCategory.java
  65. 0 28
      src/main/java/me/shedaniel/plugin/crafting/VanillaCraftingRecipe.java
  66. 0 59
      src/main/java/me/shedaniel/plugin/crafting/VanillaShapedCraftingRecipe.java
  67. 0 61
      src/main/java/me/shedaniel/plugin/crafting/VanillaShapelessCraftingRecipe.java
  68. 0 126
      src/main/java/me/shedaniel/plugin/furnace/VanillaFurnaceCategory.java
  69. 0 60
      src/main/java/me/shedaniel/plugin/furnace/VanillaFurnaceRecipe.java
  70. 0 189
      src/main/java/me/shedaniel/plugin/potion/VanillaPotionCategory.java
  71. 0 56
      src/main/java/me/shedaniel/plugin/potion/VanillaPotionRecipe.java
  72. 0 126
      src/main/java/me/shedaniel/plugin/smoker/VanillaSmokerCategory.java
  73. 0 55
      src/main/java/me/shedaniel/plugin/smoker/VanillaSmokerRecipe.java
  74. 46 0
      src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java
  75. 68 0
      src/main/java/me/shedaniel/rei/gui/ContainerGuiOverlay.java
  76. 9 0
      src/main/java/me/shedaniel/rei/gui/widget/IWidget.java
  77. 24 0
      src/main/java/me/shedaniel/rei/gui/widget/LabelWidget.java
  78. 9 0
      src/main/java/me/shedaniel/rei/listeners/ClientTick.java
  79. 4 0
      src/main/java/me/shedaniel/rei/listeners/IListener.java
  80. 17 0
      src/main/java/me/shedaniel/rei/mixin/IMixinContainerGui.java
  81. 67 0
      src/main/java/me/shedaniel/rei/mixin/MixinContainerGui.java
  82. 1 1
      src/main/resources/fabric.mod.json
  83. 2 9
      src/main/resources/roughlyenoughitems.client.json

+ 1 - 0
.gitignore

@@ -6,6 +6,7 @@
 /out
 /run
 /classes
+/old
 
 # IDE nonsense that could go in source control but really shouldn't
 .classpath

+ 1 - 1
build.gradle

@@ -6,7 +6,7 @@ sourceCompatibility = 1.8
 targetCompatibility = 1.8
 
 archivesBaseName = "RoughlyEnoughItems"
-version = "1.5.1-21"
+version = "2.0-22"
 
 minecraft {
 }

+ 0 - 106
src/main/java/me/shedaniel/ClientListener.java

@@ -1,106 +0,0 @@
-package me.shedaniel;
-
-import me.shedaniel.api.IREIPlugin;
-import me.shedaniel.gui.REIRenderHelper;
-import me.shedaniel.impl.REIRecipeManager;
-import me.shedaniel.library.KeyBindFunction;
-import me.shedaniel.listenerdefinitions.DoneLoading;
-import me.shedaniel.listenerdefinitions.RecipeLoadListener;
-import net.minecraft.enchantment.Enchantment;
-import net.minecraft.enchantment.EnchantmentHelper;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.item.Items;
-import net.minecraft.recipe.RecipeManager;
-import net.minecraft.util.DefaultedList;
-import net.minecraft.util.registry.Registry;
-
-import java.util.*;
-
-public class ClientListener implements DoneLoading, RecipeLoadListener {
-    
-    public static KeyBindFunction recipeKeyBind;
-    public static KeyBindFunction hideKeyBind;
-    public static KeyBindFunction usageKeyBind;
-    public static List<KeyBindFunction> keyBinds = new ArrayList<>();
-    
-    private List<IREIPlugin> plugins;
-    public static List<ItemStack> stackList;
-    
-    public static boolean processGuiKeyBinds(int typedChar) {
-        for(KeyBindFunction keyBind : keyBinds)
-            if (keyBind.apply(typedChar))
-                return true;
-        return false;
-    }
-    
-    @Override
-    public void onDoneLoading() {
-        plugins = new ArrayList<>();
-        stackList = new ArrayList<>();
-        
-        buildItemList();
-    }
-    
-    public void onInitializeKeyBind() {
-        recipeKeyBind = new KeyBindFunction(Core.config.recipeKeyBind) {
-            @Override
-            public boolean apply(int key) {
-                if (key == this.getKey())
-                    REIRenderHelper.recipeKeyBind();
-                return key == this.getKey();
-            }
-        };
-        hideKeyBind = new KeyBindFunction(Core.config.hideKeyBind) {
-            @Override
-            public boolean apply(int key) {
-                if (key == this.getKey())
-                    REIRenderHelper.hideKeyBind();
-                return key == this.getKey();
-            }
-        };
-        usageKeyBind = new KeyBindFunction(Core.config.usageKeyBind) {
-            @Override
-            public boolean apply(int key) {
-                if (key == this.getKey())
-                    REIRenderHelper.useKeyBind();
-                return key == this.getKey();
-            }
-        };
-        keyBinds.addAll(Arrays.asList(recipeKeyBind, hideKeyBind, usageKeyBind));
-    }
-    
-    private void buildItemList() {
-        if (!Registry.ITEM.isEmpty())
-            Registry.ITEM.forEach(this::processItem);
-        if (Registry.ENCHANTMENT.stream().count() > 0)
-            Registry.ENCHANTMENT.forEach(enchantment -> {
-                for(int i = enchantment.getMinimumLevel(); i < enchantment.getMaximumLevel(); i++) {
-                    ItemStack stack = new ItemStack(Items.ENCHANTED_BOOK);
-                    Map<Enchantment, Integer> map = new HashMap<>();
-                    map.put(enchantment, i);
-                    EnchantmentHelper.set(map, stack);
-                    processItemStack(stack);
-                }
-            });
-    }
-    
-    private void processItem(Item item) {
-        DefaultedList<ItemStack> items = DefaultedList.create();
-        try {
-            item.addStacksForDisplay(item.getItemGroup(), items);
-            items.forEach(stackList::add);
-        } catch (NullPointerException e) {
-        }
-    }
-    
-    private void processItemStack(ItemStack item) {
-        stackList.add(item);
-    }
-    
-    @Override
-    public void recipesLoaded(RecipeManager recipeManager) {
-        REIRecipeManager.instance().RecipesLoaded(recipeManager);
-    }
-    
-}

+ 0 - 122
src/main/java/me/shedaniel/Core.java

@@ -1,122 +0,0 @@
-package me.shedaniel;
-
-import me.shedaniel.config.REIConfig;
-import me.shedaniel.config.REIRuntimeConfig;
-import me.shedaniel.listenerdefinitions.ClientTickable;
-import me.shedaniel.listenerdefinitions.IEvent;
-import me.shedaniel.listeners.DrawContainerListener;
-import me.shedaniel.network.CheatPacket;
-import me.shedaniel.plugin.VanillaPlugin;
-import net.fabricmc.api.ClientModInitializer;
-import net.fabricmc.fabric.events.client.ClientTickEvent;
-import net.fabricmc.loader.FabricLoader;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.item.ItemStack;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.nio.file.Files;
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * Created by James on 7/27/2018.
- */
-public class Core implements ClientModInitializer {
-    
-    private static List<IEvent> events = new LinkedList<>();
-    public static final File configFile = new File(FabricLoader.INSTANCE.getConfigDirectory(), "rei.json");
-    public static REIConfig config;
-    public static REIRuntimeConfig runtimeConfig;
-    public static ClientListener clientListener;
-    public static Logger LOGGER = LogManager.getFormatterLogger("REI");
-    
-    @Override
-    public void onInitializeClient() {
-        this.clientListener = new ClientListener();
-        registerSelfEvents();
-        registerFabricEvents();
-        try {
-            loadConfig();
-            runtimeConfig = new REIRuntimeConfig();
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-        this.clientListener.onInitializeKeyBind();
-    }
-    
-    private void registerFabricEvents() {
-        ClientTickEvent.CLIENT.register(minecraftClient -> {
-            getListeners(ClientTickable.class).forEach(ClientTickable::clientTick);
-            if (!Core.config.enableCraftableOnlyButton)
-                Core.runtimeConfig.craftableOnly = false;
-        });
-    }
-    
-    private void registerSelfEvents() {
-        registerEvent(new DrawContainerListener());
-        registerEvent(clientListener);
-        registerPlugin(new VanillaPlugin());
-    }
-    
-    public static void registerPlugin(VanillaPlugin vanillaPlugin) {
-        registerEvent(vanillaPlugin);
-    }
-    
-    private static void registerEvent(IEvent event) {
-        events.add(event);
-    }
-    
-    public static <T> List<T> getListeners(Class<T> listenerInterface) {
-        List<T> list = new ArrayList<>();
-        events.forEach(iEvent -> {
-            if (listenerInterface.isAssignableFrom(iEvent.getClass()))
-                list.add(listenerInterface.cast(iEvent));
-        });
-        return list;
-    }
-    
-    public static void loadConfig() throws IOException {
-        if (!configFile.exists() || !configFile.canRead()) {
-            config = new REIConfig();
-            saveConfig();
-            return;
-        }
-        boolean failed = false;
-        try {
-            config = REIConfig.GSON.fromJson(new InputStreamReader(Files.newInputStream(configFile.toPath())), REIConfig.class);
-        } catch (Exception e) {
-            failed = true;
-        }
-        if (failed || config == null) {
-            Core.LOGGER.error("REI: Failed to load config! Overwriting with default config.");
-            config = new REIConfig();
-        }
-        saveConfig();
-    }
-    
-    public static void saveConfig() throws IOException {
-        configFile.getParentFile().mkdirs();
-        if (!configFile.exists() && !configFile.createNewFile()) {
-            Core.LOGGER.error("REI: Failed to save config! Overwriting with default config.");
-            config = new REIConfig();
-            return;
-        }
-        FileWriter writer = new FileWriter(configFile, false);
-        try {
-            REIConfig.GSON.toJson(config, writer);
-        } finally {
-            writer.close();
-        }
-    }
-    
-    public static void cheatItems(ItemStack cheatedStack) {
-        MinecraftClient.getInstance().getNetworkHandler().sendPacket(new CheatPacket(cheatedStack));
-    }
-    
-}

+ 0 - 32
src/main/java/me/shedaniel/api/IDisplayCategory.java

@@ -1,32 +0,0 @@
-package me.shedaniel.api;
-
-import me.shedaniel.gui.widget.Control;
-import me.shedaniel.gui.widget.REISlot;
-import net.minecraft.item.ItemStack;
-
-import java.util.List;
-
-/**
- * Created by James on 8/7/2018.
- */
-public interface IDisplayCategory<T extends IRecipe> {
-    
-    public String getId();
-    
-    public String getDisplayName();
-    
-    public void addRecipe(T recipe);
-    
-    public void resetRecipes();
-    
-    public List<REISlot> setupDisplay(int number);
-    
-    public boolean canDisplay(T recipe);
-    
-    public void drawExtras();
-    
-    public void addWidget(List<Control> controls, int number);
-    
-    public ItemStack getCategoryIcon();
-    
-}

+ 0 - 19
src/main/java/me/shedaniel/api/IDisplayCategoryCraftable.java

@@ -1,19 +0,0 @@
-package me.shedaniel.api;
-
-import me.shedaniel.api.IDisplayCategory;
-import me.shedaniel.api.IRecipe;
-import me.shedaniel.gui.RecipeGui;
-import me.shedaniel.gui.widget.Control;
-import net.minecraft.client.gui.Gui;
-
-import java.util.List;
-
-public interface IDisplayCategoryCraftable<T extends IRecipe> extends IDisplayCategory<T> {
-    
-    public boolean canAutoCraftHere(Class<? extends Gui> guiClass, T recipe);
-    
-    public boolean performAutoCraft(Gui gui, T recipe);
-    
-    public void registerAutoCraftButton(List<Control> control, RecipeGui recipeGui, Gui parentGui, T recipe, int number);
-    
-}

+ 0 - 12
src/main/java/me/shedaniel/api/IDrawable.java

@@ -1,12 +0,0 @@
-package me.shedaniel.api;
-
-/**
- * Created by James on 8/7/2018.
- */
-public interface IDrawable {
-    
-    public void draw();
-    
-    public boolean isHighlighted();
-    
-}

+ 0 - 16
src/main/java/me/shedaniel/api/IREIPlugin.java

@@ -1,16 +0,0 @@
-package me.shedaniel.api;
-
-import me.shedaniel.listenerdefinitions.IEvent;
-
-/**
- * Created by James on 7/27/2018.
- */
-public interface IREIPlugin extends IEvent {
-    
-    public void registerCategories();
-    
-    public void registerRecipes();
-    
-    public void registerSpecialGuiExclusion();
-    
-}

+ 0 - 20
src/main/java/me/shedaniel/api/IRecipe.java

@@ -1,20 +0,0 @@
-package me.shedaniel.api;
-
-import net.minecraft.item.ItemStack;
-
-import java.util.List;
-
-/**
- * Created by James on 7/27/2018.
- */
-public interface IRecipe<T> {
-
-    public String getId();
-
-    public List<T> getOutput();
-
-    public List<List<T>> getInput();
-    
-    public List<List<ItemStack>> getRecipeRequiredInput();
-    
-}

+ 0 - 21
src/main/java/me/shedaniel/api/IRecipeManager.java

@@ -1,21 +0,0 @@
-package me.shedaniel.api;
-
-import net.minecraft.item.ItemStack;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * Created by James on 8/5/2018.
- */
-public interface IRecipeManager {
-    
-    public void addRecipe(String id, IRecipe recipe);
-    
-    public void addRecipe(String id, List<? extends IRecipe> recipes);
-    
-    public void addDisplayAdapter(IDisplayCategory adapter);
-    
-    public Map<IDisplayCategory, List<IRecipe>> getRecipesFor(ItemStack stack);
-    
-}

+ 0 - 8
src/main/java/me/shedaniel/api/TriBooleanSupplier.java

@@ -1,8 +0,0 @@
-package me.shedaniel.api;
-
-/**
- * Created by James on 8/4/2018.
- */
-public interface TriBooleanSupplier {
-    public boolean accept(int first, int second, int third);
-}

+ 0 - 22
src/main/java/me/shedaniel/config/REIConfig.java

@@ -1,22 +0,0 @@
-package me.shedaniel.config;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-
-import java.awt.event.KeyEvent;
-
-public class REIConfig {
-    
-    public static Gson GSON = new GsonBuilder()
-            .setPrettyPrinting()
-            .create();
-    
-    public int recipeKeyBind = KeyEvent.VK_R;
-    public int usageKeyBind = KeyEvent.VK_U;
-    public int hideKeyBind = KeyEvent.VK_O;
-    public boolean centreSearchBox = false;
-    public REIItemListOrdering itemListOrdering = REIItemListOrdering.REGISTRY;
-    public boolean isAscending = true;
-    public boolean enableCraftableOnlyButton = true;
-    
-}

+ 0 - 21
src/main/java/me/shedaniel/config/REIItemListOrdering.java

@@ -1,21 +0,0 @@
-package me.shedaniel.config;
-
-import com.google.gson.annotations.SerializedName;
-
-public enum REIItemListOrdering {
-    
-    @SerializedName("registry") REGISTRY("ordering.rei.registry"),
-    @SerializedName("name") NAME("ordering.rei.name"),
-    @SerializedName("item_groups") ITEM_GROUPS("ordering.rei.item_groups");
-    
-    private String nameTranslationKey;
-    
-    REIItemListOrdering(String nameTranslationKey) {
-        this.nameTranslationKey = nameTranslationKey;
-    }
-    
-    public String getNameTranslationKey() {
-        return nameTranslationKey;
-    }
-    
-}

+ 0 - 8
src/main/java/me/shedaniel/config/REIRuntimeConfig.java

@@ -1,8 +0,0 @@
-package me.shedaniel.config;
-
-public class REIRuntimeConfig {
-    
-    public boolean craftableOnly = false;
-    public boolean centreSearchBox = false;
-    
-}

+ 0 - 154
src/main/java/me/shedaniel/gui/ConfigGui.java

@@ -1,154 +0,0 @@
-package me.shedaniel.gui;
-
-import me.shedaniel.ClientListener;
-import me.shedaniel.Core;
-import me.shedaniel.config.REIItemListOrdering;
-import me.shedaniel.gui.widget.KeyBindButton;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.gui.Gui;
-import net.minecraft.client.gui.widget.ButtonWidget;
-import net.minecraft.client.render.GuiLighting;
-import net.minecraft.client.resource.language.I18n;
-
-import java.io.IOException;
-import java.util.Arrays;
-
-public class ConfigGui extends Gui {
-    
-    private Gui parent;
-    
-    public ConfigGui(Gui parent) {
-        this.parent = parent;
-    }
-    
-    @Override
-    protected void onInitialized() {
-        addButton(new KeyBindButton(997, parent.width / 2 - 20, 30, 80, 20, Core.config.recipeKeyBind, key -> {
-            Core.config.recipeKeyBind = key;
-            ClientListener.recipeKeyBind.setKey(key);
-            try {
-                Core.saveConfig();
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-        }));
-        addButton(new KeyBindButton(998, parent.width / 2 - 20, 60, 80, 20, Core.config.usageKeyBind, key -> {
-            Core.config.usageKeyBind = key;
-            ClientListener.usageKeyBind.setKey(key);
-            try {
-                Core.saveConfig();
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-        }));
-        addButton(new KeyBindButton(999, parent.width / 2 - 20, 90, 80, 20, Core.config.hideKeyBind, key -> {
-            Core.config.hideKeyBind = key;
-            ClientListener.hideKeyBind.setKey(key);
-            try {
-                Core.saveConfig();
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-        }));
-        addButton(new ButtonWidget(1000, parent.width / 2 - 90, 120, 150, 20, "") {
-            @Override
-            public void onPressed(double double_1, double double_2) {
-                Core.config.centreSearchBox = !Core.config.centreSearchBox;
-                try {
-                    Core.saveConfig();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-            
-            @Override
-            public void draw(int int_1, int int_2, float float_1) {
-                this.text = I18n.translate("text.rei.centre_searchbox", Core.config.centreSearchBox ? "§a" : "§c", Core.config.centreSearchBox);
-                super.draw(int_1, int_2, float_1);
-                if (this.hovered)
-                    drawSuggestion(int_1, int_2);
-            }
-            
-            protected void drawSuggestion(int x, int y) {
-                drawTooltip(Arrays.asList(I18n.translate("text.rei.centre_searchbox.tooltip").split("\n")), x, y);
-            }
-        });
-        addButton(new ButtonWidget(1001, parent.width / 2 - 90, 150, 150, 20, "") {
-            @Override
-            public void onPressed(double double_1, double double_2) {
-                Core.config.enableCraftableOnlyButton = !Core.config.enableCraftableOnlyButton;
-                try {
-                    Core.saveConfig();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-            
-            @Override
-            public void draw(int int_1, int int_2, float float_1) {
-                GuiLighting.disable();
-                this.text = I18n.translate("text.rei.enable_craftable_only.button", Core.config.enableCraftableOnlyButton ? "§a" : "§c", Core.config.enableCraftableOnlyButton);
-                super.draw(int_1, int_2, float_1);
-                if (this.hovered)
-                    drawSuggestion(int_1, int_2);
-            }
-            
-            protected void drawSuggestion(int x, int y) {
-                drawTooltip(Arrays.asList(I18n.translate("text.rei.enable_craftable_only.tooltip").split("\n")), x, y);
-            }
-        });
-        addButton(new ButtonWidget(1002, parent.width / 2 - 90, 180, 150, 20, "") {
-            @Override
-            public void onPressed(double double_1, double double_2) {
-                int index = Arrays.asList(REIItemListOrdering.values()).indexOf(Core.config.itemListOrdering) + 1;
-                if (index >= REIItemListOrdering.values().length) {
-                    index = 0;
-                    Core.config.isAscending = !Core.config.isAscending;
-                }
-                Core.config.itemListOrdering = REIItemListOrdering.values()[index];
-                try {
-                    Core.saveConfig();
-                    REIRenderHelper.reiGui.updateView();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-            
-            @Override
-            public void draw(int int_1, int int_2, float float_1) {
-                GuiLighting.disable();
-                this.text = I18n.translate("text.rei.list_ordering_button", I18n.translate(Core.config.itemListOrdering.getNameTranslationKey()),
-                        I18n.translate(Core.config.isAscending ? "ordering.rei.ascending" : "ordering.rei.descending"));
-                super.draw(int_1, int_2, float_1);
-            }
-        });
-    }
-    
-    @Override
-    public void draw(int mouseX, int mouseY, float partialTicks) {
-        drawBackground();
-        super.draw(mouseX, mouseY, partialTicks);
-        GuiLighting.disable();
-        String text = I18n.translate("key.rei.recipe") + ": ";
-        drawString(MinecraftClient.getInstance().fontRenderer, text, parent.width / 2 - 25 - MinecraftClient.getInstance().fontRenderer.getStringWidth(text), 30 + 6, -1);
-        text = I18n.translate("key.rei.use") + ": ";
-        drawString(MinecraftClient.getInstance().fontRenderer, text, parent.width / 2 - 25 - MinecraftClient.getInstance().fontRenderer.getStringWidth(text), 60 + 6, -1);
-        text = I18n.translate("key.rei.hide") + ": ";
-        drawString(MinecraftClient.getInstance().fontRenderer, text, parent.width / 2 - 25 - MinecraftClient.getInstance().fontRenderer.getStringWidth(text), 90 + 6, -1);
-        text = I18n.translate("text.rei.list_ordering") + ": ";
-        drawString(MinecraftClient.getInstance().fontRenderer, text, parent.width / 2 - 95 - MinecraftClient.getInstance().fontRenderer.getStringWidth(text), 180 + 6, -1);
-    }
-    
-    @Override
-    public boolean keyPressed(int p_keyPressed_1_, int p_keyPressed_2_, int p_keyPressed_3_) {
-        if (p_keyPressed_1_ == 256 && this.doesEscapeKeyClose()) {
-            this.close();
-            if (parent != null)
-                MinecraftClient.getInstance().openGui(parent);
-            return true;
-        } else {
-            return super.keyPressed(p_keyPressed_1_, p_keyPressed_2_, p_keyPressed_3_);
-        }
-    }
-    
-}

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

@@ -1,35 +0,0 @@
-package me.shedaniel.gui;
-
-import me.shedaniel.api.IDrawable;
-import me.shedaniel.gui.widget.Control;
-
-import java.awt.*;
-
-/**
- * Created by James on 7/28/2018.
- */
-public abstract class Drawable implements IDrawable {
-    
-    protected Rectangle rect;
-    
-    public Drawable(int x, int y, int width, int height) {
-        rect = new Rectangle(x, y, width, height);
-    }
-    
-    public Drawable(Rectangle rect) {
-        this.rect = rect;
-    }
-    
-    public abstract void draw();
-    
-    public boolean isHighlighted() {
-        Point mousePoint = REIRenderHelper.getMouseLoc();
-        if (rect.contains(mousePoint.x, mousePoint.y)) {
-            if (this instanceof Control)
-                REIRenderHelper.reiGui.setLastHovered((Control) this);
-            return true;
-        }
-        return false;
-    }
-    
-}

+ 0 - 397
src/main/java/me/shedaniel/gui/GuiItemList.java

@@ -1,397 +0,0 @@
-package me.shedaniel.gui;
-
-import com.google.common.collect.ImmutableList;
-import com.mojang.blaze3d.platform.GlStateManager;
-import me.shedaniel.ClientListener;
-import me.shedaniel.Core;
-import me.shedaniel.config.REIItemListOrdering;
-import me.shedaniel.gui.widget.*;
-import me.shedaniel.gui.widget.Button;
-import me.shedaniel.impl.REIRecipeManager;
-import me.shedaniel.listenerdefinitions.IMixinContainerGui;
-import net.fabricmc.fabric.client.itemgroup.FabricCreativeGuiComponents;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.gui.ContainerGui;
-import net.minecraft.client.network.ClientPlayerEntity;
-import net.minecraft.client.render.GuiLighting;
-import net.minecraft.client.resource.language.I18n;
-import net.minecraft.client.util.Window;
-import net.minecraft.item.ItemGroup;
-import net.minecraft.item.ItemStack;
-import net.minecraft.item.Items;
-import net.minecraft.util.DefaultedList;
-import net.minecraft.util.Identifier;
-import net.minecraft.util.math.MathHelper;
-import net.minecraft.util.registry.Registry;
-
-import java.awt.*;
-import java.util.*;
-import java.util.List;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-public class GuiItemList extends Drawable {
-    
-    public final int FOOTERSIZE;
-    private ContainerGui overlayedGui;
-    private static int page = 0;
-    private ArrayList<REISlot> displaySlots;
-    protected ArrayList<Control> controls;
-    private boolean needsResize = false;
-    Button buttonLeft, buttonRight, buttonCheating, buttonConfig;
-    private TextBox searchBox;
-    private ArrayList<ItemStack> view;
-    private Control lastHovered;
-    protected boolean visible = true;
-    private int oldGuiLeft = 0;
-    private boolean cheatMode = false;
-    private List<ItemStack> lastPlayerItems = new ArrayList<>();
-    
-    public GuiItemList(ContainerGui overlayedGui) {
-        super(calculateRect(overlayedGui));
-        FOOTERSIZE = Core.runtimeConfig.centreSearchBox ? 18 : 44;
-        displaySlots = new ArrayList<>();
-        controls = new ArrayList<>();
-        this.overlayedGui = overlayedGui;
-        view = new ArrayList<>();
-        resize();
-    }
-    
-    public boolean canCheat() {
-        ClientPlayerEntity player = MinecraftClient.getInstance().player;
-        if (cheatMode) {
-            if (!player.allowsPermissionLevel(1)) {
-                cheatClicked(0);
-                return false;
-            }
-            return true;
-        }
-        return false;
-    }
-    
-    private static Rectangle calculateRect(ContainerGui overlayedGui) {
-        Window res = REIRenderHelper.getResolution();
-        int startX = (((IMixinContainerGui) overlayedGui).getGuiLeft() + ((IMixinContainerGui) overlayedGui).getXSize()) + 10;
-        int width = res.getScaledWidth() - startX;
-        return new Rectangle(startX, 0, width, res.getScaledHeight());
-    }
-    
-    protected void resize() {
-        Window res = REIRenderHelper.getResolution();
-        
-        if (overlayedGui != MinecraftClient.getInstance().currentGui) {
-            if (MinecraftClient.getInstance().currentGui instanceof ContainerGui) {
-                overlayedGui = (ContainerGui) MinecraftClient.getInstance().currentGui;
-            } else {
-                needsResize = true;
-                return;
-            }
-        }
-        oldGuiLeft = ((IMixinContainerGui) overlayedGui).getGuiLeft();
-        rect = calculateRect(overlayedGui);
-        page = 0;
-        buttonLeft = new Button(rect.x, rect.y + 3, 16, 20, "<");
-        buttonLeft.onClick = this::btnLeftClicked;
-        buttonRight = new Button(rect.x + rect.width - 18, rect.y + 3, 16, 20, ">");
-        buttonRight.onClick = this::btnRightClicked;
-        controls.clear();
-        controls.add(buttonLeft);
-        controls.add(buttonRight);
-        String savedText = "";
-        if (searchBox != null) {
-            savedText = searchBox.getText();
-        }
-        searchBox = new TextBox(getSearchBoxArea());
-        searchBox.setText(savedText);
-        if (Core.config.enableCraftableOnlyButton) {
-            CraftableToggleButton buttonCraftableOnly = new CraftableToggleButton(getCraftableToggleArea());
-            buttonCraftableOnly.setOnClick(i -> {
-                Core.runtimeConfig.craftableOnly = !Core.runtimeConfig.craftableOnly;
-                REIRenderHelper.updateSearch();
-                return true;
-            });
-            controls.add(buttonCraftableOnly);
-        }
-        controls.add(searchBox);
-        buttonCheating = new Button(5, 5, 45, 20, getCheatModeText());
-        buttonCheating.onClick = this::cheatClicked;
-        buttonConfig = new Button(5, 28, 45, 20, I18n.translate("text.rei.config"));
-        buttonConfig.onClick = i -> {
-            MinecraftClient.getInstance().openGui(null);
-            MinecraftClient.getInstance().openGui(new ConfigGui(overlayedGui));
-            return true;
-        };
-        controls.add(buttonConfig);
-        controls.add(buttonCheating);
-        calculateSlots();
-        updateView();
-        fillSlots();
-        controls.addAll(displaySlots);
-    }
-    
-    private Rectangle getSearchBoxArea() {
-        int widthOffset = Core.config.enableCraftableOnlyButton ? -24 : 0;
-        int ch = ((IMixinContainerGui) overlayedGui).getContainerHeight(), cw = ((IMixinContainerGui) overlayedGui).getContainerWidth();
-        if (Core.runtimeConfig.centreSearchBox) {
-            if (ch + 4 + 18 > MinecraftClient.getInstance().window.getScaledHeight()) //Will be out of bounds
-                return new Rectangle(overlayedGui.width / 2 - cw / 2, rect.height + 100, cw + widthOffset, 18);
-            return new Rectangle(overlayedGui.width / 2 - cw / 2, rect.height - 31, cw + widthOffset, 18);
-        }
-        return new Rectangle(rect.x, rect.height - 31, rect.width - 4 + widthOffset, 18);
-    }
-    
-    private Rectangle getCraftableToggleArea() {
-        Rectangle searchBoxArea = getSearchBoxArea();
-        searchBoxArea.setLocation(searchBoxArea.x + searchBoxArea.width + 4, searchBoxArea.y - 1);
-        searchBoxArea.setSize(20, 20);
-        return searchBoxArea;
-    }
-    
-    private void fillSlots() {
-        page = MathHelper.clamp(page, 0, MathHelper.ceil(view.size() / displaySlots.size()));
-        int firstSlot = page * displaySlots.size();
-        for(int i = 0; i < displaySlots.size(); i++) {
-            if (firstSlot + i < view.size() && firstSlot + i >= 0) {
-                displaySlots.get(i).setStack(view.get(firstSlot + i));
-            } else {
-                displaySlots.get(i).setStack(ItemStack.EMPTY);
-            }
-        }
-    }
-    
-    private void calculateSlots() {
-        int x = rect.x, y = rect.y + 20;
-        Window res = REIRenderHelper.getResolution();
-        displaySlots.clear();
-        int xOffset = 0, yOffset = 0, row = 0, perRow = 0, currentX = 0, currentY = 0;
-        while (true) {
-            xOffset += 18;
-            if (row == 0)
-                perRow++;
-            if (x + xOffset + 22 > res.getScaledWidth()) {
-                xOffset = 0;
-                yOffset += 18;
-                row++;
-            }
-            if (y + yOffset + 9 + FOOTERSIZE > rect.height) {
-                xOffset = 0;
-                yOffset = 0;
-                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);
-            if (REIRecipeManager.instance().canAddSlot(MinecraftClient.getInstance().currentGui.getClass(), slot.rect))
-                displaySlots.add(slot);
-            xOffset += 18;
-            currentX++;
-            if (currentX >= perRow) {
-                xOffset = 0;
-                yOffset += 18;
-                currentX = 0;
-                currentY++;
-            }
-            if (currentY >= row)
-                break;
-        }
-    }
-    
-    @Override
-    public void draw() {
-        if (!visible)
-            return;
-        if (MinecraftClient.getInstance().currentGui instanceof ContainerGui)
-            overlayedGui = (ContainerGui) MinecraftClient.getInstance().currentGui;
-        if (needsResize == true || oldGuiLeft != ((IMixinContainerGui) overlayedGui).getGuiLeft())
-            resize();
-        else if (Core.runtimeConfig.craftableOnly && (!hasSameListContent(new LinkedList<>(lastPlayerItems), getInventoryItemsTypes()) || (getInventoryItemsTypes().size() != lastPlayerItems.size()))) {
-            this.lastPlayerItems = new LinkedList<>(getInventoryItemsTypes());
-            updateView();
-        }
-        GlStateManager.pushMatrix();
-        updateButtons();
-        controls.forEach(Control::draw);
-        GuiLighting.disable();
-        String header = String.format("%s/%s", page + 1, MathHelper.ceil(view.size() / displaySlots.size()) + 1);
-        MinecraftClient.getInstance().fontRenderer.drawWithShadow(header, rect.x + (rect.width / 2) - (MinecraftClient.getInstance().fontRenderer.getStringWidth(header) / 2), rect.y + 10, -1);
-        GlStateManager.popMatrix();
-    }
-    
-    private boolean hasSameListContent(List<ItemStack> list1, List<ItemStack> list2) {
-        Collections.sort(list1, (itemStack, t1) -> {
-            return itemStack.getDisplayName().getFormattedText().compareToIgnoreCase(t1.getDisplayName().getFormattedText());
-        });
-        Collections.sort(list2, (itemStack, t1) -> {
-            return itemStack.getDisplayName().getFormattedText().compareToIgnoreCase(t1.getDisplayName().getFormattedText());
-        });
-        String lastString = String.join("", list1.stream().map(itemStack -> {
-            return itemStack.getDisplayName().getFormattedText();
-        }).collect(Collectors.toList())), currentString = String.join("", list2.stream().map(itemStack -> {
-            return itemStack.getDisplayName().getFormattedText();
-        }).collect(Collectors.toList()));
-        return lastString.equals(currentString);
-    }
-    
-    private void updateButtons() {
-        buttonLeft.setEnabled(MathHelper.ceil(view.size() / displaySlots.size()) > 1);
-        buttonRight.setEnabled(MathHelper.ceil(view.size() / displaySlots.size()) > 1);
-    }
-    
-    public boolean btnRightClicked(int button) {
-        if (button == 0) {
-            page++;
-            if (page > MathHelper.ceil(view.size() / displaySlots.size()))
-                page = 0;
-            fillSlots();
-            return true;
-        }
-        return false;
-    }
-    
-    public boolean btnLeftClicked(int button) {
-        if (button == 0) {
-            page--;
-            if (page < 0)
-                page = MathHelper.ceil(view.size() / displaySlots.size());
-            fillSlots();
-            return true;
-        }
-        return false;
-    }
-    
-    public boolean cheatClicked(int button) {
-        if (button == 0) {
-            cheatMode = !cheatMode;
-            buttonCheating.setString(getCheatModeText());
-            return true;
-        }
-        return false;
-    }
-    
-    private String getCheatModeText() {
-        return I18n.translate(String.format("%s%s", "text.rei.", cheatMode ? "cheat" : "nocheat"));
-    }
-    
-    protected void updateView() {
-        String searchText = searchBox.getText();
-        view.clear();
-        List<ItemStack> stacks = new ArrayList<>();
-        if (ClientListener.stackList == null && !Registry.ITEM.isEmpty())
-            Core.getListeners(ClientListener.class).forEach(ClientListener::onDoneLoading);
-        if (ClientListener.stackList != null) {
-            List<ItemStack> stackList = new LinkedList<>(ClientListener.stackList);
-            List<ItemGroup> itemGroups = new LinkedList<>(Arrays.asList(ItemGroup.GROUPS));
-            FabricCreativeGuiComponents.COMMON_GROUPS.forEach(itemGroups::add);
-            itemGroups.add(null);
-            if (Core.config.itemListOrdering != REIItemListOrdering.REGISTRY)
-                Collections.sort(stackList, (itemStack, t1) -> {
-                    if (Core.config.itemListOrdering.equals(REIItemListOrdering.NAME))
-                        return itemStack.getDisplayName().getFormattedText().compareToIgnoreCase(t1.getDisplayName().getFormattedText());
-                    if (Core.config.itemListOrdering.equals(REIItemListOrdering.ITEM_GROUPS))
-                        return itemGroups.indexOf(itemStack.getItem().getItemGroup()) - itemGroups.indexOf(t1.getItem().getItemGroup());
-                    return 0;
-                });
-            if (!Core.config.isAscending)
-                Collections.reverse(stackList);
-            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));
-                stackList.stream().filter(itemStack -> filterItem(itemStack, arguments)).forEachOrdered(stacks::add);
-            });
-        }
-        List<ItemStack> workingItems = ClientListener.stackList == null || (Core.runtimeConfig.craftableOnly && lastPlayerItems.size() > 0) ? new ArrayList<>() : ClientListener.stackList;
-        if (Core.runtimeConfig.craftableOnly) {
-            REIRecipeManager.instance().findCraftableByItems(lastPlayerItems).forEach(workingItems::add);
-            workingItems.addAll(lastPlayerItems);
-        }
-        final List<ItemStack> finalWorkingItems = workingItems;
-        view.addAll(stacks.stream().filter(itemStack -> {
-            if (!Core.runtimeConfig.craftableOnly)
-                return true;
-            for(ItemStack workingItem : finalWorkingItems)
-                if (itemStack.isEqualIgnoreTags(workingItem))
-                    return true;
-            return false;
-        }).distinct().collect(Collectors.toList()));
-        page = 0;
-        fillSlots();
-    }
-    
-    private List<ItemStack> getInventoryItemsTypes() {
-        List<DefaultedList<ItemStack>> field_7543 = ImmutableList.of(MinecraftClient.getInstance().player.inventory.main, MinecraftClient.getInstance().player.inventory.armor
-                , MinecraftClient.getInstance().player.inventory.offHand);
-        List<ItemStack> inventoryStacks = new ArrayList<>();
-        field_7543.forEach(itemStacks -> itemStacks.forEach(itemStack -> {
-            if (!itemStack.getItem().equals(Items.AIR))
-                inventoryStacks.add(itemStack);
-        }));
-        return inventoryStacks;
-    }
-    
-    private boolean filterItem(ItemStack itemStack, List<SearchArgument> arguments) {
-        String mod = getMod(itemStack);
-        List<String> toolTipsList = REIRenderHelper.getOverlayedGui().getStackTooltip(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() {
-        controls.forEach(f -> f.tick());
-    }
-    
-    public void setLastHovered(Control ctrl) {
-        lastHovered = ctrl;
-    }
-    
-    public Control getLastHovered() {
-        return lastHovered;
-    }
-    
-    private String getMod(ItemStack stack) {
-        if (stack != null && !stack.isEmpty()) {
-            Identifier location = Registry.ITEM.getId(stack.getItem());
-            return location.getNamespace();
-        }
-        return "";
-    }
-    
-}

+ 0 - 280
src/main/java/me/shedaniel/gui/REIRenderHelper.java

@@ -1,280 +0,0 @@
-package me.shedaniel.gui;
-
-import me.shedaniel.ClientListener;
-import me.shedaniel.gui.widget.Control;
-import me.shedaniel.gui.widget.IFocusable;
-import me.shedaniel.gui.widget.REISlot;
-import me.shedaniel.impl.REIRecipeManager;
-import me.shedaniel.listenerdefinitions.IMixinContainerGui;
-import net.fabricmc.loader.FabricLoader;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.font.FontRenderer;
-import net.minecraft.client.gui.ContainerGui;
-import net.minecraft.client.render.item.ItemRenderer;
-import net.minecraft.client.util.Window;
-import net.minecraft.item.ItemStack;
-
-import java.awt.*;
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
-
-/**
- * Created by James on 7/28/2018.
- */
-public class REIRenderHelper {
-    
-    static Point mouseLoc;
-    static public GuiItemList reiGui;
-    static ContainerGui overlayedGui;
-    static List<TooltipData> tooltipsToRender = new ArrayList<>();
-    
-    public static void setMouseLoc(int x, int y) {
-        mouseLoc = new Point(x, y);
-    }
-    
-    static public IFocusable focusedControl;
-    
-    public static Point getMouseLoc() {
-        return mouseLoc;
-    }
-    
-    public static Window getResolution() {
-        return MinecraftClient.getInstance().window;
-    }
-    
-    public static String tryGettingModName(String modid) {
-        if (modid.equalsIgnoreCase("minecraft"))
-            return "Minecraft";
-        return FabricLoader.INSTANCE.getModContainers().stream()
-                .map(modContainer -> {
-                    return modContainer.getInfo();
-                })
-                .filter(modInfo -> modInfo.getId().equals(modid) || (modInfo.getName() != null && modInfo.getName().equals(modid)))
-                .findFirst().map(modInfo -> {
-                    if (modInfo.getName() != null)
-                        return modInfo.getName();
-                    return modid;
-                }).orElse(modid);
-    }
-    
-    public static void drawREI(ContainerGui overlayedGui) {
-        REIRenderHelper.overlayedGui = overlayedGui;
-        if (reiGui == null) {
-            reiGui = new GuiItemList(overlayedGui);
-        }
-        reiGui.draw();
-        renderTooltips();
-    }
-    
-    public static void resize(int scaledWidth, int scaledHeight) {
-        if (reiGui != null) {
-            reiGui.resize();
-        }
-        if (overlayedGui instanceof RecipeGui) {
-            overlayedGui.onScaleChanged(MinecraftClient.getInstance(), scaledWidth, scaledHeight);
-        }
-    }
-    
-    public static ItemRenderer getItemRender() {
-        return MinecraftClient.getInstance().getItemRenderer();
-    }
-    
-    public static FontRenderer getFontRenderer() {
-        return MinecraftClient.getInstance().fontRenderer;
-    }
-    
-    public static ContainerGui getOverlayedGui() {
-        if (overlayedGui instanceof ContainerGui)
-            return overlayedGui;
-        return null;
-    }
-    
-    public static void addToolTip(List<String> text, int x, int y) {
-        tooltipsToRender.add(new TooltipData(text, x, y));
-    }
-    
-    
-    private static void renderTooltips() {
-        tooltipsToRender.forEach(tooltipData -> getOverlayedGui().drawTooltip(tooltipData.text, tooltipData.x, tooltipData.y));
-        tooltipsToRender.clear();
-    }
-    
-    public static boolean mouseClick(int x, int y, int button) {
-        if (reiGui.visible) {
-            for(Control control : reiGui.controls) {
-                if (control.isHighlighted() && control.isEnabled() && control.onClick != null) {
-                    if (focusedControl != null)
-                        focusedControl.setFocused(false);
-                    if (control instanceof IFocusable) {
-                        focusedControl = (IFocusable) control;
-                        ((IFocusable) control).setFocused(true);
-                    }
-                    return control.onClick.apply(button);
-                }
-            }
-            if (focusedControl != null) {
-                focusedControl.setFocused(false);
-                focusedControl = null;
-            }
-        }
-        if (overlayedGui instanceof RecipeGui) {
-            List<Control> controls = new LinkedList<>(((RecipeGui) overlayedGui).controls);
-            if (((RecipeGui) overlayedGui).slots != null)
-                controls.addAll(((RecipeGui) overlayedGui).slots);
-            controls.addAll(reiGui.controls.stream().filter(control -> {
-                return control instanceof REISlot;
-            }).collect(Collectors.toList()));
-            Optional<Control> ctrl = controls.stream().filter(Control::isHighlighted).filter(Control::isEnabled).findFirst();
-            if (ctrl.isPresent()) {
-                try {
-                    return ctrl.get().onClick.apply(button);
-                } catch (Exception e) {
-                }
-            }
-        }
-        return false;
-    }
-    
-    public static boolean keyDown(int typedChar, int keyCode, int unknown) {
-        boolean handled = false;
-        if (focusedControl != null && focusedControl instanceof Control) {
-            Control control = (Control) focusedControl;
-            if (control.onKeyDown != null) {
-                handled = control.onKeyDown.accept(typedChar, keyCode, unknown);
-            }
-            if (control.charPressed != null)
-                if (typedChar == 256) {
-                    ((IFocusable) control).setFocused(false);
-                    focusedControl = null;
-                }
-            handled = true;
-        }
-        if (!handled) {
-            return ClientListener.processGuiKeyBinds(typedChar);
-        }
-        return handled;
-    }
-    
-    public static boolean charInput(long num, int keyCode, int unknown) {
-        if (focusedControl != null && focusedControl instanceof Control) {
-            Control control = (Control) focusedControl;
-            if (control.charPressed != null) {
-                int numChars = Character.charCount(keyCode);
-                if (num == numChars)
-                    control.charPressed.accept((char) keyCode, unknown);
-                else {
-                    char[] chars = Character.toChars(keyCode);
-                    for(int x = 0; x < chars.length; x++) {
-                        control.charPressed.accept(chars[x], unknown);
-                    }
-                }
-                return true;
-            }
-        }
-        return false;
-    }
-    
-    public static boolean mouseScrolled(double direction) {
-        if (!reiGui.visible)
-            return false;
-        if (MinecraftClient.getInstance().currentGui instanceof RecipeGui) {
-            Window window = REIRenderHelper.getResolution();
-            Point mouse = new Point((int) MinecraftClient.getInstance().mouse.getX(), (int) MinecraftClient.getInstance().mouse.getY());
-            int mouseX = (int) (mouse.x * (double) window.getScaledWidth() / (double) window.method_4480());
-            int mouseY = (int) (mouse.y * (double) window.getScaledHeight() / (double) window.method_4507());
-            mouse = new Point(mouseX, mouseY);
-            
-            RecipeGui recipeGui = (RecipeGui) MinecraftClient.getInstance().currentGui;
-            if (mouse.getX() < window.getScaledWidth() / 2 + recipeGui.guiWidth / 2 && mouse.getX() > window.getScaledWidth() / 2 - recipeGui.guiWidth / 2 &&
-                    mouse.getY() < window.getScaledHeight() / 2 + recipeGui.guiHeight / 2 && mouse.getY() > window.getScaledHeight() / 2 - recipeGui.guiHeight / 2 &&
-                    recipeGui.recipes.get(recipeGui.selectedCategory).size() > 2) {
-                boolean failed = false;
-                if (direction > 0 && reiGui.buttonLeft.isEnabled())
-                    recipeGui.btnRecipeLeft.onClick.apply(0);
-                else if (direction < 0 && reiGui.buttonRight.isEnabled())
-                    recipeGui.btnRecipeRight.onClick.apply(0);
-                else failed = true;
-                if (!failed)
-                    return true;
-            }
-        }
-        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;
-    }
-    
-    private static class TooltipData {
-        
-        private final List<String> text;
-        private final int x;
-        private final int y;
-        
-        public TooltipData(List<String> text, int x, int y) {
-            this.text = text;
-            this.x = x;
-            this.y = y;
-        }
-    }
-    
-    public static void updateSearch() {
-        reiGui.updateView();
-    }
-    
-    public static void tick() {
-        if (reiGui != null && MinecraftClient.getInstance().currentGui == overlayedGui)
-            reiGui.tick();
-    }
-    
-    public static boolean isGuiVisible() {
-        return reiGui != null && reiGui.visible;
-    }
-    
-    public static boolean recipeKeyBind() {
-        if (!(MinecraftClient.getInstance().currentGui instanceof ContainerGui))
-            return false;
-        Control control = reiGui.getLastHovered();
-        if (control != null && control.isHighlighted() && control instanceof REISlot) {
-            REISlot slot = (REISlot) control;
-            REIRecipeManager.instance().displayRecipesFor(slot.getStack());
-            return true;
-        }
-        if (((IMixinContainerGui) overlayedGui).getHoveredSlot() != null) {
-            ItemStack stack = ((IMixinContainerGui) overlayedGui).getHoveredSlot().getStack();
-            REIRecipeManager.instance().displayRecipesFor(stack);
-            return true;
-        }
-        return false;
-    }
-    
-    public static boolean useKeyBind() {
-        if (!(MinecraftClient.getInstance().currentGui instanceof ContainerGui))
-            return false;
-        Control control = reiGui.getLastHovered();
-        if (control != null && control.isHighlighted() && control instanceof REISlot) {
-            REISlot slot = (REISlot) control;
-            REIRecipeManager.instance().displayUsesFor(slot.getStack());
-            return true;
-        }
-        if (((IMixinContainerGui) overlayedGui).getHoveredSlot() != null) {
-            ItemStack stack = ((IMixinContainerGui) overlayedGui).getHoveredSlot().getStack();
-            REIRecipeManager.instance().displayUsesFor(stack);
-            return true;
-        }
-        return false;
-    }
-    
-    public static boolean hideKeyBind() {
-        if (MinecraftClient.getInstance().currentGui == overlayedGui && reiGui != null) {
-            reiGui.visible = !reiGui.visible;
-            return true;
-        }
-        return false;
-    }
-    
-}

+ 0 - 14
src/main/java/me/shedaniel/gui/RecipeContainer.java

@@ -1,14 +0,0 @@
-package me.shedaniel.gui;
-
-
-import net.minecraft.container.Container;
-import net.minecraft.entity.player.PlayerEntity;
-
-public class RecipeContainer extends Container {
-    
-    @Override
-    public boolean canUse(PlayerEntity playerEntity) {
-        return true;
-    }
-    
-}

+ 0 - 287
src/main/java/me/shedaniel/gui/RecipeGui.java

@@ -1,287 +0,0 @@
-package me.shedaniel.gui;
-
-import com.mojang.blaze3d.platform.GlStateManager;
-import me.shedaniel.api.IDisplayCategoryCraftable;
-import me.shedaniel.api.IDisplayCategory;
-import me.shedaniel.api.IRecipe;
-import me.shedaniel.gui.widget.Button;
-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.MinecraftClient;
-import net.minecraft.client.gui.ContainerGui;
-import net.minecraft.client.gui.Gui;
-import net.minecraft.client.render.GuiLighting;
-import net.minecraft.client.util.Window;
-import net.minecraft.container.Container;
-import net.minecraft.util.Identifier;
-import net.minecraft.util.math.MathHelper;
-
-import java.util.*;
-
-public class RecipeGui extends ContainerGui {
-    
-    private static final Identifier CREATIVE_INVENTORY_TABS = new Identifier("textures/gui/container/creative_inventory/tabs.png");
-    private static final Identifier CHEST_GUI_TEXTURE = new Identifier("roughlyenoughitems", "textures/gui/recipecontainer.png");
-    private final Window mainWindow;
-    private final Container container;
-    private final Gui prevScreen;
-    public final Map<IDisplayCategory, List<IRecipe>> recipes;
-    public final int guiWidth = 176;
-    public final int guiHeight = 222;
-    ArrayList<IDisplayCategory> categories = new ArrayList<>();
-    private int categoryTabPage = 0;
-    public IDisplayCategory selectedCategory;
-    private int recipePointer = 0;
-    public List<REISlot> slots;
-    List<Control> controls = new LinkedList<>();
-    private List<Tab> tabs;
-    private boolean tabsEnabled = false;
-    private Button btnCategoryPageLeft, btnCategoryPageRight;
-    public Button btnRecipeLeft, btnRecipeRight;
-    
-    public RecipeGui(Container p_i1072_1_, Gui prevScreen, Map<IDisplayCategory, List<IRecipe>> recipes) {
-        super(new RecipeContainer());
-        this.container = p_i1072_1_;
-        this.prevScreen = prevScreen;
-        this.recipes = recipes;
-        this.client = MinecraftClient.getInstance();
-        this.itemRenderer = client.getItemRenderer();
-        this.fontRenderer = client.fontRenderer;
-        this.mainWindow = client.window;
-        
-        setupCategories();
-    }
-    
-    public Gui getPrevScreen() {
-        return prevScreen;
-    }
-    
-    private void setupCategories() {
-        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 -> {
-            if (tab.getId() + categoryTabPage * 6 == categories.indexOf(selectedCategory))
-                return false;
-            selectedCategory = categories.get(tab.getId() + categoryTabPage * 6);
-            recipePointer = 0;
-            updateRecipe();
-            return false;
-        }));
-        updateRecipe();
-    }
-    
-    @Override
-    public void draw(int mouseX, int mouseY, float partialTicks) {
-        drawBackground();
-        super.draw(mouseX, mouseY, partialTicks);
-        int y = (int) ((mainWindow.getScaledHeight() / 2 - this.guiHeight / 2));
-        GuiLighting.disable();
-        drawStringCentered(this.fontRenderer, selectedCategory.getDisplayName(), left + guiWidth / 2, y + 11, -1);
-        drawStringCentered(this.fontRenderer, String.format("%d/%d", 1 + getCurrentPage(), getTotalPages()), left + guiWidth / 2, y + 34, -1);
-        controls.forEach(Control::draw);
-    }
-    
-    private int getCurrentPage() {
-        return recipePointer / 2;
-    }
-    
-    @Override
-    public void update() {
-        super.update();
-        slots.forEach(REISlot::tick);
-        controls.forEach(Control::tick);
-    }
-    
-    @Override
-    public void onScaleChanged(MinecraftClient p_onResize_1_, int p_onResize_2_, int p_onResize_3_) {
-        super.onScaleChanged(p_onResize_1_, p_onResize_2_, p_onResize_3_);
-        updateRecipe();
-    }
-    
-    private void updateRecipe() {
-        IRecipe recipe = recipes.get(selectedCategory).get(recipePointer);
-        selectedCategory.resetRecipes();
-        selectedCategory.addRecipe(recipe);
-        slots = selectedCategory.setupDisplay(0);
-        if (recipes.get(selectedCategory).size() >= recipePointer + 2) {
-            IRecipe recipe2 = recipes.get(selectedCategory).get(recipePointer + 1);
-            selectedCategory.addRecipe(recipe2);
-            slots.addAll(selectedCategory.setupDisplay(1));
-        }
-        
-        left = (int) ((mainWindow.getScaledWidth() / 2 - this.guiWidth / 2));
-        top = (int) ((mainWindow.getScaledHeight() / 2 - this.guiHeight / 2));
-        
-        slots.forEach(reiSlot -> reiSlot.move(left, top));
-        
-        Button btnCategoryLeft = new Button(left + 10, top + 5, 15, 20, "<");
-        Button btnCategoryRight = new Button(left + guiWidth - 25, top + 5, 15, 20, ">");
-        btnCategoryRight.onClick = this::btnCategoryRight;
-        btnCategoryLeft.onClick = this::btnCategoryLeft;
-        
-        btnRecipeLeft = new Button(left + 10, top + 28, 15, 20, "<");
-        btnRecipeRight = new Button(left + guiWidth - 25, top + 28, 15, 20, ">");
-        btnRecipeLeft.setEnabled(recipes.get(selectedCategory).size() > 2);
-        btnRecipeRight.setEnabled(recipes.get(selectedCategory).size() > 2);
-        btnRecipeRight.onClick = this::btnRecipeRight;
-        btnRecipeLeft.onClick = this::btnRecipeLeft;
-        
-        controls.clear();
-        controls.add(btnCategoryLeft);
-        controls.add(btnCategoryRight);
-        if (categories.size() <= 1) {
-            btnCategoryLeft.setEnabled(false);
-            btnCategoryRight.setEnabled(false);
-        } else if (categories.size() > 6) {
-            btnCategoryPageLeft = new Button(left, top - 52, 20, 20, "<");
-            btnCategoryPageRight = new Button(left + guiWidth - 20, top - 52, 20, 20, ">");
-            btnCategoryPageLeft.setOnClick(i -> {
-                categoryTabPage--;
-                if (categoryTabPage <= 0)
-                    categoryTabPage = MathHelper.ceil(categories.size() / 6d);
-                updateRecipe();
-                return true;
-            });
-            btnCategoryPageRight.setOnClick(i -> {
-                categoryTabPage++;
-                if (categoryTabPage >= MathHelper.ceil(categories.size() / 6d))
-                    categoryTabPage = 0;
-                updateRecipe();
-                return true;
-            });
-            if (top - 52 >= 2)
-                controls.addAll(Arrays.asList(btnCategoryPageLeft, btnCategoryPageRight));
-        }
-        
-        controls.add(btnRecipeLeft);
-        controls.add(btnRecipeRight);
-        
-        List<Control> newControls = new LinkedList<>();
-        selectedCategory.addWidget(newControls, 0);
-        if (selectedCategory instanceof IDisplayCategoryCraftable)
-            ((IDisplayCategoryCraftable) selectedCategory).registerAutoCraftButton(newControls, this, getPrevScreen(), recipe, 0);
-        if (recipes.get(selectedCategory).size() >= recipePointer + 2) {
-            selectedCategory.addWidget(newControls, 1);
-            if (selectedCategory instanceof IDisplayCategoryCraftable)
-                ((IDisplayCategoryCraftable) selectedCategory).registerAutoCraftButton(newControls, this, getPrevScreen(), recipes.get(selectedCategory).get(recipePointer + 1), 1);
-        }
-        newControls.forEach(f -> f.move(left, top));
-        controls.addAll(newControls);
-        
-        updateTabs();
-    }
-    
-    private void updateTabs() {
-        tabsEnabled = top - 28 > 4;
-        if (tabsEnabled) {
-            tabs.forEach(tab -> tab.moveTo(left + 4, left + 2 + tabs.indexOf(tab) * 28, top - 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);
-        }
-    }
-    
-    @Override
-    protected void drawBackground(float v, int i, int i1) {
-        //Tabs
-        if (tabsEnabled) {
-            GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
-            GuiLighting.enableForItems();
-            this.client.getTextureManager().bindTexture(CREATIVE_INVENTORY_TABS);
-            tabs.stream().filter(tab -> tab.getId() + categoryTabPage * 6 == categories.indexOf(selectedCategory)).forEach(Tab::drawTab);
-        }
-        
-        drawBackground();
-        GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
-        GuiLighting.disable();
-        this.client.getTextureManager().bindTexture(CHEST_GUI_TEXTURE);
-        
-        int lvt_4_1_ = (int) ((mainWindow.getScaledWidth() / 2 - this.guiWidth / 2));
-        int lvt_5_1_ = (int) ((mainWindow.getScaledHeight() / 2 - this.guiHeight / 2));
-        
-        this.drawTexturedRect(lvt_4_1_, lvt_5_1_, 0, 0, this.guiWidth, this.guiHeight);
-        slots.forEach(reiSlot -> {
-            GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
-            GuiLighting.disable();
-            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);
-                GuiLighting.enableForItems();
-                this.client.getTextureManager().bindTexture(CREATIVE_INVENTORY_TABS);
-                tab.drawTab();
-            });
-    }
-    
-    @Override
-    public boolean keyPressed(int p_keyPressed_1_, int p_keyPressed_2_, int p_keyPressed_3_) {
-        if (p_keyPressed_1_ == 256 && prevScreen != null) {
-            this.client.openGui(prevScreen);
-            return true;
-        }
-        return super.keyPressed(p_keyPressed_1_, p_keyPressed_2_, p_keyPressed_3_);
-    }
-    
-    private boolean btnCategoryLeft(int button) {
-        recipePointer = 0;
-        int categoryPointer = categories.indexOf(selectedCategory);
-        categoryPointer--;
-        if (categoryPointer <= 0)
-            categoryPointer = categories.size() - 1;
-        selectedCategory = categories.get(categoryPointer);
-        categoryTabPage = categoryPointer / 6;
-        updateRecipe();
-        return true;
-    }
-    
-    private boolean btnCategoryRight(int button) {
-        recipePointer = 0;
-        int categoryPointer = categories.indexOf(selectedCategory);
-        categoryPointer++;
-        if (categoryPointer >= categories.size())
-            categoryPointer = 0;
-        selectedCategory = categories.get(categoryPointer);
-        categoryTabPage = categoryPointer / 6;
-        updateRecipe();
-        return true;
-    }
-    
-    private boolean btnRecipeLeft(int button) {
-        recipePointer -= 2;
-        if (recipePointer <= 0)
-            recipePointer = MathHelper.floor((recipes.get(selectedCategory).size() - 1) / 2d) * 2;
-        updateRecipe();
-        return true;
-    }
-    
-    private boolean btnRecipeRight(int button) {
-        recipePointer += 2;
-        if (recipePointer >= recipes.get(selectedCategory).size())
-            recipePointer = 0;
-        updateRecipe();
-        return true;
-    }
-    
-    private int riseDoublesToInt(double i) {
-        return MathHelper.ceil(i);
-    }
-    
-    private int getTotalPages() {
-        return MathHelper.clamp(riseDoublesToInt(recipes.get(selectedCategory).size() / 2d), 1, Integer.MAX_VALUE);
-    }
-    
-}

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

@@ -1,36 +0,0 @@
-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);
-    }
-    
-}

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

@@ -1,63 +0,0 @@
-package me.shedaniel.gui.widget;
-
-import com.mojang.blaze3d.platform.GlStateManager;
-import me.shedaniel.gui.REIRenderHelper;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.font.FontRenderer;
-import net.minecraft.client.gui.ContainerGui;
-import net.minecraft.util.Identifier;
-
-import java.awt.*;
-
-/**
- * Created by James on 7/29/2018.
- */
-public class Button extends Control {
-    
-    private String buttonText;
-    protected static final Identifier BUTTON_TEXTURES = new Identifier("textures/gui/widgets.png");
-    
-    public Button(int x, int y, int width, int height, String buttonText) {
-        super(x, y, width, height);
-        this.buttonText = buttonText;
-    }
-    
-    public Button(Rectangle rect, String buttonText) {
-        super(rect);
-        this.buttonText = buttonText;
-    }
-    
-    public void setString(String text) {
-        buttonText = text;
-    }
-    
-    @Override
-    public void draw() {
-        GlStateManager.pushMatrix();
-        GlStateManager.disableLighting();
-        ContainerGui gui = REIRenderHelper.getOverlayedGui();
-        MinecraftClient lvt_4_1_ = MinecraftClient.getInstance();
-        FontRenderer lvt_5_1_ = lvt_4_1_.fontRenderer;
-        lvt_4_1_.getTextureManager().bindTexture(BUTTON_TEXTURES);
-        GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
-        int hoverState = (byte) 0;
-        if (this.isEnabled()) {
-            if (!this.isHighlighted())
-                hoverState = (byte) 1;
-            else
-                hoverState = (byte) 2;
-        }
-        
-        GlStateManager.enableBlend();
-        GlStateManager.blendFuncSeparate(GlStateManager.SrcBlendFactor.SRC_ALPHA, GlStateManager.DstBlendFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SrcBlendFactor.ONE, GlStateManager.DstBlendFactor.ZERO);
-        GlStateManager.blendFunc(GlStateManager.SrcBlendFactor.SRC_ALPHA, GlStateManager.DstBlendFactor.ONE_MINUS_SRC_ALPHA);
-        gui.drawTexturedRect(rect.x, rect.y, 0, 46 + hoverState * 20, rect.width / 2, rect.height);
-        gui.drawTexturedRect(rect.x + rect.width / 2, rect.y, 200 - rect.width / 2, 46 + hoverState * 20, rect.width / 2, rect.height);
-        int lvt_7_1_ = 14737632;
-        
-        gui.drawStringCentered(lvt_5_1_, this.buttonText, rect.x + rect.width / 2, rect.y + (rect.height - 8) / 2, lvt_7_1_);
-        GlStateManager.enableLighting();
-        GlStateManager.popMatrix();
-    }
-    
-}

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

@@ -1,127 +0,0 @@
-package me.shedaniel.gui.widget;
-
-import com.mojang.blaze3d.platform.GlStateManager;
-import me.shedaniel.api.TriBooleanSupplier;
-import me.shedaniel.gui.Drawable;
-import net.minecraft.client.render.BufferBuilder;
-import net.minecraft.client.render.Tessellator;
-import net.minecraft.client.render.VertexFormats;
-
-import java.awt.*;
-import java.util.function.BiConsumer;
-import java.util.function.IntFunction;
-
-/**
- * Created by James on 7/29/2018.
- */
-public abstract class Control extends Drawable {
-    
-    private boolean enabled = true;
-    public IntFunction<Boolean> onClick;
-    public TriBooleanSupplier onKeyDown;
-    public BiConsumer<Character, Integer> charPressed;
-    
-    public Control(int x, int y, int width, int height) {
-        super(x, y, width, height);
-    }
-    
-    public Control(Rectangle rect) {
-        super(rect);
-    }
-    
-    public boolean isEnabled() {
-        return enabled;
-    }
-    
-    public void setEnabled(boolean enabled) {
-        this.enabled = enabled;
-    }
-    
-    public void move(int x, int y) {
-        rect.x += x;
-        rect.y += y;
-        //rect.move(x+rect.x,rect.y+y);//Why the fuck?
-    }
-    
-    protected static void drawRect(int p_drawRect_0_, int p_drawRect_1_, int p_drawRect_2_, int p_drawRect_3_, int p_drawRect_4_) {
-        int lvt_5_3_;
-        if (p_drawRect_0_ < p_drawRect_2_) {
-            lvt_5_3_ = p_drawRect_0_;
-            p_drawRect_0_ = p_drawRect_2_;
-            p_drawRect_2_ = lvt_5_3_;
-        }
-        
-        if (p_drawRect_1_ < p_drawRect_3_) {
-            lvt_5_3_ = p_drawRect_1_;
-            p_drawRect_1_ = p_drawRect_3_;
-            p_drawRect_3_ = lvt_5_3_;
-        }
-        float lvt_5_3_1 = (float) (p_drawRect_4_ >> 24 & 255) / 255.0F;
-        float lvt_6_1_ = (float) (p_drawRect_4_ >> 16 & 255) / 255.0F;
-        float lvt_7_1_ = (float) (p_drawRect_4_ >> 8 & 255) / 255.0F;
-        float lvt_8_1_ = (float) (p_drawRect_4_ & 255) / 255.0F;
-        Tessellator lvt_9_1_ = Tessellator.getInstance();
-        BufferBuilder lvt_10_1_ = lvt_9_1_.getBufferBuilder();
-        GlStateManager.enableAlphaTest();
-        GlStateManager.enableBlend();
-        GlStateManager.disableTexture();
-        GlStateManager.blendFuncSeparate(GlStateManager.SrcBlendFactor.SRC_ALPHA, GlStateManager.DstBlendFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SrcBlendFactor.ONE, GlStateManager.DstBlendFactor.ZERO);
-        GlStateManager.color4f(lvt_6_1_, lvt_7_1_, lvt_8_1_, lvt_5_3_1);
-        lvt_10_1_.begin(7, VertexFormats.POSITION);
-        lvt_10_1_.vertex((double) p_drawRect_0_, (double) p_drawRect_3_, 0.0D).next();
-        lvt_10_1_.vertex((double) p_drawRect_2_, (double) p_drawRect_3_, 0.0D).next();
-        lvt_10_1_.vertex((double) p_drawRect_2_, (double) p_drawRect_1_, 0.0D).next();
-        lvt_10_1_.vertex((double) p_drawRect_0_, (double) p_drawRect_1_, 0.0D).next();
-        lvt_9_1_.draw();
-        GlStateManager.enableTexture();
-        GlStateManager.disableBlend();
-        GlStateManager.disableAlphaTest();
-    }
-    
-    protected void drawTexturedModalRect(int x, int y, int u, int v, int width, int height) {
-        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_.getBufferBuilder();
-        lvt_10_1_.begin(7, VertexFormats.POSITION_UV);
-        lvt_10_1_.vertex((double) (x + 0), (double) (y + height), (double) 200).texture((double) ((float) (u + 0) * 0.00390625F), (double) ((float) (v + height) * 0.00390625F)).next();
-        lvt_10_1_.vertex((double) (x + width), (double) (y + height), (double) 200).texture((double) ((float) (u + width) * 0.00390625F), (double) ((float) (v + height) * 0.00390625F)).next();
-        lvt_10_1_.vertex((double) (x + width), (double) (y + 0), (double) 200).texture((double) ((float) (u + width) * 0.00390625F), (double) ((float) (v + 0) * 0.00390625F)).next();
-        lvt_10_1_.vertex((double) (x + 0), (double) (y + 0), (double) 200).texture((double) ((float) (u + 0) * 0.00390625F), (double) ((float) (v + 0) * 0.00390625F)).next();
-        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_.getBufferBuilder();
-        lvt_10_1_.begin(7, VertexFormats.POSITION_UV);
-        lvt_10_1_.vertex((double) (x + 0), (double) (y + height), zLevel).texture((double) ((float) (u + 0) * 0.00390625F), (double) ((float) (v + height) * 0.00390625F)).next();
-        lvt_10_1_.vertex((double) (x + width), (double) (y + height), zLevel).texture((double) ((float) (u + width) * 0.00390625F), (double) ((float) (v + height) * 0.00390625F)).next();
-        lvt_10_1_.vertex((double) (x + width), (double) (y + 0), zLevel).texture((double) ((float) (u + width) * 0.00390625F), (double) ((float) (v + 0) * 0.00390625F)).next();
-        lvt_10_1_.vertex((double) (x + 0), (double) (y + 0), zLevel).texture((double) ((float) (u + 0) * 0.00390625F), (double) ((float) (v + 0) * 0.00390625F)).next();
-        lvt_9_1_.draw();
-    }
-    
-    public void drawTexturedRect(int int_1, int int_2, int int_3, int int_4, int int_5, int int_6, double zOffset) {
-        float float_1 = 0.00390625F;
-        float float_2 = 0.00390625F;
-        Tessellator tessellator_1 = Tessellator.getInstance();
-        BufferBuilder bufferBuilder_1 = tessellator_1.getBufferBuilder();
-        bufferBuilder_1.begin(7, VertexFormats.POSITION_UV);
-        bufferBuilder_1.vertex((double)(int_1 + 0), (double)(int_2 + int_6), zOffset).texture((double)((float)(int_3 + 0) * 0.00390625F), (double)((float)(int_4 + int_6) * 0.00390625F)).next();
-        bufferBuilder_1.vertex((double)(int_1 + int_5), (double)(int_2 + int_6), zOffset).texture((double)((float)(int_3 + int_5) * 0.00390625F), (double)((float)(int_4 + int_6) * 0.00390625F)).next();
-        bufferBuilder_1.vertex((double)(int_1 + int_5), (double)(int_2 + 0), zOffset).texture((double)((float)(int_3 + int_5) * 0.00390625F), (double)((float)(int_4 + 0) * 0.00390625F)).next();
-        bufferBuilder_1.vertex((double)(int_1 + 0), (double)(int_2 + 0), zOffset).texture((double)((float)(int_3 + 0) * 0.00390625F), (double)((float)(int_4 + 0) * 0.00390625F)).next();
-        tessellator_1.draw();
-    }
-    
-    public void tick() {
-    }
-    
-    public void setOnClick(IntFunction<Boolean> onClick) {
-        this.onClick = onClick;
-    }
-    
-}

+ 0 - 76
src/main/java/me/shedaniel/gui/widget/CraftableToggleButton.java

@@ -1,76 +0,0 @@
-package me.shedaniel.gui.widget;
-
-import com.mojang.blaze3d.platform.GlStateManager;
-import me.shedaniel.Core;
-import me.shedaniel.gui.REIRenderHelper;
-import net.minecraft.block.Blocks;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.font.FontRenderer;
-import net.minecraft.client.render.GuiLighting;
-import net.minecraft.client.render.item.ItemRenderer;
-import net.minecraft.client.resource.language.I18n;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.Identifier;
-
-import java.awt.*;
-import java.util.Arrays;
-
-public class CraftableToggleButton extends Control {
-    
-    private ItemRenderer itemRenderer;
-    private final ItemStack itemStack;
-    //protected float zLevel;
-    protected static final Identifier BUTTON_TEXTURES = new Identifier("textures/gui/widgets.png");
-    protected static final Identifier CHEST_GUI_TEXTURE = new Identifier("roughlyenoughitems", "textures/gui/recipecontainer.png");
-    
-    public CraftableToggleButton(Rectangle rect) {
-        super(rect);
-        this.itemStack = new ItemStack(Blocks.CRAFTING_TABLE.getItem());
-        this.itemRenderer = MinecraftClient.getInstance().getItemRenderer();
-    }
-    
-    @Override
-    public void draw() {
-        GlStateManager.pushMatrix();
-        GlStateManager.disableLighting();
-        MinecraftClient lvt_4_1_ = MinecraftClient.getInstance();
-        FontRenderer lvt_5_1_ = lvt_4_1_.fontRenderer;
-        lvt_4_1_.getTextureManager().bindTexture(BUTTON_TEXTURES);
-        GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
-        int hoverState = (byte) 0;
-        if (this.isEnabled()) {
-            if (!this.isHighlighted())
-                hoverState = (byte) 1;
-            else
-                hoverState = (byte) 2;
-        }
-        
-        GlStateManager.enableBlend();
-        GlStateManager.blendFuncSeparate(GlStateManager.SrcBlendFactor.SRC_ALPHA, GlStateManager.DstBlendFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SrcBlendFactor.ONE, GlStateManager.DstBlendFactor.ZERO);
-        GlStateManager.blendFunc(GlStateManager.SrcBlendFactor.SRC_ALPHA, GlStateManager.DstBlendFactor.ONE_MINUS_SRC_ALPHA);
-        this.drawTexturedRect(rect.x, rect.y, 0, 46 + hoverState * 20, rect.width / 2, rect.height, 0);
-        this.drawTexturedRect(rect.x + rect.width / 2, rect.y, 200 - rect.width / 2, 46 + hoverState * 20, rect.width / 2, rect.height, 0);
-        
-        GuiLighting.enableForItems();
-        //this.zLevel = 100.0F;
-        //this.itemRenderer.zOffset = 100.0F;
-        this.itemRenderer.zOffset = 0.0F;
-        this.itemRenderer.renderItemAndGlowInGui(itemStack, rect.x + 2, rect.y + 2);
-        GlStateManager.disableLighting();
-        //this.zLevel = 0.0F;
-        this.itemRenderer.zOffset = 0.0F;
-        GuiLighting.disable();
-        lvt_4_1_.getTextureManager().bindTexture(CHEST_GUI_TEXTURE);
-        GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
-        this.drawTexturedRect(rect.x, rect.y, (72 + (Core.runtimeConfig.craftableOnly ? 0 : 20)), 222, 20, 20, 100);
-        GlStateManager.popMatrix();
-        if (isHighlighted())
-            drawTooltip();
-    }
-    
-    private void drawTooltip() {
-        Point mouse = REIRenderHelper.getMouseLoc();
-        REIRenderHelper.addToolTip(Arrays.asList(I18n.translate(Core.runtimeConfig.craftableOnly ? "text.rei.showing_craftable" : "text.rei.showing_all")), mouse.x, mouse.y);
-    }
-    
-}

+ 0 - 12
src/main/java/me/shedaniel/gui/widget/IFocusable.java

@@ -1,12 +0,0 @@
-package me.shedaniel.gui.widget;
-
-/**
- * Created by James on 8/3/2018.
- */
-public interface IFocusable {
-    
-    public boolean hasFocus();
-    
-    public void setFocused(boolean val);
-    
-}

+ 0 - 59
src/main/java/me/shedaniel/gui/widget/KeyBindButton.java

@@ -1,59 +0,0 @@
-package me.shedaniel.gui.widget;
-
-import me.shedaniel.ClientListener;
-import me.shedaniel.library.KeyBindFunction;
-import net.minecraft.client.gui.widget.ButtonWidget;
-import net.minecraft.client.resource.language.I18n;
-import net.minecraft.text.TextFormat;
-
-import java.awt.event.KeyEvent;
-import java.util.function.Consumer;
-
-public class KeyBindButton extends ButtonWidget {
-    
-    private int currentKey;
-    private Consumer<Integer> onEditKeyBind;
-    private boolean editMode;
-    
-    public KeyBindButton(int buttonId, int x, int y, int widthIn, int heightIn, int currentKey, Consumer<Integer> onEditKeyBind) {
-        super(buttonId, x, y, widthIn, heightIn, "");
-        this.currentKey = currentKey;
-        this.onEditKeyBind = onEditKeyBind;
-    }
-    
-    @Override
-    public boolean charTyped(char p_charTyped_1_, int p_charTyped_2_) {
-        if (editMode) {
-            currentKey = KeyEvent.getExtendedKeyCodeForChar(p_charTyped_1_);
-            onEditKeyBind.accept(currentKey);
-            editMode = false;
-            return true;
-        }
-        return false;
-    }
-    
-    @Override
-    public void draw(int mouseX, int mouseY, float partialTicks) {
-        this.text = editMode ? I18n.translate("text.rei.listeningkey") : KeyEvent.getKeyText(currentKey);
-        if (!editMode && ClientListener.keyBinds.stream().map(KeyBindFunction::getKey).filter(integer -> integer == currentKey).count() > 1)
-            this.text = TextFormat.RED + this.text;
-        super.draw(mouseX, mouseY, partialTicks);
-    }
-    
-    @Override
-    public void setHasFocus(boolean boolean_1) {
-        if (boolean_1 == false)
-            editMode = boolean_1;
-    }
-    
-    @Override
-    public boolean hasFocus() {
-        return true;
-    }
-    
-    @Override
-    public void onPressed(double double_1, double double_2) {
-        editMode = !editMode;
-    }
-    
-}

+ 0 - 188
src/main/java/me/shedaniel/gui/widget/REISlot.java

@@ -1,188 +0,0 @@
-package me.shedaniel.gui.widget;
-
-import com.google.common.collect.Lists;
-import me.shedaniel.Core;
-import me.shedaniel.gui.REIRenderHelper;
-import me.shedaniel.listenerdefinitions.IMixinContainerGui;
-import me.shedaniel.network.DeletePacket;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.gui.ContainerGui;
-import net.minecraft.client.network.ClientPlayerEntity;
-import net.minecraft.client.render.GuiLighting;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.Identifier;
-import net.minecraft.util.registry.Registry;
-
-import java.awt.*;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.stream.Collectors;
-
-/**
- * Created by James on 7/28/2018.
- */
-public class REISlot extends Control {
-    
-    private static final Identifier RECIPE_GUI = new Identifier("roughlyenoughitems", "textures/gui/recipecontainer.png");
-    private boolean cheatable = false;
-    private List<ItemStack> itemList = new LinkedList<>();
-    private int itemListPointer = 0;
-    private long displayCounter = 0;
-    
-    public boolean isDrawBackground() {
-        return drawBackground;
-    }
-    
-    private String extraTooltip;
-    
-    
-    @Override
-    public void tick() {
-        if (itemList.size() > 1) {
-            displayCounter++;
-            if (displayCounter % 10 == 0)
-                if (itemListPointer + 1 >= itemList.size())
-                    itemListPointer = 0;
-                else itemListPointer++;
-        }
-    }
-    
-    public void setStackList(List<ItemStack> newItemList) {
-        itemList = newItemList;
-        itemListPointer = 0;
-        displayCounter = 0;
-    }
-    
-    public void setExtraTooltip(String toolTip) {
-        extraTooltip = toolTip;
-    }
-    
-    public void setDrawBackground(boolean drawBackground) {
-        this.drawBackground = drawBackground;
-    }
-    
-    private boolean drawBackground = false;
-    private Point backgroundUV = new Point(0, 222);
-    
-    public REISlot(int x, int y) {
-        super(x, y, 18, 18);
-        this.onClick = this::onClick;
-    }
-    
-    public ItemStack getStack() {
-        if (itemList.isEmpty()) {
-            return ItemStack.EMPTY;
-        }
-        return itemList.get(itemListPointer);
-    }
-    
-    public void setStack(ItemStack stack) {
-        itemList.clear();
-        if (stack != null)
-            itemList.add(stack);
-        itemListPointer = 0;
-    }
-    
-    @Override
-    public void draw() {
-        if (drawBackground) {
-            MinecraftClient.getInstance().getTextureManager().bindTexture(RECIPE_GUI);
-            drawTexturedModalRect(rect.x - 1, rect.y - 1, backgroundUV.x, backgroundUV.y, rect.width, rect.height);
-        }
-        if (getStack().isEmpty())
-            return;
-        GuiLighting.enableForItems();
-        
-        drawStack(rect.x, rect.y);
-        if (isHighlighted())
-            drawTooltip();
-    }
-    
-    protected void drawTooltip() {
-        List<String> toolTip = getTooltip();
-        toolTip.add("§9§o" + getMod());
-        Point mouse = REIRenderHelper.getMouseLoc();
-        REIRenderHelper.addToolTip(toolTip, mouse.x, mouse.y);
-    }
-    
-    private boolean onClick(int button) {
-        ClientPlayerEntity player = MinecraftClient.getInstance().player;
-        if (REIRenderHelper.reiGui.canCheat() && !(player.inventory.getCursorStack().isEmpty())) {
-            //Delete the itemstack.
-            MinecraftClient.getInstance().getNetworkHandler().sendPacket(new DeletePacket());
-            return true;
-        }
-        if (!player.inventory.getCursorStack().isEmpty()) {
-            return false;
-        }
-        
-        if (REIRenderHelper.reiGui.canCheat() && this.cheatable) {
-            if (getStack() != null && !getStack().isEmpty()) {
-                ItemStack cheatedStack = getStack().copy();
-                if (button == 0)
-                    cheatedStack.setAmount(1);
-                if (button == 1) {
-                    cheatedStack.setAmount(cheatedStack.getMaxAmount());
-                }
-                Core.cheatItems(cheatedStack);
-                return true;
-            }
-        } else {
-            if (button == 0)
-                return REIRenderHelper.recipeKeyBind();
-            else if (button == 1)
-                return REIRenderHelper.useKeyBind();
-        }
-        return false;
-    }
-    
-    
-    private void drawStack(int x, int y) {
-        ContainerGui gui = REIRenderHelper.getOverlayedGui();
-        REIRenderHelper.getItemRender().zOffset = 200.0F;
-        REIRenderHelper.getItemRender().renderItemAndGlowInGui(getStack(), x, y);
-        assert gui != null;
-        if (((IMixinContainerGui) gui).getDraggedStack().isEmpty())
-            REIRenderHelper.getItemRender().renderItemOverlaysInGUIWithText(MinecraftClient.getInstance().fontRenderer, getStack(), x, y - 0, getTextOverlay(getStack()));
-        else
-            REIRenderHelper.getItemRender().renderItemOverlaysInGUIWithText(MinecraftClient.getInstance().fontRenderer, getStack(), x, y - 8, getTextOverlay(getStack()));
-        REIRenderHelper.getItemRender().zOffset = 0.0F;
-    }
-    
-    public String getTextOverlay(ItemStack stack) {
-        return "";
-    }
-    
-    public String getMod() {
-        if (!getStack().isEmpty()) {
-            Identifier location = Registry.ITEM.getId(getStack().getItem());
-            assert location != null;
-            return REIRenderHelper.tryGettingModName(location.getNamespace());
-        }
-        return "";
-    }
-    
-    protected List<String> getTooltip() {
-        final String modString = "§9§o" + getMod();
-        MinecraftClient mc = MinecraftClient.getInstance();
-        ContainerGui gui = REIRenderHelper.getOverlayedGui();
-        List<String> toolTip = Lists.newArrayList();
-        if (gui != null)
-            toolTip = gui.getStackTooltip(getStack()).stream().filter(s -> !s.equals(modString)).collect(Collectors.toList());
-        else
-            toolTip.add(getStack().getDisplayName().getFormattedText());
-        if (extraTooltip != null)
-            toolTip.add(extraTooltip);
-        return toolTip;
-    }
-    
-    public boolean isCheatable() {
-        return cheatable;
-    }
-    
-    public void setCheatable(boolean cheatable) {
-        this.cheatable = cheatable;
-    }
-    
-    
-}

+ 0 - 73
src/main/java/me/shedaniel/gui/widget/SmallButton.java

@@ -1,73 +0,0 @@
-package me.shedaniel.gui.widget;
-
-import com.mojang.blaze3d.platform.GlStateManager;
-import me.shedaniel.gui.REIRenderHelper;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.font.FontRenderer;
-import net.minecraft.client.gui.ContainerGui;
-import net.minecraft.client.gui.Gui;
-import net.minecraft.util.Identifier;
-
-import java.awt.*;
-import java.util.Arrays;
-import java.util.List;
-import java.util.function.Function;
-
-public class SmallButton extends Control {
-    
-    private String buttonText;
-    private Function<Boolean, String> toolTipSupplier;
-    protected static final Identifier BUTTON_TEXTURES = new Identifier("roughlyenoughitems", "textures/gui/recipecontainer.png");
-    
-    
-    public SmallButton(int x, int y, int width, int height, String buttonText, Function<Boolean, String> toolTipSupplier) {
-        super(x, y, width, height);
-        this.buttonText = buttonText;
-        this.toolTipSupplier = toolTipSupplier;
-    }
-    
-    public SmallButton(Rectangle rect, String buttonText, Function<Boolean, String> toolTipSupplier) {
-        super(rect);
-        this.buttonText = buttonText;
-        this.toolTipSupplier = toolTipSupplier;
-    }
-    
-    public void setString(String text) {
-        buttonText = text;
-    }
-    
-    @Override
-    public void draw() {
-        GlStateManager.pushMatrix();
-        GlStateManager.disableLighting();
-        ContainerGui gui = REIRenderHelper.getOverlayedGui();
-        MinecraftClient lvt_4_1_ = MinecraftClient.getInstance();
-        FontRenderer lvt_5_1_ = lvt_4_1_.fontRenderer;
-        lvt_4_1_.getTextureManager().bindTexture(BUTTON_TEXTURES);
-        GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
-        int hoverState = (byte) 0;
-        if (this.isEnabled()) {
-            if (!this.isHighlighted())
-                hoverState = (byte) 1;
-            else
-                hoverState = (byte) 2;
-        }
-        
-        GlStateManager.enableBlend();
-        GlStateManager.blendFuncSeparate(GlStateManager.SrcBlendFactor.SRC_ALPHA, GlStateManager.DstBlendFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SrcBlendFactor.ONE, GlStateManager.DstBlendFactor.ZERO);
-        GlStateManager.blendFunc(GlStateManager.SrcBlendFactor.SRC_ALPHA, GlStateManager.DstBlendFactor.ONE_MINUS_SRC_ALPHA);
-        gui.drawTexturedRect(rect.x, rect.y, 18 + 44, 222 + hoverState * 10, rect.width, rect.height);
-        int lvt_7_1_ = 14737632;
-        
-        gui.drawStringCentered(lvt_5_1_, this.buttonText, rect.x + rect.width / 2, rect.y + (rect.height - 8) / 2, lvt_7_1_);
-        GlStateManager.enableLighting();
-        GlStateManager.popMatrix();
-        String ttS = toolTipSupplier.apply(isEnabled());
-        if (isHighlighted() && ttS != "") {
-            List<String> toolTip = Arrays.asList(ttS.split("\n"));
-            if (toolTip != null && toolTip.size() != 0)
-                gui.drawTooltip(toolTip, REIRenderHelper.getMouseLoc().x, REIRenderHelper.getMouseLoc().y);
-        }
-    }
-    
-}

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

@@ -1,101 +0,0 @@
-package me.shedaniel.gui.widget;
-
-import com.mojang.blaze3d.platform.GlStateManager;
-import me.shedaniel.gui.REIRenderHelper;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.render.item.ItemRenderer;
-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 = MinecraftClient.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.zOffset = 100.0F;
-            GlStateManager.enableLighting();
-            GlStateManager.enableRescaleNormal();
-            this.itemRender.renderItemAndGlowInGui(getItemStack(), l, i1);
-            this.itemRender.renderItemOverlaysInGUI(MinecraftClient.getInstance().fontRenderer, getItemStack(), l, i1);
-            GlStateManager.disableLighting();
-            this.itemRender.zOffset = 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);
-    }
-    
-}

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

@@ -1,85 +0,0 @@
-package me.shedaniel.gui.widget;
-
-import me.shedaniel.gui.REIRenderHelper;
-import net.minecraft.client.gui.widget.TextFieldWidget;
-import net.minecraft.client.render.GuiLighting;
-
-import java.awt.*;
-
-/**
- * Created by James on 8/3/2018.
- */
-public class TextBox extends Control implements IFocusable {
-    
-    private TextFieldWidget textField;
-    
-    public TextBox(int x, int y, int width, int height) {
-        super(x, y, width, height);
-        textField = new TextFieldWidget(-1, REIRenderHelper.getFontRenderer(), x, y, width, height);
-        this.onClick = this::doMouseClick;
-        this.onKeyDown = this::onKeyPressed;
-        this.charPressed = this::charTyped;
-    }
-    
-    public TextBox(Rectangle rectangle) {
-        super(rectangle);
-        textField = new TextFieldWidget(-1, REIRenderHelper.getFontRenderer(), rectangle.x, rectangle.y, rectangle.width, rectangle.height);
-        this.onClick = this::doMouseClick;
-        this.onKeyDown = this::onKeyPressed;
-        this.charPressed = this::charTyped;
-    }
-    
-    @Override
-    public void draw() {
-        GuiLighting.disable();
-        textField.render(0, 0, 0);
-    }
-    
-    @Override
-    public boolean hasFocus() {
-        return textField.isFocused();
-    }
-    
-    @Override
-    public void setFocused(boolean val) {
-        textField.setFocused(val);
-    }
-    
-    protected boolean doMouseClick(int button) {
-        if (button == 1) {
-            textField.setText("");
-            REIRenderHelper.updateSearch();
-            return true;
-        }
-        Point mouseLoc = REIRenderHelper.getMouseLoc();
-        if (!hasFocus())
-            setFocused(true);
-        return textField.mouseClicked(mouseLoc.x, mouseLoc.y, 0);
-    }
-    
-    protected boolean onKeyPressed(int first, int second, int third) {
-        boolean handled = textField.keyPressed(first, second, third);
-        if (handled)
-            REIRenderHelper.updateSearch();
-        return handled;
-    }
-    
-    public String getText() {
-        return textField.getText();
-    }
-    
-    public void setText(String value) {
-        textField.setText(value);
-    }
-    
-    protected void charTyped(char p_charTyped_1_, int p_charTyped_2_) {
-        textField.charTyped(p_charTyped_1_, p_charTyped_2_);
-        REIRenderHelper.updateSearch();
-    }
-    
-    @Override
-    public void tick() {
-        textField.tick();
-    }
-    
-}

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

@@ -1,50 +0,0 @@
-package me.shedaniel.gui.widget;
-
-import com.mojang.blaze3d.platform.GlStateManager;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.render.GuiLighting;
-import net.minecraft.util.Identifier;
-
-public class WidgetArrow extends Control {
-    
-    private static final Identifier RECIPE_GUI = new Identifier("roughlyenoughitems", "textures/gui/recipecontainer.png");
-    private int progress = 0;
-    private int updateTick = 0;
-    private final int speed;
-    private boolean animated;
-    
-    public WidgetArrow(int x, int y, boolean animated) {
-        this(x, y, animated, 20);
-    }
-    
-    public WidgetArrow(int x, int y, boolean animated, int speed) {
-        super(x, y, 22, 18);
-        this.animated = animated;
-        this.speed = speed;
-    }
-    
-    @Override
-    public void draw() {
-        GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
-        GuiLighting.disable();
-        MinecraftClient.getInstance().getTextureManager().bindTexture(RECIPE_GUI);
-        this.drawTexturedModalRect(rect.x, rect.y, 18, 222, 22, 18);
-        if (animated) {
-            int width = (int) ((progress / 10f) * 22);
-            this.drawTexturedModalRect(rect.x - 1, rect.y - 1, 40, 222, width, 18);
-        }
-    }
-    
-    @Override
-    public void tick() {
-        updateTick++;
-        if (updateTick >= speed) {
-            updateTick = 0;
-            
-            progress++;
-            if (progress > 10)
-                progress = 0;
-        }
-    }
-    
-}

+ 0 - 220
src/main/java/me/shedaniel/impl/REIRecipeManager.java

@@ -1,220 +0,0 @@
-package me.shedaniel.impl;
-
-import me.shedaniel.Core;
-import me.shedaniel.api.IDisplayCategory;
-import me.shedaniel.api.IREIPlugin;
-import me.shedaniel.api.IRecipe;
-import me.shedaniel.api.IRecipeManager;
-import me.shedaniel.gui.RecipeGui;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.gui.Gui;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.item.Items;
-import net.minecraft.recipe.RecipeManager;
-
-import java.awt.*;
-import java.util.*;
-import java.util.List;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-
-/**
- * Created by James on 8/7/2018.
- */
-public class REIRecipeManager implements IRecipeManager {
-    
-    private Map<String, List<IRecipe>> recipeList;
-    private List<IDisplayCategory> displayAdapters;
-    public static RecipeManager recipeManager;
-    private Map<Class<? extends Gui>, List<Function<Rectangle, Boolean>>> guiExcludeMap;
-    
-    private static REIRecipeManager myInstance;
-    
-    private REIRecipeManager() {
-        recipeList = new HashMap<>();
-        displayAdapters = new LinkedList<>();
-        guiExcludeMap = new HashMap<>();
-    }
-    
-    public Map<String, List<IRecipe>> getRecipeList() {
-        return recipeList;
-    }
-    
-    public List<IDisplayCategory> getDisplayAdapters() {
-        return displayAdapters;
-    }
-    
-    public static REIRecipeManager instance() {
-        if (myInstance == null) {
-            Core.LOGGER.info("REI: Newing me up.");
-            myInstance = new REIRecipeManager();
-        }
-        return myInstance;
-    }
-    
-    public void addExclusionOnGui(Class<? extends Gui> guiClass, Function<Rectangle, Boolean>... functions) {
-        List<Function<Rectangle, Boolean>> list = guiExcludeMap.containsKey(guiClass) ? new LinkedList<>(guiExcludeMap.get(guiClass)) : new ArrayList<>();
-        list.addAll(Arrays.asList(functions));
-        guiExcludeMap.put(guiClass, list);
-    }
-    
-    public boolean canAddSlot(Class<? extends Gui> guiClass, Rectangle slotRect) {
-        if (!guiExcludeMap.containsKey(guiClass))
-            return true;
-        for(Function<Rectangle, Boolean> rectangleBooleanFunction : guiExcludeMap.get(guiClass))
-            if (!rectangleBooleanFunction.apply(slotRect))
-                return false;
-        return true;
-    }
-    
-    @Override
-    public void addRecipe(String id, IRecipe recipe) {
-        if (recipeList.containsKey(id))
-            recipeList.get(id).add(recipe);
-        else {
-            List<IRecipe> recipes = new LinkedList<>();
-            recipeList.put(id, recipes);
-            recipes.add(recipe);
-        }
-    }
-    
-    @Override
-    public void addRecipe(String id, List<? extends IRecipe> recipes) {
-        if (recipeList.containsKey(id))
-            recipeList.get(id).addAll(recipes);
-        else {
-            List<IRecipe> newRecipeList = new LinkedList<>();
-            recipeList.put(id, newRecipeList);
-            newRecipeList.addAll(recipes);
-        }
-    }
-    
-    @Override
-    public void addDisplayAdapter(IDisplayCategory adapter) {
-        displayAdapters.add(adapter);
-    }
-    
-    @Override
-    public Map<IDisplayCategory, List<IRecipe>> getRecipesFor(ItemStack stack) {
-        Map<IDisplayCategory, List<IRecipe>> categories = new HashMap<>();
-        displayAdapters.forEach(f -> categories.put(f, new LinkedList<>()));
-        for(List<IRecipe> value : recipeList.values())
-            for(IRecipe iRecipe : value)
-                for(Object o : iRecipe.getOutput())
-                    if (o instanceof ItemStack)
-                        if (ItemStack.areEqualIgnoreTags(stack, (ItemStack) o))
-                            for(IDisplayCategory iDisplayCategory : categories.keySet())
-                                if (iDisplayCategory.getId() == iRecipe.getId()) {
-                                    categories.get(iDisplayCategory).add(iRecipe);
-                                }
-        categories.keySet().removeIf(f -> categories.get(f).isEmpty());
-        return categories;
-    }
-    
-    public Map<IDisplayCategory, List<IRecipe>> getUsesFor(ItemStack stack) {
-        Map<IDisplayCategory, List<IRecipe>> categories = new HashMap<>();
-        displayAdapters.forEach(f -> categories.put(f, new LinkedList<>()));
-        for(List<IRecipe> value : recipeList.values())
-            for(IRecipe iRecipe : value) {
-                boolean found = false;
-                for(Object o : iRecipe.getInput()) {
-                    List<ItemStack> input = (List<ItemStack>) o;
-                    for(ItemStack itemStack : input) {
-                        if (ItemStack.areEqualIgnoreTags(itemStack, stack)) {
-                            for(IDisplayCategory iDisplayCategory : categories.keySet())
-                                if (iDisplayCategory.getId() == iRecipe.getId()) {
-                                    categories.get(iDisplayCategory).add(iRecipe);
-                                    found = true;
-                                }
-                            if (found)
-                                break;
-                        }
-                    }
-                    if (found)
-                        break;
-                }
-            }
-        categories.keySet().removeIf(f -> categories.get(f).isEmpty());
-        return categories;
-    }
-    
-    @Deprecated
-    public List<IRecipe> findUsageForItems(List<ItemStack> types) {
-        List<IRecipe> recipes = new ArrayList<>();
-        types.forEach(item -> {
-            Map<IDisplayCategory, List<IRecipe>> itemUsages = getUsesFor(item);
-            itemUsages.values().forEach(iRecipes -> recipes.addAll(iRecipes));
-        });
-        return recipes;
-    }
-    
-    public List<ItemStack> findCraftableByItems(List<ItemStack> types) {
-        List<ItemStack> craftables = new ArrayList<>();
-        for(List<IRecipe> value : recipeList.values())
-            for(IRecipe iRecipe : value) {
-                int slotsCraftable = 0;
-                List<List<ItemStack>> requiredInput = (List<List<ItemStack>>) iRecipe.getRecipeRequiredInput();
-                for(List<ItemStack> slot : requiredInput) {
-                    if (slot.isEmpty()) {
-                        slotsCraftable++;
-                        continue;
-                    }
-                    boolean slotDone = false;
-                    for(ItemStack possibleType : types) {
-                        for(ItemStack slotPossible : slot)
-                            if (ItemStack.areEqualIgnoreTags(slotPossible, possibleType)) {
-                                slotsCraftable++;
-                                slotDone = true;
-                                break;
-                            }
-                        if (slotDone)
-                            break;
-                    }
-                }
-                if (slotsCraftable == iRecipe.getRecipeRequiredInput().size())
-                    craftables.addAll((List<ItemStack>) iRecipe.getOutput());
-            }
-        return craftables.stream().distinct().collect(Collectors.toList());
-    }
-    
-    public List<IDisplayCategory> getAdatapersForOutput(ItemStack stack) {
-        return null;
-    }
-    
-    public List<IDisplayCategory> getAdaptersForOutput(Item item) {
-        return null;
-    }
-    
-    public void RecipesLoaded(RecipeManager manager) {
-        recipeList.clear();
-        displayAdapters.clear();
-        REIRecipeManager.instance().recipeManager = manager;
-        Core.getListeners(IREIPlugin.class).forEach(IREIPlugin::registerCategories);
-        Core.getListeners(IREIPlugin.class).forEach(IREIPlugin::registerRecipes);
-        Core.getListeners(IREIPlugin.class).forEach(IREIPlugin::registerSpecialGuiExclusion);
-    }
-    
-    public void displayRecipesFor(ItemStack stack) {
-        Map<IDisplayCategory, List<IRecipe>> recipes = REIRecipeManager.instance().getRecipesFor(stack);
-        if (recipes.isEmpty())
-            return;
-        RecipeGui gui;
-        if (MinecraftClient.getInstance().currentGui instanceof RecipeGui)
-            gui = new RecipeGui(null, ((RecipeGui) MinecraftClient.getInstance().currentGui).getPrevScreen(), recipes);
-        else gui = new RecipeGui(null, MinecraftClient.getInstance().currentGui, recipes);
-        MinecraftClient.getInstance().openGui(gui);
-    }
-    
-    public void displayUsesFor(ItemStack stack) {
-        Map<IDisplayCategory, List<IRecipe>> recipes = REIRecipeManager.instance().getUsesFor(stack);
-        if (recipes.isEmpty())
-            return;
-        RecipeGui gui;
-        if (MinecraftClient.getInstance().currentGui instanceof RecipeGui)
-            gui = new RecipeGui(null, ((RecipeGui) MinecraftClient.getInstance().currentGui).getPrevScreen(), recipes);
-        else gui = new RecipeGui(null, MinecraftClient.getInstance().currentGui, recipes);
-        MinecraftClient.getInstance().openGui(gui);
-    }
-    
-}

+ 0 - 23
src/main/java/me/shedaniel/library/KeyBindFunction.java

@@ -1,23 +0,0 @@
-package me.shedaniel.library;
-
-import java.util.function.Function;
-
-public abstract class KeyBindFunction {
-    
-    public KeyBindFunction(int key) {
-        this.key = key;
-    }
-    
-    private int key;
-    
-    public void setKey(int key) {
-        this.key = key;
-    }
-    
-    public int getKey() {
-        return key;
-    }
-    
-    public abstract boolean apply(int key);
-    
-}

+ 0 - 8
src/main/java/me/shedaniel/library/Sink.java

@@ -1,8 +0,0 @@
-package me.shedaniel.library;
-
-@FunctionalInterface
-public interface Sink {
-    
-    public void Sink();
-    
-}

+ 0 - 10
src/main/java/me/shedaniel/listenerdefinitions/CharInput.java

@@ -1,10 +0,0 @@
-package me.shedaniel.listenerdefinitions;
-
-/**
- * Created by James on 8/4/2018.
- */
-public interface CharInput extends IEvent {
-    
-    public boolean charInput(long p_onCharEvent_1_, int p_onCharEvent_3_, int p_onCharEvent_4_);
-    
-}

+ 0 - 7
src/main/java/me/shedaniel/listenerdefinitions/ClientTickable.java

@@ -1,7 +0,0 @@
-package me.shedaniel.listenerdefinitions;
-
-public interface ClientTickable extends IEvent {
-    
-    public void clientTick();
-    
-}

+ 0 - 10
src/main/java/me/shedaniel/listenerdefinitions/DoneLoading.java

@@ -1,10 +0,0 @@
-package me.shedaniel.listenerdefinitions;
-
-/**
- * Created by James on 7/27/2018.
- */
-public interface DoneLoading extends IEvent {
-    
-    void onDoneLoading();
-    
-}

+ 0 - 12
src/main/java/me/shedaniel/listenerdefinitions/DrawContainer.java

@@ -1,12 +0,0 @@
-package me.shedaniel.listenerdefinitions;
-
-import net.minecraft.client.gui.ContainerGui;
-
-/**
- * Created by James on 7/27/2018.
- */
-public interface DrawContainer extends IEvent {
-    
-    public void draw(int mouseX, int mouseY, float dunno, ContainerGui gui);
-    
-}

+ 0 - 10
src/main/java/me/shedaniel/listenerdefinitions/GuiClick.java

@@ -1,10 +0,0 @@
-package me.shedaniel.listenerdefinitions;
-
-/**
- * Created by James on 7/29/2018.
- */
-public interface GuiClick extends IEvent {
-    
-    public boolean onClick(int x, int y, int button);
-    
-}

+ 0 - 10
src/main/java/me/shedaniel/listenerdefinitions/GuiKeyDown.java

@@ -1,10 +0,0 @@
-package me.shedaniel.listenerdefinitions;
-
-/**
- * Created by James on 8/3/2018.
- */
-public interface GuiKeyDown extends IEvent {
-    
-    public boolean keyDown(int p_keyPressed_1_, int p_keyPressed_2_, int p_keyPressed_3_);
-    
-}

+ 0 - 7
src/main/java/me/shedaniel/listenerdefinitions/GuiMouseScroll.java

@@ -1,7 +0,0 @@
-package me.shedaniel.listenerdefinitions;
-
-public interface GuiMouseScroll extends IEvent {
-    
-    public boolean mouseScrolled(double direction);
-    
-}

+ 0 - 4
src/main/java/me/shedaniel/listenerdefinitions/IEvent.java

@@ -1,4 +0,0 @@
-package me.shedaniel.listenerdefinitions;
-
-public interface IEvent {
-}

+ 0 - 20
src/main/java/me/shedaniel/listenerdefinitions/IMixinContainerGui.java

@@ -1,20 +0,0 @@
-package me.shedaniel.listenerdefinitions;
-
-import net.minecraft.container.Slot;
-import net.minecraft.item.ItemStack;
-
-public interface IMixinContainerGui {
-    
-    public ItemStack getDraggedStack();
-    
-    public int getGuiLeft();
-    
-    public int getContainerHeight();
-    
-    public int getContainerWidth();
-    
-    public int getXSize();
-    
-    public Slot getHoveredSlot();
-    
-}

+ 0 - 9
src/main/java/me/shedaniel/listenerdefinitions/IMixinRecipeBookGui.java

@@ -1,9 +0,0 @@
-package me.shedaniel.listenerdefinitions;
-
-import net.minecraft.client.gui.widget.RecipeBookGhostSlots;
-
-public interface IMixinRecipeBookGui {
-    
-    public RecipeBookGhostSlots getGhostSlots();
-    
-}

+ 0 - 10
src/main/java/me/shedaniel/listenerdefinitions/MinecraftResize.java

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

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

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

+ 0 - 9
src/main/java/me/shedaniel/listenerdefinitions/RecipeLoadListener.java

@@ -1,9 +0,0 @@
-package me.shedaniel.listenerdefinitions;
-
-import net.minecraft.recipe.RecipeManager;
-
-public interface RecipeLoadListener extends IEvent {
-    
-    public void recipesLoaded(RecipeManager recipeManager);
-    
-}

+ 0 - 65
src/main/java/me/shedaniel/listeners/DrawContainerListener.java

@@ -1,65 +0,0 @@
-package me.shedaniel.listeners;
-
-import me.shedaniel.gui.REIRenderHelper;
-import me.shedaniel.listenerdefinitions.*;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.gui.ContainerGui;
-import net.minecraft.client.gui.Gui;
-import net.minecraft.client.gui.ingame.CreativePlayerInventoryGui;
-import net.minecraft.item.ItemGroup;
-
-/**
- * Created by James on 7/27/2018.
- */
-public class DrawContainerListener implements DrawContainer, GuiClick, GuiKeyDown, CharInput, ClientTickable, GuiMouseScroll, MinecraftResize {
-    
-    @Override
-    public void draw(int x, int y, float dunno, ContainerGui gui) {
-        if (!(gui instanceof CreativePlayerInventoryGui) || ((CreativePlayerInventoryGui) gui).method_2469() == ItemGroup.INVENTORY.getId()) {
-            REIRenderHelper.setMouseLoc(x, y);
-            REIRenderHelper.drawREI(gui);
-        }
-    }
-    
-    @Override
-    public boolean onClick(int x, int y, int button) {
-        Gui gui = MinecraftClient.getInstance().currentGui;
-        if (!(gui instanceof CreativePlayerInventoryGui) || ((CreativePlayerInventoryGui) gui).method_2469() == ItemGroup.INVENTORY.getId())
-            return REIRenderHelper.mouseClick(x, y, button);
-        return false;
-    }
-    
-    @Override
-    public boolean keyDown(int p_keyPressed_1_, int p_keyPressed_2_, int p_keyPressed_3_) {
-        Gui gui = MinecraftClient.getInstance().currentGui;
-        if (!(gui instanceof CreativePlayerInventoryGui) || ((CreativePlayerInventoryGui) gui).method_2469() == ItemGroup.INVENTORY.getId())
-            return REIRenderHelper.keyDown(p_keyPressed_1_, p_keyPressed_2_, p_keyPressed_3_);
-        return false;
-    }
-    
-    @Override
-    public boolean charInput(long p_onCharEvent_1_, int p_onCharEvent_3_, int p_onCharEvent_4_) {
-        Gui gui = MinecraftClient.getInstance().currentGui;
-        if (!(gui instanceof CreativePlayerInventoryGui) || ((CreativePlayerInventoryGui) gui).method_2469() == ItemGroup.INVENTORY.getId())
-            return REIRenderHelper.charInput(p_onCharEvent_1_, p_onCharEvent_3_, p_onCharEvent_4_);
-        return false;
-    }
-    
-    @Override
-    public boolean mouseScrolled(double direction) {
-        Gui gui = MinecraftClient.getInstance().currentGui;
-        if (!(gui instanceof CreativePlayerInventoryGui) || ((CreativePlayerInventoryGui) gui).method_2469() == ItemGroup.INVENTORY.getId())
-            return REIRenderHelper.mouseScrolled(direction);
-        return false;
-    }
-    
-    @Override
-    public void clientTick() {
-        REIRenderHelper.tick();
-    }
-    
-    @Override
-    public void resize(int scaledWidth, int scaledHeight) {
-        REIRenderHelper.resize(scaledWidth, scaledHeight);
-    }
-}

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

@@ -1,21 +0,0 @@
-package me.shedaniel.mixins;
-
-import me.shedaniel.Core;
-import me.shedaniel.listenerdefinitions.PotionCraftingAdder;
-import net.minecraft.item.Item;
-import net.minecraft.potion.Potion;
-import net.minecraft.recipe.BrewingRecipeRegistry;
-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(BrewingRecipeRegistry.class)
-public class MixinBrewingRecipeRegistry {
-    
-    @Inject(method = "registerPotionRecipe", at = @At("HEAD"))
-    private static void registerPotionRecipe(Potion potion_1, Item item_1, Potion potion_2, CallbackInfo info) {
-        Core.getListeners(PotionCraftingAdder.class).forEach(potionCraftingAdder -> potionCraftingAdder.addPotionRecipe(potion_1, item_1, potion_2));
-    }
-    
-}

+ 0 - 97
src/main/java/me/shedaniel/mixins/MixinContainerGui.java

@@ -1,97 +0,0 @@
-package me.shedaniel.mixins;
-
-import me.shedaniel.Core;
-import me.shedaniel.listenerdefinitions.*;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.gui.ContainerGui;
-import net.minecraft.client.gui.Gui;
-import net.minecraft.container.Slot;
-import net.minecraft.item.ItemStack;
-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.Inject;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
-
-/**
- * Created by James on 7/27/2018.
- */
-@Mixin(ContainerGui.class)
-public abstract class MixinContainerGui extends Gui implements IMixinContainerGui {
-    
-    @Shadow
-    protected Slot focusedSlot;
-    @Shadow
-    private ItemStack field_2782; //draggedStack
-    @Shadow
-    protected int left;
-    @Shadow
-    protected int top;
-    @Shadow
-    protected int containerWidth;
-    @Shadow
-    protected int containerHeight;
-    
-    @Inject(method = "draw(IIF)V", at = @At("RETURN"))
-    public void draw(int p_drawScreen_1_, int p_drawScreen_2_, float p_drawScreen_3_, CallbackInfo ci) {
-        Core.getListeners(DrawContainer.class).forEach(drawContainer ->
-                drawContainer.draw(p_drawScreen_1_, p_drawScreen_2_, p_drawScreen_3_, (ContainerGui) MinecraftClient.getInstance().currentGui));
-    }
-    
-    @Inject(method = "mouseClicked(DDI)Z", at = @At("HEAD"), cancellable = true)
-    private void mouseClick(double p_mouseClicked_1_, double p_mouseClicked_3_, int p_mouseClicked_5_, CallbackInfoReturnable<Boolean> ci) {
-        for(GuiClick listener : Core.getListeners(GuiClick.class))
-            if (listener.onClick((int) p_mouseClicked_1_, (int) p_mouseClicked_3_, p_mouseClicked_5_)) {
-                ci.setReturnValue(true);
-                ci.cancel();
-            }
-    }
-    
-    @Inject(method = "keyPressed(III)Z", at = @At("HEAD"), cancellable = true)
-    private void onKeyPressed(int p_keyPressed_1_, int p_keyPressed_2_, int p_keyPressed_3_, CallbackInfoReturnable<Boolean> ci) {
-        for(GuiKeyDown listener : Core.getListeners(GuiKeyDown.class))
-            if (listener.keyDown(p_keyPressed_1_, p_keyPressed_2_, p_keyPressed_3_)) {
-                ci.setReturnValue(true);
-                ci.cancel();
-            }
-    }
-    
-    public boolean mouseScrolled(double p_mouseScrolled_1_) {
-        for(GuiMouseScroll listener : Core.getListeners(GuiMouseScroll.class))
-            if (listener.mouseScrolled(p_mouseScrolled_1_))
-                return true;
-        return super.mouseScrolled(p_mouseScrolled_1_);
-    }
-    
-    @Override
-    public ItemStack getDraggedStack() {
-        return field_2782;
-    }
-    
-    @Override
-    public int getGuiLeft() {
-        return left;
-    }
-    
-    @Override
-    public int getXSize() {
-        return containerWidth;
-    }
-    
-    @Override
-    public Slot getHoveredSlot() {
-        return focusedSlot;
-    }
-    
-    @Override
-    public int getContainerHeight() {
-        return containerHeight;
-    }
-    
-    @Override
-    public int getContainerWidth() {
-        return containerWidth;
-    }
-    
-}

+ 0 - 64
src/main/java/me/shedaniel/mixins/MixinCreativePlayerInventoryGui.java

@@ -1,64 +0,0 @@
-package me.shedaniel.mixins;
-
-import me.shedaniel.Core;
-import me.shedaniel.gui.REIRenderHelper;
-import me.shedaniel.listenerdefinitions.GuiClick;
-import me.shedaniel.listenerdefinitions.GuiKeyDown;
-import net.minecraft.client.gui.ingame.AbstractPlayerInventoryGui;
-import net.minecraft.client.gui.ingame.CreativePlayerInventoryGui;
-import net.minecraft.container.Container;
-import net.minecraft.item.ItemGroup;
-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.Inject;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
-
-@Mixin(CreativePlayerInventoryGui.class)
-public abstract class MixinCreativePlayerInventoryGui extends AbstractPlayerInventoryGui {
-    
-    @Shadow
-    protected abstract boolean doRenderScrollBar();
-    
-    @Shadow
-    private static int selectedTab;
-    
-    public MixinCreativePlayerInventoryGui(Container container_1) {
-        super(container_1);
-    }
-    
-    @Inject(method = "keyPressed(III)Z", at = @At("HEAD"), cancellable = true)
-    public void keyPressed(int a, int b, int c, CallbackInfoReturnable<Boolean> ci) {
-        if (selectedTab == ItemGroup.INVENTORY.getId())
-            Core.getListeners(GuiKeyDown.class).forEach(guiKeyDown -> {
-                if (guiKeyDown.keyDown(a, b, c)) {
-                    ci.setReturnValue(true);
-                    ci.cancel();
-                    return;
-                }
-            });
-    }
-    
-    @Inject(method = "mouseScrolled(D)Z", at = @At("HEAD"), cancellable = true)
-    public void mouseScrolled(double p_mouseScrolled_1_, CallbackInfoReturnable<Boolean> ci) {
-        if (!this.doRenderScrollBar()) {
-            if (super.mouseScrolled(p_mouseScrolled_1_)) {
-                ci.setReturnValue(true);
-                ci.cancel();
-            }
-        }
-    }
-    
-    @Inject(method = "mouseClicked(DDI)Z", at = @At("HEAD"), cancellable = true)
-    public void mouseClicked(double double_1, double double_2, int int_1, CallbackInfoReturnable<Boolean> ci) {
-        if (selectedTab == ItemGroup.INVENTORY.getId() && REIRenderHelper.isGuiVisible())
-            for(GuiClick guiClick : Core.getListeners(GuiClick.class))
-                if (guiClick.onClick((int) double_1, (int) double_2, int_1)) {
-                    ci.setReturnValue(true);
-                    ci.cancel();
-                    return;
-                }
-    }
-    
-}

+ 0 - 23
src/main/java/me/shedaniel/mixins/MixinDoneLoading.java

@@ -1,23 +0,0 @@
-package me.shedaniel.mixins;
-
-import me.shedaniel.Core;
-import me.shedaniel.listenerdefinitions.DoneLoading;
-import net.minecraft.Bootstrap;
-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;
-
-/**
- * Created by James on 7/27/2018.
- */
-@Mixin(Bootstrap.class)
-public class MixinDoneLoading {
-    
-    @Inject(method = "initialize", at = @At("RETURN"))
-    private static void onBootstrapRegister(CallbackInfo ci) {
-        Core.LOGGER.info("REI: Done Loading");
-        Core.getListeners(DoneLoading.class).forEach(DoneLoading::onDoneLoading);
-    }
-    
-}

+ 0 - 29
src/main/java/me/shedaniel/mixins/MixinKeyboardListener.java

@@ -1,29 +0,0 @@
-package me.shedaniel.mixins;
-
-import me.shedaniel.Core;
-import me.shedaniel.listenerdefinitions.CharInput;
-import net.minecraft.client.Keyboard;
-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;
-
-/**
- * Created by James on 8/4/2018.
- */
-@Mixin(Keyboard.class)
-public class MixinKeyboardListener {
-    
-    @Inject(method = "onChar", at = @At("RETURN"), cancellable = true)
-    private void onCharEvent(long p_onCharEvent_1_, int p_onCharEvent_3_, int p_onCharEvent_4_, CallbackInfo ci) {
-        boolean handled = false;
-        for(CharInput listener : Core.getListeners(CharInput.class)) {
-            if (listener.charInput(p_onCharEvent_1_, p_onCharEvent_3_, p_onCharEvent_4_)) {
-                handled = true;
-            }
-        }
-        if (handled)
-            ci.cancel();
-    }
-    
-}

+ 0 - 31
src/main/java/me/shedaniel/mixins/MixinMinecraftResize.java

@@ -1,31 +0,0 @@
-package me.shedaniel.mixins;
-
-import me.shedaniel.Core;
-import me.shedaniel.listenerdefinitions.MinecraftResize;
-import net.minecraft.client.util.Window;
-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.Inject;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-
-/**
- * Created by James on 7/28/2018.
- */
-@Mixin(Window.class)
-public abstract class MixinMinecraftResize implements AutoCloseable {
-    
-    @Shadow
-    private int scaledHeight;
-    
-    @Shadow
-    private int scaledWidth;
-    
-    @Inject(method = "onSizeChanged", at = @At("RETURN"))
-    private void onSizeChanged(long long_1, int int_1, int int_2, CallbackInfo ci) {
-        for(MinecraftResize listener : Core.getListeners(MinecraftResize.class)) {
-            listener.resize(this.scaledWidth, this.scaledHeight);
-        }
-    }
-    
-}

+ 0 - 20
src/main/java/me/shedaniel/mixins/MixinRecipeBookGui.java

@@ -1,20 +0,0 @@
-package me.shedaniel.mixins;
-
-import me.shedaniel.listenerdefinitions.IMixinRecipeBookGui;
-import net.minecraft.client.gui.recipebook.RecipeBookGui;
-import net.minecraft.client.gui.widget.RecipeBookGhostSlots;
-import org.spongepowered.asm.mixin.Final;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.Shadow;
-
-@Mixin(RecipeBookGui.class)
-public class MixinRecipeBookGui implements IMixinRecipeBookGui {
-    
-    @Shadow @Final protected RecipeBookGhostSlots ghostSlots;
-    
-    @Override
-    public RecipeBookGhostSlots getGhostSlots() {
-        return ghostSlots;
-    }
-    
-}

+ 0 - 27
src/main/java/me/shedaniel/mixins/MixinRecipeManager.java

@@ -1,27 +0,0 @@
-package me.shedaniel.mixins;
-
-import me.shedaniel.Core;
-import me.shedaniel.listenerdefinitions.RecipeLoadListener;
-import net.minecraft.client.network.ClientPlayNetworkHandler;
-import net.minecraft.client.network.packet.SynchronizeRecipesClientPacket;
-import net.minecraft.recipe.RecipeManager;
-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.Inject;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-
-@Mixin(ClientPlayNetworkHandler.class)
-public class MixinRecipeManager {
-    
-    @Shadow
-    RecipeManager recipeManager;
-    
-    @Inject(method = "onSynchronizeRecipes", at = @At("RETURN"))
-    private void onUpdateRecipies(SynchronizeRecipesClientPacket packetIn, CallbackInfo ci) {
-        for(RecipeLoadListener listener : Core.getListeners(RecipeLoadListener.class)) {
-            listener.recipesLoaded(recipeManager);
-        }
-    }
-    
-}

+ 0 - 49
src/main/java/me/shedaniel/network/CheatPacket.java

@@ -1,49 +0,0 @@
-package me.shedaniel.network;
-
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.CompoundTag;
-import net.minecraft.network.Packet;
-import net.minecraft.server.network.ServerPlayNetworkHandler;
-import net.minecraft.server.network.ServerPlayerEntity;
-import net.minecraft.sortme.ChatMessageType;
-import net.minecraft.text.TranslatableTextComponent;
-import net.minecraft.util.PacketByteBuf;
-
-import java.io.IOException;
-
-/**
- * Created by James on 7/29/2018.
- */
-public class CheatPacket implements Packet<ServerPlayNetworkHandler> {
-    
-    private ItemStack stack;
-    
-    public CheatPacket() {
-    }
-    
-    public CheatPacket(ItemStack stack) {
-        this.stack = stack;
-    }
-    
-    @Override
-    public void read(PacketByteBuf packetBuffer) throws IOException {
-        stack = ItemStack.fromTag(packetBuffer.readCompoundTag());
-    }
-    
-    @Override
-    public void write(PacketByteBuf packetBuffer) throws IOException {
-        CompoundTag tag = new CompoundTag();
-        stack.setTag(tag);
-        packetBuffer.writeCompoundTag(tag);
-    }
-    
-    @Override
-    public void apply(ServerPlayNetworkHandler iNetHandlerPlayServer) {
-        ServerPlayNetworkHandler server = (ServerPlayNetworkHandler) iNetHandlerPlayServer;
-        ServerPlayerEntity player = server.player;
-        if (player.inventory.insertStack(stack.copy()))
-            player.sendChatMessage(new TranslatableTextComponent("text.rei.cheat_items", stack.getDisplayName().getFormattedText(), stack.getAmount(), player.getEntityName()), ChatMessageType.SYSTEM);
-        else player.sendChatMessage(new TranslatableTextComponent("text.rei.failed_cheat_items"), ChatMessageType.SYSTEM);
-    }
-    
-}

+ 0 - 33
src/main/java/me/shedaniel/network/DeletePacket.java

@@ -1,33 +0,0 @@
-package me.shedaniel.network;
-
-import net.minecraft.item.ItemStack;
-import net.minecraft.network.Packet;
-import net.minecraft.server.network.ServerPlayNetworkHandler;
-import net.minecraft.server.network.ServerPlayerEntity;
-import net.minecraft.util.PacketByteBuf;
-
-import java.io.IOException;
-
-public class DeletePacket implements Packet<ServerPlayNetworkHandler> {
-    
-    @Override
-    public void apply(ServerPlayNetworkHandler iNetHandlerPlayServer) {
-        ServerPlayNetworkHandler server = (ServerPlayNetworkHandler) iNetHandlerPlayServer;
-        ServerPlayerEntity player = server.player;
-        
-        if (!player.inventory.getCursorStack().isEmpty()) {
-            player.inventory.setCursorStack(ItemStack.EMPTY);
-        }
-    }
-    
-    @Override
-    public void read(PacketByteBuf packetByteBuf) throws IOException {
-    
-    }
-    
-    @Override
-    public void write(PacketByteBuf packetByteBuf) throws IOException {
-    
-    }
-    
-}

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

@@ -1,40 +0,0 @@
-package me.shedaniel.plugin;
-
-import me.shedaniel.api.IRecipe;
-import net.minecraft.block.Blocks;
-import net.minecraft.item.ItemStack;
-
-import java.util.ArrayList;
-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.getItem())}));
-    }
-    
-    @Override
-    public List<List<ItemStack>> getInput() {
-        return new LinkedList<>(Arrays.asList(new LinkedList<>(Arrays.asList(new ItemStack[]{new ItemStack(Blocks.OAK_LOG.getItem())}))));
-    }
-    
-    @Override
-    public List<List<ItemStack>> getRecipeRequiredInput() {
-        return new ArrayList<>();
-    }
-    
-}

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

@@ -1,70 +0,0 @@
-package me.shedaniel.plugin;
-
-import me.shedaniel.api.IDisplayCategory;
-import me.shedaniel.gui.widget.Control;
-import me.shedaniel.gui.widget.REISlot;
-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;
-    }
-    
-}

+ 0 - 105
src/main/java/me/shedaniel/plugin/VanillaPlugin.java

@@ -1,105 +0,0 @@
-package me.shedaniel.plugin;
-
-import me.shedaniel.api.IREIPlugin;
-import me.shedaniel.impl.REIRecipeManager;
-import me.shedaniel.listenerdefinitions.PotionCraftingAdder;
-import me.shedaniel.plugin.blastfurnace.VanillaBlastFurnaceCategory;
-import me.shedaniel.plugin.blastfurnace.VanillaBlastFurnaceRecipe;
-import me.shedaniel.plugin.crafting.VanillaCraftingCategory;
-import me.shedaniel.plugin.crafting.VanillaCraftingRecipe;
-import me.shedaniel.plugin.crafting.VanillaShapedCraftingRecipe;
-import me.shedaniel.plugin.crafting.VanillaShapelessCraftingRecipe;
-import me.shedaniel.plugin.furnace.VanillaFurnaceCategory;
-import me.shedaniel.plugin.furnace.VanillaFurnaceRecipe;
-import me.shedaniel.plugin.potion.VanillaPotionCategory;
-import me.shedaniel.plugin.potion.VanillaPotionRecipe;
-import me.shedaniel.plugin.smoker.VanillaSmokerCategory;
-import me.shedaniel.plugin.smoker.VanillaSmokerRecipe;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.item.Items;
-import net.minecraft.potion.Potion;
-import net.minecraft.potion.PotionUtil;
-import net.minecraft.potion.Potions;
-import net.minecraft.recipe.Ingredient;
-import net.minecraft.recipe.Recipe;
-import net.minecraft.recipe.crafting.ShapedRecipe;
-import net.minecraft.recipe.crafting.ShapelessRecipe;
-import net.minecraft.recipe.smelting.BlastingRecipe;
-import net.minecraft.recipe.smelting.SmeltingRecipe;
-import net.minecraft.recipe.smelting.SmokingRecipe;
-import net.minecraft.util.registry.Registry;
-
-import java.util.LinkedList;
-import java.util.List;
-import java.util.stream.Collectors;
-
-public class VanillaPlugin implements IREIPlugin, PotionCraftingAdder {
-    
-    private List<VanillaPotionRecipe> potionRecipes = new LinkedList<>();
-    private List<VanillaCraftingRecipe> recipes = new LinkedList<>();
-    private List<VanillaFurnaceRecipe> furnaceRecipes = new LinkedList<>();
-    private List<VanillaSmokerRecipe> smokerRecipes = new LinkedList<>();
-    private List<VanillaBlastFurnaceRecipe> blastFurnaceRecipes = new LinkedList<>();
-    
-    @Override
-    public void registerCategories() {
-        REIRecipeManager.instance().addDisplayAdapter(new VanillaCraftingCategory());
-        REIRecipeManager.instance().addDisplayAdapter(new VanillaFurnaceCategory());
-        REIRecipeManager.instance().addDisplayAdapter(new VanillaSmokerCategory());
-        REIRecipeManager.instance().addDisplayAdapter(new VanillaBlastFurnaceCategory());
-        REIRecipeManager.instance().addDisplayAdapter(new VanillaPotionCategory());
-//        REIRecipeManager.instance().addDisplayAdapter(new TestRandomCategory("a", new ItemStack(Items.ITEM_FRAME)));
-//        REIRecipeManager.instance().addDisplayAdapter(new TestRandomCategory("b", new ItemStack(Items.ITEM_FRAME)));
-//        REIRecipeManager.instance().addDisplayAdapter(new TestRandomCategory("c", new ItemStack(Items.ITEM_FRAME)));
-//        REIRecipeManager.instance().addDisplayAdapter(new TestRandomCategory("d", new ItemStack(Items.ITEM_FRAME)));
-//        REIRecipeManager.instance().addDisplayAdapter(new TestRandomCategory("e", new ItemStack(Items.ITEM_FRAME)));
-    }
-    
-    @Override
-    public void registerRecipes() {
-        for(Recipe recipe : REIRecipeManager.instance().recipeManager.values())
-            if (recipe instanceof ShapelessRecipe)
-                recipes.add(new VanillaShapelessCraftingRecipe((ShapelessRecipe) recipe));
-            else if (recipe instanceof ShapedRecipe)
-                recipes.add(new VanillaShapedCraftingRecipe((ShapedRecipe) recipe));
-            else if (recipe instanceof SmeltingRecipe)
-                furnaceRecipes.add(new VanillaFurnaceRecipe((SmeltingRecipe) recipe));
-            else if (recipe instanceof SmokingRecipe)
-                smokerRecipes.add(new VanillaSmokerRecipe((SmokingRecipe) recipe));
-            else if (recipe instanceof BlastingRecipe)
-                blastFurnaceRecipes.add(new VanillaBlastFurnaceRecipe((BlastingRecipe) recipe));
-        Registry.POTION.stream().filter(potion -> !potion.equals(Potions.EMPTY)).forEach(potion -> {
-            ItemStack basePotion = PotionUtil.setPotion(new ItemStack(Items.POTION), potion),
-                    splashPotion = PotionUtil.setPotion(new ItemStack(Items.SPLASH_POTION), potion),
-                    lingeringPotion = PotionUtil.setPotion(new ItemStack(Items.LINGERING_POTION), potion);
-            potionRecipes.add(new VanillaPotionRecipe(new ItemStack[]{basePotion}, Ingredient.ofItems(Items.GUNPOWDER).getStackArray(),
-                    new ItemStack[]{splashPotion}));
-            potionRecipes.add(new VanillaPotionRecipe(new ItemStack[]{splashPotion}, Ingredient.ofItems(Items.DRAGON_BREATH).getStackArray(),
-                    new ItemStack[]{lingeringPotion}));
-        });
-        
-        REIRecipeManager.instance().addRecipe("vanilla", recipes);
-        REIRecipeManager.instance().addRecipe("furnace", furnaceRecipes);
-        REIRecipeManager.instance().addRecipe("smoker", smokerRecipes);
-        REIRecipeManager.instance().addRecipe("potion", potionRecipes.stream().distinct().collect(Collectors.toList()));
-        REIRecipeManager.instance().addRecipe("blastingfurnace", blastFurnaceRecipes);
-//        REIRecipeManager.instance().addRecipe("a", Arrays.asList(new RandomRecipe("a")));
-//        REIRecipeManager.instance().addRecipe("b", Arrays.asList(new RandomRecipe("b")));
-//        REIRecipeManager.instance().addRecipe("c", Arrays.asList(new RandomRecipe("c")));
-//        REIRecipeManager.instance().addRecipe("d", Arrays.asList(new RandomRecipe("d")));
-//        REIRecipeManager.instance().addRecipe("e", Arrays.asList(new RandomRecipe("e")));
-    }
-    
-    @Override
-    public void registerSpecialGuiExclusion() {
-    
-    }
-    
-    @Override
-    public void addPotionRecipe(Potion inputType, Item reagent, Potion outputType) {
-        potionRecipes.add(new VanillaPotionRecipe(new ItemStack[]{PotionUtil.setPotion(new ItemStack(Items.POTION), inputType)},
-                Ingredient.ofItems(reagent).getStackArray(),
-                new ItemStack[]{PotionUtil.setPotion(new ItemStack(Items.POTION), outputType)}));
-    }
-}

+ 0 - 126
src/main/java/me/shedaniel/plugin/blastfurnace/VanillaBlastFurnaceCategory.java

@@ -1,126 +0,0 @@
-package me.shedaniel.plugin.blastfurnace;
-
-import me.shedaniel.api.IDisplayCategoryCraftable;
-import me.shedaniel.gui.RecipeGui;
-import me.shedaniel.gui.widget.Control;
-import me.shedaniel.gui.widget.REISlot;
-import me.shedaniel.gui.widget.SmallButton;
-import me.shedaniel.gui.widget.WidgetArrow;
-import me.shedaniel.listenerdefinitions.IMixinRecipeBookGui;
-import net.minecraft.block.Blocks;
-import net.minecraft.block.entity.BlastFurnaceBlockEntity;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.gui.Gui;
-import net.minecraft.client.gui.container.BlastFurnaceGui;
-import net.minecraft.client.resource.language.I18n;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.stream.Collectors;
-
-public class VanillaBlastFurnaceCategory implements IDisplayCategoryCraftable<VanillaBlastFurnaceRecipe> {
-    private List<VanillaBlastFurnaceRecipe> recipes;
-    
-    @Override
-    public String getId() {
-        return "blastingfurnace";
-    }
-    
-    @Override
-    public String getDisplayName() {
-        return I18n.translate("category.rei.blasting");
-    }
-    
-    @Override
-    public void addRecipe(VanillaBlastFurnaceRecipe 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) {
-        List<REISlot> slots = new LinkedList<>();
-        REISlot inputSlot = new REISlot(50, 70 + number * 75);
-        inputSlot.setStackList(recipes.get(number).getInput().get(0));
-        inputSlot.setDrawBackground(true);
-        
-        REISlot outputSlot = new REISlot(110, 70 + number * 75);
-        outputSlot.setStackList(recipes.get(number).getOutput());
-        outputSlot.setDrawBackground(true);
-        
-        REISlot fuelSlot = new REISlot(80, 100 + number * 75);
-        fuelSlot.setStackList(getFuel());
-        fuelSlot.setDrawBackground(true);
-        fuelSlot.setExtraTooltip(I18n.translate("category.rei.smelting.fuel"));
-        
-        slots.add(inputSlot);
-        slots.add(outputSlot);
-        slots.add(fuelSlot);
-        return slots;
-    }
-    
-    @Override
-    public boolean canDisplay(VanillaBlastFurnaceRecipe recipe) {
-        return false;
-    }
-    
-    @Override
-    public void drawExtras() {
-    
-    }
-    
-    @Override
-    public void addWidget(List<Control> controls, int number) {
-        WidgetArrow wa = new WidgetArrow(75, 70 + number * 75, true, 10);
-        controls.add(wa);
-    }
-    
-    private List<ItemStack> getFuel() {
-        return BlastFurnaceBlockEntity.createBurnableMap().keySet().stream().map(Item::getDefaultStack).collect(Collectors.toList());
-    }
-    
-    @Override
-    public ItemStack getCategoryIcon() {
-        return new ItemStack(Blocks.BLAST_FURNACE.getItem());
-    }
-    
-    @Override
-    public boolean canAutoCraftHere(Class<? extends Gui> guiClass, VanillaBlastFurnaceRecipe recipe) {
-        return guiClass.isAssignableFrom(BlastFurnaceGui.class);
-    }
-    
-    @Override
-    public boolean performAutoCraft(Gui gui, VanillaBlastFurnaceRecipe recipe) {
-        if (!gui.getClass().isAssignableFrom(BlastFurnaceGui.class))
-            return false;
-        ((IMixinRecipeBookGui) (((BlastFurnaceGui) gui).getRecipeBookGui())).getGhostSlots().reset();
-        MinecraftClient.getInstance().interactionManager.clickRecipe(MinecraftClient.getInstance().player.container.syncId, recipe.getRecipe(), Gui.isShiftPressed());
-        return false;
-    }
-    
-    @Override
-    public void registerAutoCraftButton(List<Control> control, RecipeGui recipeGui, Gui parentGui, VanillaBlastFurnaceRecipe recipe, int number) {
-        SmallButton button = new SmallButton(128, 75 + 6 + 26 + number * 75, 10, 10, "+", enabled -> {
-            if (!(parentGui instanceof BlastFurnaceGui))
-                return I18n.translate("text.auto_craft.wrong_gui");
-            return "";
-        });
-        button.setOnClick(mouse -> {
-            recipeGui.close();
-            MinecraftClient.getInstance().openGui(parentGui);
-            return canAutoCraftHere(parentGui.getClass(), recipe) && performAutoCraft(parentGui, recipe);
-        });
-        button.setEnabled(canAutoCraftHere(parentGui.getClass(), recipe));
-        control.add(button);
-    }
-    
-}

+ 0 - 58
src/main/java/me/shedaniel/plugin/blastfurnace/VanillaBlastFurnaceRecipe.java

@@ -1,58 +0,0 @@
-package me.shedaniel.plugin.blastfurnace;
-
-import me.shedaniel.api.IRecipe;
-import net.minecraft.block.BlastFurnaceBlock;
-import net.minecraft.block.entity.BlastFurnaceBlockEntity;
-import net.minecraft.block.entity.FurnaceBlockEntity;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.recipe.Ingredient;
-import net.minecraft.recipe.smelting.BlastingRecipe;
-import net.minecraft.recipe.smelting.SmokingRecipe;
-
-import java.util.*;
-import java.util.stream.Collectors;
-
-public class VanillaBlastFurnaceRecipe implements IRecipe<ItemStack> {
-    private final BlastingRecipe recipe;
-    
-    @Override
-    public String getId() {
-        return "blastingfurnace";
-    }
-    
-    public VanillaBlastFurnaceRecipe(BlastingRecipe recipe) {
-        this.recipe = recipe;
-    }
-    
-    @Override
-    public List<ItemStack> getOutput() {
-        List<ItemStack> output = new LinkedList<>();
-        output.add(recipe.getOutput().copy());
-        return output;
-    }
-    
-    @Override
-    public List<List<ItemStack>> getInput() {
-        List<List<ItemStack>> input = new LinkedList<>();
-        for(Ingredient ingredient : recipe.getPreviewInputs()) {
-            List<ItemStack> ingredients = Arrays.asList(ingredient.getStackArray());
-            input.add(ingredients);
-        }
-        input.add(BlastFurnaceBlockEntity.createBurnableMap().keySet().stream().map(Item::getDefaultStack).collect(Collectors.toList()));
-        return input;
-    }
-    
-    @Override
-    public List<List<ItemStack>> getRecipeRequiredInput() {
-        List<List<ItemStack>> input = new LinkedList<>();
-        for(Ingredient ingredient : recipe.getPreviewInputs())
-            Collections.addAll(input, new LinkedList<>(Arrays.asList(ingredient.getStackArray())));
-        return input;
-    }
-    
-    public BlastingRecipe getRecipe() {
-        return recipe;
-    }
-    
-}

+ 0 - 157
src/main/java/me/shedaniel/plugin/crafting/VanillaCraftingCategory.java

@@ -1,157 +0,0 @@
-package me.shedaniel.plugin.crafting;
-
-import me.shedaniel.api.IDisplayCategoryCraftable;
-import me.shedaniel.gui.RecipeGui;
-import me.shedaniel.gui.widget.*;
-import me.shedaniel.listenerdefinitions.IMixinRecipeBookGui;
-import net.minecraft.block.Blocks;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.gui.Gui;
-import net.minecraft.client.gui.container.CraftingTableGui;
-import net.minecraft.client.gui.ingame.PlayerInventoryGui;
-import net.minecraft.client.resource.language.I18n;
-import net.minecraft.client.util.Window;
-import net.minecraft.item.ItemStack;
-
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-
-public class VanillaCraftingCategory implements IDisplayCategoryCraftable<VanillaCraftingRecipe> {
-    Window mainWindow = MinecraftClient.getInstance().window;
-    private List<VanillaCraftingRecipe> recipes;
-    
-    @Override
-    public String getId() {
-        return "vanilla";
-    }
-    
-    @Override
-    public String getDisplayName() {
-        return I18n.translate("category.rei.crafting");
-    }
-    
-    @Override
-    public void addRecipe(VanillaCraftingRecipe 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) {
-        List<REISlot> slots = new LinkedList<>();
-        int count = 0;
-        List<List<ItemStack>> input = recipes.get(number).getInput();
-        for(int y = 0; y < 3; y++) {
-            for(int x = 0; x < 3; x++) {
-                REISlot slot = new REISlot(20 + x * 18, 75 + y * 18 + number * 75);
-                slot.setDrawBackground(true);
-                slots.add(slot);
-                count++;
-            }
-        }
-        for(int i = 0; i < input.size(); i++) {
-            if (recipes.get(number) instanceof VanillaShapedCraftingRecipe) {
-                if (!input.get(i).isEmpty())
-                    slots.get(getSlotWithSize(number, i)).setStackList(input.get(i));
-            } else if (!input.get(i).isEmpty())
-                slots.get(i).setStackList(input.get(i));
-        }
-        REISlot slot = new REISlot(130, 75 + 18 + number * 75) {
-            @Override
-            public String getTextOverlay(ItemStack stack) {
-                if (stack.getAmount() == 1)
-                    return "";
-                return stack.getAmount() + "";
-            }
-        };
-        slot.setDrawBackground(true);
-        slot.setStack(recipes.get(number).getOutput().get(0).copy());
-        slots.add(slot);
-        return slots;
-    }
-    
-    @Override
-    public boolean canDisplay(VanillaCraftingRecipe recipe) {
-        return false;
-    }
-    
-    @Override
-    public void drawExtras() {
-    
-    }
-    
-    @Override
-    public void addWidget(List<Control> controls, int number) {
-        WidgetArrow wa = new WidgetArrow(90, 70 + 22 + number * 75, false);
-        controls.add(wa);
-    }
-    
-    private int getSlotWithSize(int number, int num) {
-        if (recipes.get(number).getWidth() == 1) {
-            if (num == 1)
-                return 3;
-            if (num == 2)
-                return 6;
-        }
-        
-        if (recipes.get(number).getWidth() == 2) {
-            if (num == 2)
-                return 3;
-            if (num == 3)
-                return 4;
-            if (num == 4)
-                return 6;
-            if (num == 5)
-                return 7;
-            
-        }
-        return num;
-    }
-    
-    @Override
-    public ItemStack getCategoryIcon() {
-        return new ItemStack(Blocks.CRAFTING_TABLE.getItem());
-    }
-    
-    @Override
-    public boolean canAutoCraftHere(Class<? extends Gui> guiClass, VanillaCraftingRecipe recipe) {
-        return guiClass.isAssignableFrom(CraftingTableGui.class) || (guiClass.isAssignableFrom(PlayerInventoryGui.class) && recipe.getHeight() < 3 && recipe.getWidth() < 3);
-    }
-    
-    @Override
-    public boolean performAutoCraft(Gui gui, VanillaCraftingRecipe recipe) {
-        if (gui.getClass().isAssignableFrom(CraftingTableGui.class))
-            ((IMixinRecipeBookGui) (((CraftingTableGui) gui).getRecipeBookGui())).getGhostSlots().reset();
-        else if (gui.getClass().isAssignableFrom(PlayerInventoryGui.class))
-            ((IMixinRecipeBookGui) (((PlayerInventoryGui) gui).getRecipeBookGui())).getGhostSlots().reset();
-        else return false;
-        MinecraftClient.getInstance().interactionManager.clickRecipe(MinecraftClient.getInstance().player.container.syncId, recipe.getRecipe(), Gui.isShiftPressed());
-        return true;
-    }
-    
-    @Override
-    public void registerAutoCraftButton(List<Control> control, RecipeGui recipeGui, Gui parentGui, VanillaCraftingRecipe recipe, int number) {
-        SmallButton button = new SmallButton(78, 75 + 6 + 36 + number * 75, 10, 10, "+", enabled -> {
-            if (!(parentGui instanceof CraftingTableGui || parentGui instanceof PlayerInventoryGui))
-                return I18n.translate("text.auto_craft.wrong_gui");
-            if (parentGui instanceof PlayerInventoryGui && !(recipe.getHeight() < 3 && recipe.getWidth() < 3))
-                return I18n.translate("text.auto_craft.crafting.too_small");
-            return "";
-        });
-        button.setOnClick(mouse -> {
-            recipeGui.close();
-            MinecraftClient.getInstance().openGui(parentGui);
-            return canAutoCraftHere(parentGui.getClass(), recipe) && performAutoCraft(parentGui, recipe);
-        });
-        button.setEnabled(canAutoCraftHere(parentGui.getClass(), recipe));
-        control.add(button);
-    }
-    
-}

+ 0 - 28
src/main/java/me/shedaniel/plugin/crafting/VanillaCraftingRecipe.java

@@ -1,28 +0,0 @@
-package me.shedaniel.plugin.crafting;
-
-import me.shedaniel.api.IRecipe;
-import net.minecraft.item.ItemStack;
-import net.minecraft.recipe.Recipe;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-public abstract class VanillaCraftingRecipe implements IRecipe<ItemStack> {
-    
-    public int getWidth() {
-        return 2;
-    }
-    
-    public int getHeight() {
-        return 2;
-    }
-    
-    public abstract Recipe getRecipe();
-    
-    @Override
-    public List<List<ItemStack>> getRecipeRequiredInput() {
-        return getInput();
-    }
-    
-}

+ 0 - 59
src/main/java/me/shedaniel/plugin/crafting/VanillaShapedCraftingRecipe.java

@@ -1,59 +0,0 @@
-package me.shedaniel.plugin.crafting;
-
-import net.minecraft.item.ItemStack;
-import net.minecraft.recipe.Ingredient;
-import net.minecraft.recipe.crafting.ShapedRecipe;
-
-import java.util.LinkedList;
-import java.util.List;
-
-public class VanillaShapedCraftingRecipe extends VanillaCraftingRecipe {
-    
-    private final ShapedRecipe recipe;
-    
-    public VanillaShapedCraftingRecipe(ShapedRecipe recipe) {
-        this.recipe = recipe;
-    }
-    
-    @Override
-    public ShapedRecipe getRecipe() {
-        return recipe;
-    }
-    
-    @Override
-    public int getWidth() {
-        return recipe.getWidth();
-    }
-    
-    @Override
-    public int getHeight() {
-        return recipe.getHeight();
-    }
-    
-    @Override
-    public String getId() {
-        return "vanilla";
-    }
-    
-    @Override
-    public List<ItemStack> getOutput() {
-        List<ItemStack> output = new LinkedList<>();
-        output.add(recipe.getOutput());
-        return output;
-    }
-    
-    @Override
-    public List<List<ItemStack>> getInput() {
-        List<List<ItemStack>> input = new LinkedList<>();
-        int count = 0;
-        for(Ingredient ingredient : recipe.getPreviewInputs()) {
-            List<ItemStack> ingList = new LinkedList<>();
-            for(ItemStack matchingStack : ingredient.getStackArray()) {
-                ingList.add(matchingStack);
-            }
-            input.add(ingList);
-            count++;
-        }
-        return input;
-    }
-}

+ 0 - 61
src/main/java/me/shedaniel/plugin/crafting/VanillaShapelessCraftingRecipe.java

@@ -1,61 +0,0 @@
-package me.shedaniel.plugin.crafting;
-
-import net.minecraft.item.ItemStack;
-import net.minecraft.recipe.Ingredient;
-import net.minecraft.recipe.crafting.ShapelessRecipe;
-
-import java.util.LinkedList;
-import java.util.List;
-
-public class VanillaShapelessCraftingRecipe extends VanillaCraftingRecipe {
-    
-    private final ShapelessRecipe recipe;
-    
-    public VanillaShapelessCraftingRecipe(ShapelessRecipe recipe) {
-        this.recipe = recipe;
-    }
-    
-    @Override
-    public ShapelessRecipe getRecipe() {
-        return recipe;
-    }
-    
-    @Override
-    public String getId() {
-        return "vanilla";
-    }
-    
-    @Override
-    public List<ItemStack> getOutput() {
-        List<ItemStack> output = new LinkedList<>();
-        output.add(recipe.getOutput());
-        return output;
-    }
-    
-    @Override
-    public List<List<ItemStack>> getInput() {
-        List<List<ItemStack>> input = new LinkedList<>();
-        for(Ingredient ingredient : recipe.getPreviewInputs()) {
-            List<ItemStack> ingList = new LinkedList<>();
-            for(ItemStack matchingStack : ingredient.getStackArray()) {
-                ingList.add(matchingStack);
-            }
-            input.add(ingList);
-        }
-        return input;
-    }
-    
-    @Override
-    public int getWidth() {
-        if (recipe.getPreviewInputs().size() > 4)
-            return 3;
-        return 2;
-    }
-    
-    @Override
-    public int getHeight() {
-        if (recipe.getPreviewInputs().size() > 4)
-            return 3;
-        return 2;
-    }
-}

+ 0 - 126
src/main/java/me/shedaniel/plugin/furnace/VanillaFurnaceCategory.java

@@ -1,126 +0,0 @@
-package me.shedaniel.plugin.furnace;
-
-import me.shedaniel.api.IDisplayCategoryCraftable;
-import me.shedaniel.gui.RecipeGui;
-import me.shedaniel.gui.widget.Control;
-import me.shedaniel.gui.widget.REISlot;
-import me.shedaniel.gui.widget.SmallButton;
-import me.shedaniel.gui.widget.WidgetArrow;
-import me.shedaniel.listenerdefinitions.IMixinRecipeBookGui;
-import net.minecraft.block.Blocks;
-import net.minecraft.block.entity.FurnaceBlockEntity;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.gui.Gui;
-import net.minecraft.client.gui.container.FurnaceGui;
-import net.minecraft.client.resource.language.I18n;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.stream.Collectors;
-
-public class VanillaFurnaceCategory implements IDisplayCategoryCraftable<VanillaFurnaceRecipe> {
-    private List<VanillaFurnaceRecipe> recipes;
-    
-    @Override
-    public String getId() {
-        return "furnace";
-    }
-    
-    @Override
-    public String getDisplayName() {
-        return I18n.translate("category.rei.smelting");
-    }
-    
-    @Override
-    public void addRecipe(VanillaFurnaceRecipe 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) {
-        List<REISlot> slots = new LinkedList<>();
-        REISlot inputSlot = new REISlot(50, 70 + number * 75);
-        inputSlot.setStackList(recipes.get(number).getInput().get(0));
-        inputSlot.setDrawBackground(true);
-        
-        REISlot outputSlot = new REISlot(110, 70 + number * 75);
-        outputSlot.setStackList(recipes.get(number).getOutput());
-        outputSlot.setDrawBackground(true);
-        
-        REISlot fuelSlot = new REISlot(80, 100 + number * 75);
-        fuelSlot.setStackList(getFuel());
-        fuelSlot.setDrawBackground(true);
-        fuelSlot.setExtraTooltip(I18n.translate("category.rei.smelting.fuel"));
-        
-        slots.add(inputSlot);
-        slots.add(outputSlot);
-        slots.add(fuelSlot);
-        return slots;
-    }
-    
-    @Override
-    public boolean canDisplay(VanillaFurnaceRecipe recipe) {
-        return false;
-    }
-    
-    @Override
-    public void drawExtras() {
-    
-    }
-    
-    @Override
-    public void addWidget(List<Control> controls, int number) {
-        WidgetArrow wa = new WidgetArrow(75, 70 + number * 75, true);
-        controls.add(wa);
-    }
-    
-    private List<ItemStack> getFuel() {
-        return FurnaceBlockEntity.createBurnableMap().keySet().stream().map(Item::getDefaultStack).collect(Collectors.toList());
-    }
-    
-    @Override
-    public ItemStack getCategoryIcon() {
-        return new ItemStack(Blocks.FURNACE.getItem());
-    }
-    
-    @Override
-    public boolean canAutoCraftHere(Class<? extends Gui> guiClass, VanillaFurnaceRecipe recipe) {
-        return guiClass.isAssignableFrom(FurnaceGui.class);
-    }
-    
-    @Override
-    public boolean performAutoCraft(Gui gui, VanillaFurnaceRecipe recipe) {
-        if (!gui.getClass().isAssignableFrom(FurnaceGui.class))
-            return false;
-        ((IMixinRecipeBookGui) (((FurnaceGui) gui).getRecipeBookGui())).getGhostSlots().reset();
-        MinecraftClient.getInstance().interactionManager.clickRecipe(MinecraftClient.getInstance().player.container.syncId, recipe.getRecipe(), Gui.isShiftPressed());
-        return false;
-    }
-    
-    @Override
-    public void registerAutoCraftButton(List<Control> control, RecipeGui recipeGui, Gui parentGui, VanillaFurnaceRecipe recipe, int number) {
-        SmallButton button = new SmallButton(128, 75 + 6 + 26 + number * 75, 10, 10, "+", enabled -> {
-            if (!(parentGui instanceof FurnaceGui))
-                return I18n.translate("text.auto_craft.wrong_gui");
-            return "";
-        });
-        button.setOnClick(mouse -> {
-            recipeGui.close();
-            MinecraftClient.getInstance().openGui(parentGui);
-            return canAutoCraftHere(parentGui.getClass(), recipe) && performAutoCraft(parentGui, recipe);
-        });
-        button.setEnabled(canAutoCraftHere(parentGui.getClass(), recipe));
-        control.add(button);
-    }
-    
-}

+ 0 - 60
src/main/java/me/shedaniel/plugin/furnace/VanillaFurnaceRecipe.java

@@ -1,60 +0,0 @@
-package me.shedaniel.plugin.furnace;
-
-import me.shedaniel.api.IRecipe;
-import net.minecraft.block.entity.FurnaceBlockEntity;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.recipe.Ingredient;
-import net.minecraft.recipe.Recipe;
-import net.minecraft.recipe.smelting.SmeltingRecipe;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.stream.Collectors;
-
-public class VanillaFurnaceRecipe implements IRecipe<ItemStack> {
-    
-    private final SmeltingRecipe recipe;
-    
-    @Override
-    public String getId() {
-        return "furnace";
-    }
-    
-    public VanillaFurnaceRecipe(SmeltingRecipe recipe) {
-        this.recipe = recipe;
-    }
-    
-    @Override
-    public List<ItemStack> getOutput() {
-        List<ItemStack> output = new LinkedList<>();
-        output.add(recipe.getOutput().copy());
-        return output;
-    }
-    
-    @Override
-    public List<List<ItemStack>> getInput() {
-        List<List<ItemStack>> input = new LinkedList<>();
-        for(Ingredient ingredient : recipe.getPreviewInputs()) {
-            List<ItemStack> ingredients = Arrays.asList(ingredient.getStackArray());
-            input.add(ingredients);
-        }
-        input.add(FurnaceBlockEntity.createBurnableMap().keySet().stream().map(Item::getDefaultStack).collect(Collectors.toList()));
-        return input;
-    }
-    
-    @Override
-    public List<List<ItemStack>> getRecipeRequiredInput() {
-        List<List<ItemStack>> input = new LinkedList<>();
-        for(Ingredient ingredient : recipe.getPreviewInputs())
-            Collections.addAll(input, new LinkedList<>(Arrays.asList(ingredient.getStackArray())));
-        return input;
-    }
-    
-    public Recipe getRecipe() {
-        return recipe;
-    }
-    
-}

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

@@ -1,189 +0,0 @@
-package me.shedaniel.plugin.potion;
-
-import com.mojang.blaze3d.platform.GlStateManager;
-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.block.Blocks;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.resource.language.I18n;
-import net.minecraft.item.ItemStack;
-import net.minecraft.item.Items;
-import net.minecraft.util.Identifier;
-
-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.translate("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 Identifier RECIPE_GUI = new Identifier("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.getItem());
-    }
-    
-    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();
-            MinecraftClient.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) {
-                MinecraftClient.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.translate("text.rei.mod", getMod()));
-            Point mouse = REIRenderHelper.getMouseLoc();
-            MinecraftClient.getInstance().currentGui.drawTooltip(toolTip, mouse.x, mouse.y);
-        }
-    }
-    
-    public static String getTooltip(SlotType slotType) {
-        switch (slotType) {
-            case INPUT:
-                return I18n.translate("category.rei.brewing.input");
-            case REACT:
-                return I18n.translate("category.rei.brewing.reactant");
-            case OUTPUT:
-                return I18n.translate("category.rei.brewing.result");
-        }
-        return null;
-    }
-    
-    public enum SlotType {
-        INPUT, REACT, OUTPUT, BLAZE_POWDER;
-    }
-}

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

@@ -1,56 +0,0 @@
-package me.shedaniel.plugin.potion;
-
-import me.shedaniel.api.IRecipe;
-import net.minecraft.block.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;
-    }
-    
-    @Override
-    public List<List<ItemStack>> getRecipeRequiredInput() {
-        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;
-    }
-}

+ 0 - 126
src/main/java/me/shedaniel/plugin/smoker/VanillaSmokerCategory.java

@@ -1,126 +0,0 @@
-package me.shedaniel.plugin.smoker;
-
-import me.shedaniel.api.IDisplayCategoryCraftable;
-import me.shedaniel.gui.RecipeGui;
-import me.shedaniel.gui.widget.Control;
-import me.shedaniel.gui.widget.REISlot;
-import me.shedaniel.gui.widget.SmallButton;
-import me.shedaniel.gui.widget.WidgetArrow;
-import me.shedaniel.listenerdefinitions.IMixinRecipeBookGui;
-import net.minecraft.block.Blocks;
-import net.minecraft.block.entity.SmokerBlockEntity;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.gui.Gui;
-import net.minecraft.client.gui.container.SmokerGui;
-import net.minecraft.client.resource.language.I18n;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.stream.Collectors;
-
-public class VanillaSmokerCategory implements IDisplayCategoryCraftable<VanillaSmokerRecipe> {
-    private List<VanillaSmokerRecipe> recipes;
-    
-    @Override
-    public String getId() {
-        return "smoker";
-    }
-    
-    @Override
-    public String getDisplayName() {
-        return I18n.translate("category.rei.smoking");
-    }
-    
-    @Override
-    public void addRecipe(VanillaSmokerRecipe 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) {
-        List<REISlot> slots = new LinkedList<>();
-        REISlot inputSlot = new REISlot(50, 70 + number * 75);
-        inputSlot.setStackList(recipes.get(number).getInput().get(0));
-        inputSlot.setDrawBackground(true);
-        
-        REISlot outputSlot = new REISlot(110, 70 + number * 75);
-        outputSlot.setStackList(recipes.get(number).getOutput());
-        outputSlot.setDrawBackground(true);
-        
-        REISlot fuelSlot = new REISlot(80, 100 + number * 75);
-        fuelSlot.setStackList(getFuel());
-        fuelSlot.setDrawBackground(true);
-        fuelSlot.setExtraTooltip(I18n.translate("category.rei.smelting.fuel"));
-        
-        slots.add(inputSlot);
-        slots.add(outputSlot);
-        slots.add(fuelSlot);
-        return slots;
-    }
-    
-    @Override
-    public boolean canDisplay(VanillaSmokerRecipe recipe) {
-        return false;
-    }
-    
-    @Override
-    public void drawExtras() {
-    
-    }
-    
-    @Override
-    public void addWidget(List<Control> controls, int number) {
-        WidgetArrow wa = new WidgetArrow(75, 70 + number * 75, true, 10);
-        controls.add(wa);
-    }
-    
-    private List<ItemStack> getFuel() {
-        return SmokerBlockEntity.createBurnableMap().keySet().stream().map(Item::getDefaultStack).collect(Collectors.toList());
-    }
-    
-    @Override
-    public ItemStack getCategoryIcon() {
-        return new ItemStack(Blocks.SMOKER.getItem());
-    }
-    
-    @Override
-    public boolean canAutoCraftHere(Class<? extends Gui> guiClass, VanillaSmokerRecipe recipe) {
-        return guiClass.isAssignableFrom(SmokerGui.class);
-    }
-    
-    @Override
-    public boolean performAutoCraft(Gui gui, VanillaSmokerRecipe recipe) {
-        if (!gui.getClass().isAssignableFrom(SmokerGui.class))
-            return false;
-        ((IMixinRecipeBookGui) (((SmokerGui) gui).getRecipeBookGui())).getGhostSlots().reset();
-        MinecraftClient.getInstance().interactionManager.clickRecipe(MinecraftClient.getInstance().player.container.syncId, recipe.getRecipe(), Gui.isShiftPressed());
-        return false;
-    }
-    
-    @Override
-    public void registerAutoCraftButton(List<Control> control, RecipeGui recipeGui, Gui parentGui, VanillaSmokerRecipe recipe, int number) {
-        SmallButton button = new SmallButton(128, 75 + 6 + 26 + number * 75, 10, 10, "+", enabled -> {
-            if (!(parentGui instanceof SmokerGui))
-                return I18n.translate("text.auto_craft.wrong_gui");
-            return "";
-        });
-        button.setOnClick(mouse -> {
-            recipeGui.close();
-            MinecraftClient.getInstance().openGui(parentGui);
-            return canAutoCraftHere(parentGui.getClass(), recipe) && performAutoCraft(parentGui, recipe);
-        });
-        button.setEnabled(canAutoCraftHere(parentGui.getClass(), recipe));
-        control.add(button);
-    }
-    
-}

+ 0 - 55
src/main/java/me/shedaniel/plugin/smoker/VanillaSmokerRecipe.java

@@ -1,55 +0,0 @@
-package me.shedaniel.plugin.smoker;
-
-import me.shedaniel.api.IRecipe;
-import net.minecraft.block.entity.SmokerBlockEntity;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.recipe.Ingredient;
-import net.minecraft.recipe.smelting.SmokingRecipe;
-
-import java.util.*;
-import java.util.stream.Collectors;
-
-public class VanillaSmokerRecipe implements IRecipe<ItemStack> {
-    private final SmokingRecipe recipe;
-    
-    @Override
-    public String getId() {
-        return "smoker";
-    }
-    
-    public VanillaSmokerRecipe(SmokingRecipe recipe) {
-        this.recipe = recipe;
-    }
-    
-    @Override
-    public List<ItemStack> getOutput() {
-        List<ItemStack> output = new LinkedList<>();
-        output.add(recipe.getOutput().copy());
-        return output;
-    }
-    
-    @Override
-    public List<List<ItemStack>> getInput() {
-        List<List<ItemStack>> input = new LinkedList<>();
-        for(Ingredient ingredient : recipe.getPreviewInputs()) {
-            List<ItemStack> ingredients = Arrays.asList(ingredient.getStackArray());
-            input.add(ingredients);
-        }
-        input.add(SmokerBlockEntity.createBurnableMap().keySet().stream().map(Item::getDefaultStack).collect(Collectors.toList()));
-        return input;
-    }
-    
-    @Override
-    public List<List<ItemStack>> getRecipeRequiredInput() {
-        List<List<ItemStack>> input = new LinkedList<>();
-        for(Ingredient ingredient : recipe.getPreviewInputs())
-            Collections.addAll(input, new LinkedList<>(Arrays.asList(ingredient.getStackArray())));
-        return input;
-    }
-    
-    public SmokingRecipe getRecipe() {
-        return recipe;
-    }
-    
-}

+ 46 - 0
src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java

@@ -0,0 +1,46 @@
+package me.shedaniel.rei;
+
+import me.shedaniel.rei.listeners.ClientTick;
+import me.shedaniel.rei.listeners.IListener;
+import net.fabricmc.api.ClientModInitializer;
+import net.fabricmc.api.ModInitializer;
+import net.fabricmc.fabric.events.client.ClientTickEvent;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class RoughlyEnoughItemsCore implements ClientModInitializer {
+    
+    private static List<IListener> listeners = new ArrayList<>();
+    
+    @Override
+    public void onInitializeClient() {
+        registerFabricEvents();
+        registerREIListeners();
+    }
+    
+    private void registerREIListeners() {
+    
+    }
+    
+    private IListener registerListener(IListener listener) {
+        listeners.add(listener);
+        return listener;
+    }
+    
+    public static <T> List<T> getListeners(Class<T> listenerClass) {
+        return listeners.stream().filter(listener -> {
+            return listenerClass.isAssignableFrom(listener.getClass());
+        }).map(listener -> {
+            return listenerClass.cast(listener);
+        }).collect(Collectors.toList());
+    }
+    
+    private void registerFabricEvents() {
+        ClientTickEvent.CLIENT.register(minecraftClient -> {
+            getListeners(ClientTick.class).forEach(clientTick -> clientTick.onTick(minecraftClient));
+        });
+    }
+    
+}

+ 68 - 0
src/main/java/me/shedaniel/rei/gui/ContainerGuiOverlay.java

@@ -0,0 +1,68 @@
+package me.shedaniel.rei.gui;
+
+import me.shedaniel.rei.gui.widget.IWidget;
+import me.shedaniel.rei.gui.widget.LabelWidget;
+import me.shedaniel.rei.mixin.IMixinContainerGui;
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.gui.ContainerGui;
+import net.minecraft.client.gui.Gui;
+import net.minecraft.client.gui.widget.ButtonWidget;
+import net.minecraft.client.util.Window;
+
+import java.awt.*;
+import java.util.ArrayList;
+import java.util.List;
+
+public class ContainerGuiOverlay extends Gui {
+    
+    private Rectangle rectangle;
+    private IMixinContainerGui containerGui;
+    private Window window;
+    private int page;
+    private List<IWidget> widgets;
+    
+    public ContainerGuiOverlay(ContainerGui containerGui) {
+        this.containerGui = (IMixinContainerGui) containerGui;
+    }
+    
+    @Override
+    protected void onInitialized() {
+        //Update Variables
+        this.widgets = new ArrayList<>();
+        this.window = MinecraftClient.getInstance().window;
+        if (MinecraftClient.getInstance().currentGui instanceof ContainerGui)
+            this.containerGui = (IMixinContainerGui) MinecraftClient.getInstance().currentGui;
+        this.page = 0;
+        
+        rectangle = calculateBoundary();
+        addButton(new ButtonWidget(-1, rectangle.x, rectangle.y + 3, 16, 20, "<") {
+            @Override
+            public void onPressed(double double_1, double double_2) {
+                //Left Page
+            }
+        });
+        addButton(new ButtonWidget(-1, rectangle.x + rectangle.width - 18, rectangle.y + 3, 16, 20, ">") {
+            @Override
+            public void onPressed(double double_1, double double_2) {
+                //Right Page
+            }
+        });
+        widgets.add(new LabelWidget(rectangle.x + (rectangle.width / 2), rectangle.y + 10, String.format("%s/%s", page + 1, getTotalPage() + 1)));
+    }
+    
+    @Override
+    public void draw(int int_1, int int_2, float float_1) {
+        widgets.forEach(widget -> widget.draw(int_1, int_2, float_1));
+    }
+    
+    private Rectangle calculateBoundary() {
+        int startX = containerGui.getContainerLeft() + containerGui.getContainerWidth() + 10;
+        int width = window.getScaledWidth() - startX;
+        return new Rectangle(startX, 0, width, window.getScaledHeight());
+    }
+    
+    private int getTotalPage() {
+        return 10;
+    }
+    
+}

+ 9 - 0
src/main/java/me/shedaniel/rei/gui/widget/IWidget.java

@@ -0,0 +1,9 @@
+package me.shedaniel.rei.gui.widget;
+
+import net.minecraft.client.gui.GuiEventListener;
+
+public interface IWidget extends GuiEventListener {
+    
+    public void draw(int mouseX, int mouseY, float partialTicks);
+    
+}

+ 24 - 0
src/main/java/me/shedaniel/rei/gui/widget/LabelWidget.java

@@ -0,0 +1,24 @@
+package me.shedaniel.rei.gui.widget;
+
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.gui.Drawable;
+import net.minecraft.client.gui.GuiEventListener;
+
+public class LabelWidget extends Drawable implements IWidget {
+    
+    public int x;
+    public int y;
+    public String text;
+    
+    public LabelWidget(int x, int y, String text) {
+        this.x = x;
+        this.y = y;
+        this.text = text;
+    }
+    
+    @Override
+    public void draw(int mouseX, int mouseY, float partialTicks) {
+        drawStringCentered(MinecraftClient.getInstance().fontRenderer, text, x, y, -1);
+    }
+    
+}

+ 9 - 0
src/main/java/me/shedaniel/rei/listeners/ClientTick.java

@@ -0,0 +1,9 @@
+package me.shedaniel.rei.listeners;
+
+import net.minecraft.client.MinecraftClient;
+
+public interface ClientTick extends IListener {
+    
+    public void onTick(MinecraftClient minecraftClient);
+    
+}

+ 4 - 0
src/main/java/me/shedaniel/rei/listeners/IListener.java

@@ -0,0 +1,4 @@
+package me.shedaniel.rei.listeners;
+
+public interface IListener {
+}

+ 17 - 0
src/main/java/me/shedaniel/rei/mixin/IMixinContainerGui.java

@@ -0,0 +1,17 @@
+package me.shedaniel.rei.mixin;
+
+import me.shedaniel.rei.gui.ContainerGuiOverlay;
+
+public interface IMixinContainerGui {
+    
+    public int getContainerLeft();
+    
+    public int getContainerTop();
+    
+    public int getContainerWidth();
+    
+    public int getContainerHeight();
+    
+    public ContainerGuiOverlay getOverlay();
+    
+}

+ 67 - 0
src/main/java/me/shedaniel/rei/mixin/MixinContainerGui.java

@@ -0,0 +1,67 @@
+package me.shedaniel.rei.mixin;
+
+import me.shedaniel.rei.gui.ContainerGuiOverlay;
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.gui.ContainerGui;
+import net.minecraft.client.gui.Gui;
+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.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+
+@Mixin(ContainerGui.class)
+public class MixinContainerGui extends Gui implements IMixinContainerGui {
+    
+    private ContainerGuiOverlay overlay;
+    
+    @Shadow
+    protected int left;
+    
+    @Shadow
+    protected int top;
+    
+    @Shadow
+    protected int containerWidth;
+    
+    @Shadow
+    protected int containerHeight;
+    
+    @Override
+    public int getContainerLeft() {
+        return left;
+    }
+    
+    @Override
+    public int getContainerTop() {
+        return top;
+    }
+    
+    @Override
+    public int getContainerWidth() {
+        return containerWidth;
+    }
+    
+    @Override
+    public int getContainerHeight() {
+        return containerHeight;
+    }
+    
+    @Override
+    public ContainerGuiOverlay getOverlay() {
+        if (overlay == null)
+            overlay = new ContainerGuiOverlay((ContainerGui) MinecraftClient.getInstance().currentGui);
+        return overlay;
+    }
+    
+    @Inject(method = "onInitialized()V", at = @At("RETURN"))
+    protected void onInitialized(CallbackInfo info) {
+        this.listeners.add(getOverlay());
+    }
+    
+    @Inject(method = "draw(IIF)V", at = @At("RETURN"))
+    public void draw(int int_1, int int_2, float float_1, CallbackInfo info) {
+        getOverlay().draw(int_1, int_2, float_1);
+    }
+    
+}

+ 1 - 1
src/main/resources/fabric.mod.json

@@ -8,7 +8,7 @@
     "Danielshe"
   ],
   "initializers": [
-    "me.shedaniel.Core"
+    "me.shedaniel.rei.RoughlyEnoughItemsCore"
   ],
   "requires": {
     "fabric": "*"

+ 2 - 9
src/main/resources/roughlyenoughitems.client.json

@@ -1,16 +1,9 @@
 {
   "required": true,
-  "package": "me.shedaniel.mixins",
+  "package": "me.shedaniel.rei.mixin",
   "compatibilityLevel": "JAVA_8",
   "mixins": [
-    "MixinDoneLoading",
-    "MixinBrewingRecipeRegistry",
-    "MixinContainerGui",
-    "MixinMinecraftResize",
-    "MixinKeyboardListener",
-    "MixinRecipeManager",
-    "MixinCreativePlayerInventoryGui",
-    "MixinRecipeBookGui"
+    "MixinContainerGui"
   ],
   "injectors": {
     "defaultRequire": 1