aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rwxr-xr-xsrc/main/java/me/shedaniel/Core.java4
-rw-r--r--src/main/java/me/shedaniel/gui/widget/SmallButton.java17
-rwxr-xr-xsrc/main/java/me/shedaniel/impl/REIRecipeManager.java2
-rwxr-xr-xsrc/main/java/me/shedaniel/mixins/MixinDoneLoading.java2
-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
-rwxr-xr-xsrc/main/resources/assets/roughlyenoughitems/lang/en_us.json4
-rw-r--r--src/main/resources/assets/roughlyenoughitems/lang/zh_cn.json11
-rw-r--r--src/main/resources/assets/roughlyenoughitems/lang/zh_tw.json11
11 files changed, 64 insertions, 20 deletions
diff --git a/src/main/java/me/shedaniel/Core.java b/src/main/java/me/shedaniel/Core.java
index f8dd78e71..498b0a43b 100755
--- a/src/main/java/me/shedaniel/Core.java
+++ b/src/main/java/me/shedaniel/Core.java
@@ -91,7 +91,7 @@ public class Core implements ClientModInitializer {
failed = true;
}
if (failed || config == null) {
- Core.LOGGER.error("Failed to load config! Overwriting with default config.");
+ Core.LOGGER.error("REI: Failed to load config! Overwriting with default config.");
config = new REIConfig();
}
saveConfig();
@@ -100,7 +100,7 @@ public class Core implements ClientModInitializer {
public static void saveConfig() throws IOException {
configFile.getParentFile().mkdirs();
if (!configFile.exists() && !configFile.createNewFile()) {
- Core.LOGGER.error("Failed to save config! Overwriting with default config.");
+ Core.LOGGER.error("REI: Failed to save config! Overwriting with default config.");
config = new REIConfig();
return;
}
diff --git a/src/main/java/me/shedaniel/gui/widget/SmallButton.java b/src/main/java/me/shedaniel/gui/widget/SmallButton.java
index 5eff8d206..2e6a7ad1b 100644
--- a/src/main/java/me/shedaniel/gui/widget/SmallButton.java
+++ b/src/main/java/me/shedaniel/gui/widget/SmallButton.java
@@ -5,31 +5,37 @@ 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) {
+ 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) {
+ 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();
@@ -56,6 +62,11 @@ public class SmallButton extends Control {
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();
+ if (isHighlighted()) {
+ List<String> toolTip = Arrays.asList(toolTipSupplier.apply(isEnabled()).split("\n"));
+ if (toolTip != null && toolTip.size() != 0)
+ gui.drawTooltip(toolTip, REIRenderHelper.getMouseLoc().x, REIRenderHelper.getMouseLoc().y);
+ }
}
}
diff --git a/src/main/java/me/shedaniel/impl/REIRecipeManager.java b/src/main/java/me/shedaniel/impl/REIRecipeManager.java
index 937e1cf6f..657187da8 100755
--- a/src/main/java/me/shedaniel/impl/REIRecipeManager.java
+++ b/src/main/java/me/shedaniel/impl/REIRecipeManager.java
@@ -40,7 +40,7 @@ public class REIRecipeManager implements IRecipeManager {
public static REIRecipeManager instance() {
if (myInstance == null) {
- Core.LOGGER.info("Newing me up.");
+ Core.LOGGER.info("REI: Newing me up.");
myInstance = new REIRecipeManager();
}
return myInstance;
diff --git a/src/main/java/me/shedaniel/mixins/MixinDoneLoading.java b/src/main/java/me/shedaniel/mixins/MixinDoneLoading.java
index 6d21e0d95..18d67479d 100755
--- a/src/main/java/me/shedaniel/mixins/MixinDoneLoading.java
+++ b/src/main/java/me/shedaniel/mixins/MixinDoneLoading.java
@@ -15,7 +15,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
public class MixinDoneLoading {
@Inject(method = "initialize", at = @At("RETURN"))
private static void onBootstrapRegister(CallbackInfo ci) {
- Core.LOGGER.info("Done Loading");
+ Core.LOGGER.info("REI: Done Loading");
Core.getListeners(DoneLoading.class).forEach(DoneLoading::onDoneLoading);
}
}
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);
diff --git a/src/main/resources/assets/roughlyenoughitems/lang/en_us.json b/src/main/resources/assets/roughlyenoughitems/lang/en_us.json
index 2b7cce4e9..2b034fdaf 100755
--- a/src/main/resources/assets/roughlyenoughitems/lang/en_us.json
+++ b/src/main/resources/assets/roughlyenoughitems/lang/en_us.json
@@ -27,5 +27,7 @@
"ordering.rei.descending": "Descending",
"ordering.rei.registry": "Registry",
"ordering.rei.name": "Name",
- "ordering.rei.item_groups": "Item Groups"
+ "ordering.rei.item_groups": "Item Groups",
+ "text.auto_craft.wrong_gui": "§cCan't auto craft in this inventory!",
+ "text.auto_craft.crafting.too_small": "§cThis inventory is too small!"
} \ No newline at end of file
diff --git a/src/main/resources/assets/roughlyenoughitems/lang/zh_cn.json b/src/main/resources/assets/roughlyenoughitems/lang/zh_cn.json
index 8952425f4..cec24b748 100644
--- a/src/main/resources/assets/roughlyenoughitems/lang/zh_cn.json
+++ b/src/main/resources/assets/roughlyenoughitems/lang/zh_cn.json
@@ -18,5 +18,14 @@
"text.rei.config": "设置",
"text.rei.listeningkey": "正聆听按键",
"text.rei.centre_searchbox": "置中搜索栏: %s%b",
- "text.rei.centre_searchbox.tooltip": "更改此设置后请重启游戏以完成更改"
+ "text.rei.centre_searchbox.tooltip": "更改此设置后请重启游戏以完成更改",
+ "text.rei.list_ordering": "物品清单排序",
+ "text.rei.list_ordering_button": "%s [%s]",
+ "ordering.rei.ascending": "顺序",
+ "ordering.rei.descending": "倒序",
+ "ordering.rei.registry": "注册",
+ "ordering.rei.name": "名字",
+ "ordering.rei.item_groups": "物品分类",
+ "text.auto_craft.wrong_gui": "§c不能在此菜单中自动合成!",
+ "text.auto_craft.crafting.too_small": "§c合成格太小!"
} \ No newline at end of file
diff --git a/src/main/resources/assets/roughlyenoughitems/lang/zh_tw.json b/src/main/resources/assets/roughlyenoughitems/lang/zh_tw.json
index bea1f7bae..5ef5d634a 100644
--- a/src/main/resources/assets/roughlyenoughitems/lang/zh_tw.json
+++ b/src/main/resources/assets/roughlyenoughitems/lang/zh_tw.json
@@ -18,5 +18,14 @@
"text.rei.config": "設置",
"text.rei.listeningkey": "正聆聽按鍵",
"text.rei.centre_searchbox": "置中搜索欄: %s%b",
- "text.rei.centre_searchbox.tooltip": "更改此設置後請重啟遊戲以完成更改"
+ "text.rei.centre_searchbox.tooltip": "更改此設置後請重啟遊戲以完成更改",
+ "text.rei.list_ordering": "物品清單排序",
+ "text.rei.list_ordering_button": "%s [%s]",
+ "ordering.rei.ascending": "順序",
+ "ordering.rei.descending": "倒序",
+ "ordering.rei.registry": "註冊",
+ "ordering.rei.name": "名字",
+ "ordering.rei.item_groups": "物品分類",
+ "text.auto_craft.wrong_gui": "§c不能在此菜單中自動合成!",
+ "text.auto_craft.crafting.too_small": "§c合成格太小!"
} \ No newline at end of file