From 1b21d26487636e50d03979acd5ca4a2a07761a25 Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 9 Jan 2019 23:35:45 +0800 Subject: Starting off rewrite --- .../java/me/shedaniel/plugin/RandomRecipe.java | 40 ----- .../me/shedaniel/plugin/TestRandomCategory.java | 70 -------- .../java/me/shedaniel/plugin/VanillaPlugin.java | 105 ------------ .../blastfurnace/VanillaBlastFurnaceCategory.java | 126 -------------- .../blastfurnace/VanillaBlastFurnaceRecipe.java | 58 ------- .../plugin/crafting/VanillaCraftingCategory.java | 157 ----------------- .../plugin/crafting/VanillaCraftingRecipe.java | 28 --- .../crafting/VanillaShapedCraftingRecipe.java | 59 ------- .../crafting/VanillaShapelessCraftingRecipe.java | 61 ------- .../plugin/furnace/VanillaFurnaceCategory.java | 126 -------------- .../plugin/furnace/VanillaFurnaceRecipe.java | 60 ------- .../plugin/potion/VanillaPotionCategory.java | 189 --------------------- .../plugin/potion/VanillaPotionRecipe.java | 56 ------ .../plugin/smoker/VanillaSmokerCategory.java | 126 -------------- .../plugin/smoker/VanillaSmokerRecipe.java | 55 ------ 15 files changed, 1316 deletions(-) delete mode 100644 src/main/java/me/shedaniel/plugin/RandomRecipe.java delete mode 100644 src/main/java/me/shedaniel/plugin/TestRandomCategory.java delete mode 100755 src/main/java/me/shedaniel/plugin/VanillaPlugin.java delete mode 100755 src/main/java/me/shedaniel/plugin/blastfurnace/VanillaBlastFurnaceCategory.java delete mode 100755 src/main/java/me/shedaniel/plugin/blastfurnace/VanillaBlastFurnaceRecipe.java delete mode 100755 src/main/java/me/shedaniel/plugin/crafting/VanillaCraftingCategory.java delete mode 100755 src/main/java/me/shedaniel/plugin/crafting/VanillaCraftingRecipe.java delete mode 100755 src/main/java/me/shedaniel/plugin/crafting/VanillaShapedCraftingRecipe.java delete mode 100755 src/main/java/me/shedaniel/plugin/crafting/VanillaShapelessCraftingRecipe.java delete mode 100755 src/main/java/me/shedaniel/plugin/furnace/VanillaFurnaceCategory.java delete mode 100755 src/main/java/me/shedaniel/plugin/furnace/VanillaFurnaceRecipe.java delete mode 100644 src/main/java/me/shedaniel/plugin/potion/VanillaPotionCategory.java delete mode 100755 src/main/java/me/shedaniel/plugin/potion/VanillaPotionRecipe.java delete mode 100755 src/main/java/me/shedaniel/plugin/smoker/VanillaSmokerCategory.java delete mode 100755 src/main/java/me/shedaniel/plugin/smoker/VanillaSmokerRecipe.java (limited to 'src/main/java/me/shedaniel/plugin') 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 { - - private String id; - - public RandomRecipe(String id) { - this.id = id; - } - - @Override - public String getId() { - return id; - } - - @Override - public List getOutput() { - return new LinkedList<>(Arrays.asList(new ItemStack[]{new ItemStack(Blocks.BEETROOTS.getItem())})); - } - - @Override - public List> getInput() { - return new LinkedList<>(Arrays.asList(new LinkedList<>(Arrays.asList(new ItemStack[]{new ItemStack(Blocks.OAK_LOG.getItem())})))); - } - - @Override - public List> 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 { - - private String id; - private List 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 setupDisplay(int number) { - return new LinkedList<>(); - } - - @Override - public boolean canDisplay(RandomRecipe recipe) { - return false; - } - - @Override - public void drawExtras() { - - } - - @Override - public void addWidget(List 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 potionRecipes = new LinkedList<>(); - private List recipes = new LinkedList<>(); - private List furnaceRecipes = new LinkedList<>(); - private List smokerRecipes = new LinkedList<>(); - private List 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 { - private List 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 setupDisplay(int number) { - List 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 controls, int number) { - WidgetArrow wa = new WidgetArrow(75, 70 + number * 75, true, 10); - controls.add(wa); - } - - private List 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 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, 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 { - private final BlastingRecipe recipe; - - @Override - public String getId() { - return "blastingfurnace"; - } - - public VanillaBlastFurnaceRecipe(BlastingRecipe recipe) { - this.recipe = recipe; - } - - @Override - public List getOutput() { - List output = new LinkedList<>(); - output.add(recipe.getOutput().copy()); - return output; - } - - @Override - public List> getInput() { - List> input = new LinkedList<>(); - for(Ingredient ingredient : recipe.getPreviewInputs()) { - List 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> getRecipeRequiredInput() { - List> 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 { - Window mainWindow = MinecraftClient.getInstance().window; - private List 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 setupDisplay(int number) { - List slots = new LinkedList<>(); - int count = 0; - List> 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 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 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, 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 { - - public int getWidth() { - return 2; - } - - public int getHeight() { - return 2; - } - - public abstract Recipe getRecipe(); - - @Override - public List> 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 getOutput() { - List output = new LinkedList<>(); - output.add(recipe.getOutput()); - return output; - } - - @Override - public List> getInput() { - List> input = new LinkedList<>(); - int count = 0; - for(Ingredient ingredient : recipe.getPreviewInputs()) { - List 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 getOutput() { - List output = new LinkedList<>(); - output.add(recipe.getOutput()); - return output; - } - - @Override - public List> getInput() { - List> input = new LinkedList<>(); - for(Ingredient ingredient : recipe.getPreviewInputs()) { - List 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 { - private List 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 setupDisplay(int number) { - List 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 controls, int number) { - WidgetArrow wa = new WidgetArrow(75, 70 + number * 75, true); - controls.add(wa); - } - - private List 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 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, 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); - } - -} diff --git a/src/main/java/me/shedaniel/plugin/furnace/VanillaFurnaceRecipe.java b/src/main/java/me/shedaniel/plugin/furnace/VanillaFurnaceRecipe.java deleted file mode 100755 index 77e8d20b5..000000000 --- a/src/main/java/me/shedaniel/plugin/furnace/VanillaFurnaceRecipe.java +++ /dev/null @@ -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 { - - private final SmeltingRecipe recipe; - - @Override - public String getId() { - return "furnace"; - } - - public VanillaFurnaceRecipe(SmeltingRecipe recipe) { - this.recipe = recipe; - } - - @Override - public List getOutput() { - List output = new LinkedList<>(); - output.add(recipe.getOutput().copy()); - return output; - } - - @Override - public List> getInput() { - List> input = new LinkedList<>(); - for(Ingredient ingredient : recipe.getPreviewInputs()) { - List 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> getRecipeRequiredInput() { - List> input = new LinkedList<>(); - for(Ingredient ingredient : recipe.getPreviewInputs()) - Collections.addAll(input, new LinkedList<>(Arrays.asList(ingredient.getStackArray()))); - return input; - } - - public Recipe getRecipe() { - return recipe; - } - -} diff --git a/src/main/java/me/shedaniel/plugin/potion/VanillaPotionCategory.java b/src/main/java/me/shedaniel/plugin/potion/VanillaPotionCategory.java deleted file mode 100644 index d4fb6a917..000000000 --- a/src/main/java/me/shedaniel/plugin/potion/VanillaPotionCategory.java +++ /dev/null @@ -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 { - private List 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 setupDisplay(int number) { - List 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 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 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; - } -} diff --git a/src/main/java/me/shedaniel/plugin/potion/VanillaPotionRecipe.java b/src/main/java/me/shedaniel/plugin/potion/VanillaPotionRecipe.java deleted file mode 100755 index eb482d8d3..000000000 --- a/src/main/java/me/shedaniel/plugin/potion/VanillaPotionRecipe.java +++ /dev/null @@ -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 { - - 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 getOutput() { - return Arrays.asList(output); - } - - @Override - public List> getInput() { - List> input = new LinkedList<>(); - input.add(new ArrayList<>(Arrays.asList(this.input))); - input.add(new ArrayList<>(Arrays.asList(this.reactWith))); - return input; - } - - @Override - public List> getRecipeRequiredInput() { - List> input = new LinkedList<>(); - input.add(new ArrayList<>(Arrays.asList(this.input))); - input.add(new ArrayList<>(Arrays.asList(this.reactWith))); - return input; - } - - public List getOutput(int slot) { - List 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; - } -} diff --git a/src/main/java/me/shedaniel/plugin/smoker/VanillaSmokerCategory.java b/src/main/java/me/shedaniel/plugin/smoker/VanillaSmokerCategory.java deleted file mode 100755 index e8e627fb1..000000000 --- a/src/main/java/me/shedaniel/plugin/smoker/VanillaSmokerCategory.java +++ /dev/null @@ -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 { - private List 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 setupDisplay(int number) { - List 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 controls, int number) { - WidgetArrow wa = new WidgetArrow(75, 70 + number * 75, true, 10); - controls.add(wa); - } - - private List 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 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, 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); - } - -} diff --git a/src/main/java/me/shedaniel/plugin/smoker/VanillaSmokerRecipe.java b/src/main/java/me/shedaniel/plugin/smoker/VanillaSmokerRecipe.java deleted file mode 100755 index 2a640178b..000000000 --- a/src/main/java/me/shedaniel/plugin/smoker/VanillaSmokerRecipe.java +++ /dev/null @@ -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 { - private final SmokingRecipe recipe; - - @Override - public String getId() { - return "smoker"; - } - - public VanillaSmokerRecipe(SmokingRecipe recipe) { - this.recipe = recipe; - } - - @Override - public List getOutput() { - List output = new LinkedList<>(); - output.add(recipe.getOutput().copy()); - return output; - } - - @Override - public List> getInput() { - List> input = new LinkedList<>(); - for(Ingredient ingredient : recipe.getPreviewInputs()) { - List 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> getRecipeRequiredInput() { - List> input = new LinkedList<>(); - for(Ingredient ingredient : recipe.getPreviewInputs()) - Collections.addAll(input, new LinkedList<>(Arrays.asList(ingredient.getStackArray()))); - return input; - } - - public SmokingRecipe getRecipe() { - return recipe; - } - -} -- cgit