aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/plugin
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/me/shedaniel/plugin')
-rwxr-xr-xsrc/main/java/me/shedaniel/plugin/blastfurnace/VanillaBlastFurnaceCategory.java10
-rwxr-xr-xsrc/main/java/me/shedaniel/plugin/crafting/VanillaCraftingCategory.java8
-rwxr-xr-xsrc/main/java/me/shedaniel/plugin/furnace/VanillaFurnaceCategory.java7
-rwxr-xr-xsrc/main/java/me/shedaniel/plugin/smoker/VanillaSmokerCategory.java8
4 files changed, 23 insertions, 10 deletions
diff --git a/src/main/java/me/shedaniel/plugin/blastfurnace/VanillaBlastFurnaceCategory.java b/src/main/java/me/shedaniel/plugin/blastfurnace/VanillaBlastFurnaceCategory.java
index 48a977eb3..1721fac05 100755
--- a/src/main/java/me/shedaniel/plugin/blastfurnace/VanillaBlastFurnaceCategory.java
+++ b/src/main/java/me/shedaniel/plugin/blastfurnace/VanillaBlastFurnaceCategory.java
@@ -1,21 +1,17 @@
package me.shedaniel.plugin.blastfurnace;
import me.shedaniel.api.DisplayCategoryCraftable;
-import me.shedaniel.api.IDisplayCategory;
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 me.shedaniel.plugin.smoker.VanillaSmokerRecipe;
import net.minecraft.block.Blocks;
import net.minecraft.block.entity.BlastFurnaceBlockEntity;
-import net.minecraft.block.entity.SmokerBlockEntity;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.container.BlastFurnaceGui;
-import net.minecraft.client.gui.container.SmokerGui;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -113,7 +109,11 @@ public class VanillaBlastFurnaceCategory implements DisplayCategoryCraftable<Van
@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, "+");
+ 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);
diff --git a/src/main/java/me/shedaniel/plugin/crafting/VanillaCraftingCategory.java b/src/main/java/me/shedaniel/plugin/crafting/VanillaCraftingCategory.java
index 50fa4ad1e..6b858f456 100755
--- a/src/main/java/me/shedaniel/plugin/crafting/VanillaCraftingCategory.java
+++ b/src/main/java/me/shedaniel/plugin/crafting/VanillaCraftingCategory.java
@@ -139,7 +139,13 @@ public class VanillaCraftingCategory implements DisplayCategoryCraftable<Vanilla
@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, "+");
+ 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);
diff --git a/src/main/java/me/shedaniel/plugin/furnace/VanillaFurnaceCategory.java b/src/main/java/me/shedaniel/plugin/furnace/VanillaFurnaceCategory.java
index 0603bb444..67b73076c 100755
--- a/src/main/java/me/shedaniel/plugin/furnace/VanillaFurnaceCategory.java
+++ b/src/main/java/me/shedaniel/plugin/furnace/VanillaFurnaceCategory.java
@@ -11,6 +11,7 @@ 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.BlastFurnaceGui;
import net.minecraft.client.gui.container.FurnaceGui;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.item.Item;
@@ -109,7 +110,11 @@ public class VanillaFurnaceCategory implements DisplayCategoryCraftable<VanillaF
@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, "+");
+ 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);
diff --git a/src/main/java/me/shedaniel/plugin/smoker/VanillaSmokerCategory.java b/src/main/java/me/shedaniel/plugin/smoker/VanillaSmokerCategory.java
index 862d5ba35..37bd413f4 100755
--- a/src/main/java/me/shedaniel/plugin/smoker/VanillaSmokerCategory.java
+++ b/src/main/java/me/shedaniel/plugin/smoker/VanillaSmokerCategory.java
@@ -1,7 +1,6 @@
package me.shedaniel.plugin.smoker;
import me.shedaniel.api.DisplayCategoryCraftable;
-import me.shedaniel.api.IDisplayCategory;
import me.shedaniel.gui.RecipeGui;
import me.shedaniel.gui.widget.Control;
import me.shedaniel.gui.widget.REISlot;
@@ -12,7 +11,6 @@ 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.FurnaceGui;
import net.minecraft.client.gui.container.SmokerGui;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.item.Item;
@@ -111,7 +109,11 @@ public class VanillaSmokerCategory implements DisplayCategoryCraftable<VanillaSm
@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, "+");
+ 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);