aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/plugin
diff options
context:
space:
mode:
authorUnknown <shekwancheung0528@gmail.com>2019-01-09 23:35:45 +0800
committerUnknown <shekwancheung0528@gmail.com>2019-01-09 23:35:45 +0800
commit1b21d26487636e50d03979acd5ca4a2a07761a25 (patch)
treed7d066b4e7491474f3a962593e97a2d6f0aa2ea2 /src/main/java/me/shedaniel/plugin
parent77af6b3f548d34bfdafc585847d3d80ec783c7e7 (diff)
downloadRoughlyEnoughItems-1b21d26487636e50d03979acd5ca4a2a07761a25.tar.gz
RoughlyEnoughItems-1b21d26487636e50d03979acd5ca4a2a07761a25.tar.bz2
RoughlyEnoughItems-1b21d26487636e50d03979acd5ca4a2a07761a25.zip
Starting off rewrite
Diffstat (limited to 'src/main/java/me/shedaniel/plugin')
-rw-r--r--src/main/java/me/shedaniel/plugin/RandomRecipe.java40
-rw-r--r--src/main/java/me/shedaniel/plugin/TestRandomCategory.java70
-rwxr-xr-xsrc/main/java/me/shedaniel/plugin/VanillaPlugin.java105
-rwxr-xr-xsrc/main/java/me/shedaniel/plugin/blastfurnace/VanillaBlastFurnaceCategory.java126
-rwxr-xr-xsrc/main/java/me/shedaniel/plugin/blastfurnace/VanillaBlastFurnaceRecipe.java58
-rwxr-xr-xsrc/main/java/me/shedaniel/plugin/crafting/VanillaCraftingCategory.java157
-rwxr-xr-xsrc/main/java/me/shedaniel/plugin/crafting/VanillaCraftingRecipe.java28
-rwxr-xr-xsrc/main/java/me/shedaniel/plugin/crafting/VanillaShapedCraftingRecipe.java59
-rwxr-xr-xsrc/main/java/me/shedaniel/plugin/crafting/VanillaShapelessCraftingRecipe.java61
-rwxr-xr-xsrc/main/java/me/shedaniel/plugin/furnace/VanillaFurnaceCategory.java126
-rwxr-xr-xsrc/main/java/me/shedaniel/plugin/furnace/VanillaFurnaceRecipe.java60
-rw-r--r--src/main/java/me/shedaniel/plugin/potion/VanillaPotionCategory.java189
-rwxr-xr-xsrc/main/java/me/shedaniel/plugin/potion/VanillaPotionRecipe.java56
-rwxr-xr-xsrc/main/java/me/shedaniel/plugin/smoker/VanillaSmokerCategory.java126
-rwxr-xr-xsrc/main/java/me/shedaniel/plugin/smoker/VanillaSmokerRecipe.java55
15 files changed, 0 insertions, 1316 deletions
diff --git a/src/main/java/me/shedaniel/plugin/RandomRecipe.java b/src/main/java/me/shedaniel/plugin/RandomRecipe.java
deleted file mode 100644
index 382f3a726..000000000
--- a/src/main/java/me/shedaniel/plugin/RandomRecipe.java
+++ /dev/null
@@ -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<>();
- }
-
-} \ No newline at end of file
diff --git a/src/main/java/me/shedaniel/plugin/TestRandomCategory.java b/src/main/java/me/shedaniel/plugin/TestRandomCategory.java
deleted file mode 100644
index 0824e7acc..000000000
--- a/src/main/java/me/shedaniel/plugin/TestRandomCategory.java
+++ /dev/null
@@ -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;
- }
-
-} \ No newline at end of file
diff --git a/src/main/java/me/shedaniel/plugin/VanillaPlugin.java b/src/main/java/me/shedaniel/plugin/VanillaPlugin.java
deleted file mode 100755
index a9cebf134..000000000
--- a/src/main/java/me/shedaniel/plugin/VanillaPlugin.java
+++ /dev/null
@@ -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)}));
- }
-}
diff --git a/src/main/java/me/shedaniel/plugin/blastfurnace/VanillaBlastFurnaceCategory.java b/src/main/java/me/shedaniel/plugin/blastfurnace/VanillaBlastFurnaceCategory.java
deleted file mode 100755
index 7b6ad557e..000000000
--- a/src/main/java/me/shedaniel/plugin/blastfurnace/VanillaBlastFurnaceCategory.java
+++ /dev/null
@@ -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);
- }
-
-}
diff --git a/src/main/java/me/shedaniel/plugin/blastfurnace/VanillaBlastFurnaceRecipe.java b/src/main/java/me/shedaniel/plugin/blastfurnace/VanillaBlastFurnaceRecipe.java
deleted file mode 100755
index 3ef8fbeff..000000000
--- a/src/main/java/me/shedaniel/plugin/blastfurnace/VanillaBlastFurnaceRecipe.java
+++ /dev/null
@@ -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;
- }
-
-}
diff --git a/src/main/java/me/shedaniel/plugin/crafting/VanillaCraftingCategory.java b/src/main/java/me/shedaniel/plugin/crafting/VanillaCraftingCategory.java
deleted file mode 100755
index 66b78ed98..000000000
--- a/src/main/java/me/shedaniel/plugin/crafting/VanillaCraftingCategory.java
+++ /dev/null
@@ -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);
- }
-
-}
diff --git a/src/main/java/me/shedaniel/plugin/crafting/VanillaCraftingRecipe.java b/src/main/java/me/shedaniel/plugin/crafting/VanillaCraftingRecipe.java
deleted file mode 100755
index 1f05c80c0..000000000
--- a/src/main/java/me/shedaniel/plugin/crafting/VanillaCraftingRecipe.java
+++ /dev/null
@@ -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();
- }
-
-}
diff --git a/src/main/java/me/shedaniel/plugin/crafting/VanillaShapedCraftingRecipe.java b/src/main/java/me/shedaniel/plugin/crafting/VanillaShapedCraftingRecipe.java
deleted file mode 100755
index 81bc101a0..000000000
--- a/src/main/java/me/shedaniel/plugin/crafting/VanillaShapedCraftingRecipe.java
+++ /dev/null
@@ -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;
- }
-}
diff --git a/src/main/java/me/shedaniel/plugin/crafting/VanillaShapelessCraftingRecipe.java b/src/main/java/me/shedaniel/plugin/crafting/VanillaShapelessCraftingRecipe.java
deleted file mode 100755
index dfb8d042b..000000000
--- a/src/main/java/me/shedaniel/plugin/crafting/VanillaShapelessCraftingRecipe.java
+++ /dev/null
@@ -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;
- }
-}
diff --git a/src/main/java/me/shedaniel/plugin/furnace/VanillaFurnaceCategory.java b/src/main/java/me/shedaniel/plugin/furnace/VanillaFurnaceCategory.java
deleted file mode 100755
index e1c513bbf..000000000
--- a/src/main/java/me/shedaniel/plugin/furnace/VanillaFurnaceCategory.java
+++ /dev/null
@@ -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