aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/rei/client
diff options
context:
space:
mode:
authorUnknown <shekwancheung0528@gmail.com>2019-05-08 00:55:25 +0800
committerUnknown <shekwancheung0528@gmail.com>2019-05-08 00:55:25 +0800
commita5c90bb7d4748ba2da024ce468ffeeda99bf4a0f (patch)
tree4bcc51bdcee2dbc521d2bf74f0f913ec04485f67 /src/main/java/me/shedaniel/rei/client
parent5357ec90f80768b69b197161e877e3ef884650a4 (diff)
downloadRoughlyEnoughItems-a5c90bb7d4748ba2da024ce468ffeeda99bf4a0f.tar.gz
RoughlyEnoughItems-a5c90bb7d4748ba2da024ce468ffeeda99bf4a0f.tar.bz2
RoughlyEnoughItems-a5c90bb7d4748ba2da024ce468ffeeda99bf4a0f.zip
start of 2.9 update beta
Diffstat (limited to 'src/main/java/me/shedaniel/rei/client')
-rw-r--r--src/main/java/me/shedaniel/rei/client/ClientHelperImpl.java24
-rw-r--r--src/main/java/me/shedaniel/rei/client/ConfigObject.java2
-rw-r--r--src/main/java/me/shedaniel/rei/client/RecipeScreenType.java16
3 files changed, 39 insertions, 3 deletions
diff --git a/src/main/java/me/shedaniel/rei/client/ClientHelperImpl.java b/src/main/java/me/shedaniel/rei/client/ClientHelperImpl.java
index febe35b4e..5a05f0e74 100644
--- a/src/main/java/me/shedaniel/rei/client/ClientHelperImpl.java
+++ b/src/main/java/me/shedaniel/rei/client/ClientHelperImpl.java
@@ -10,6 +10,7 @@ import me.shedaniel.rei.api.RecipeCategory;
import me.shedaniel.rei.api.RecipeDisplay;
import me.shedaniel.rei.api.RecipeHelper;
import me.shedaniel.rei.gui.RecipeViewingScreen;
+import me.shedaniel.rei.gui.VillagerRecipeViewingScreen;
import net.fabricmc.fabric.api.client.keybinding.FabricKeyBinding;
import net.fabricmc.fabric.api.network.ClientSidePacketRegistry;
import net.fabricmc.fabric.impl.client.keybinding.KeyBindingRegistryImpl;
@@ -54,6 +55,14 @@ public class ClientHelperImpl implements ClientHelper {
}
@Override
+ public String getFormattedModFromIdentifier(Identifier identifier) {
+ String mod = getModFromIdentifier(identifier);
+ if (mod.equalsIgnoreCase(""))
+ return "";
+ return "§9§o" + mod;
+ }
+
+ @Override
public FabricKeyBinding getRecipeKeyBinding() {
return recipe;
}
@@ -78,12 +87,14 @@ public class ClientHelperImpl implements ClientHelper {
return nextPage;
}
+ @Override
public String getModFromItem(Item item) {
if (item.equals(Items.AIR))
return "";
return getModFromIdentifier(Registry.ITEM.getId(item));
}
+ @Override
public String getModFromIdentifier(Identifier identifier) {
if (identifier == null)
return "";
@@ -147,7 +158,7 @@ public class ClientHelperImpl implements ClientHelper {
public boolean executeRecipeKeyBind(ItemStack stack) {
Map<RecipeCategory, List<RecipeDisplay>> map = RecipeHelper.getInstance().getRecipesFor(stack);
if (map.keySet().size() > 0)
- MinecraftClient.getInstance().openScreen(new RecipeViewingScreen(MinecraftClient.getInstance().window, map));
+ openRecipeViewingScreen(map);
return map.keySet().size() > 0;
}
@@ -155,7 +166,7 @@ public class ClientHelperImpl implements ClientHelper {
public boolean executeUsageKeyBind(ItemStack stack) {
Map<RecipeCategory, List<RecipeDisplay>> map = RecipeHelper.getInstance().getUsagesFor(stack);
if (map.keySet().size() > 0)
- MinecraftClient.getInstance().openScreen(new RecipeViewingScreen(MinecraftClient.getInstance().window, map));
+ openRecipeViewingScreen(map);
return map.keySet().size() > 0;
}
@@ -174,10 +185,17 @@ public class ClientHelperImpl implements ClientHelper {
public boolean executeViewAllRecipesKeyBind() {
Map<RecipeCategory, List<RecipeDisplay>> map = RecipeHelper.getInstance().getAllRecipes();
if (map.keySet().size() > 0)
- MinecraftClient.getInstance().openScreen(new RecipeViewingScreen(MinecraftClient.getInstance().window, map));
+ openRecipeViewingScreen(map);
return map.keySet().size() > 0;
}
+ public void openRecipeViewingScreen(Map<RecipeCategory, List<RecipeDisplay>> map) {
+ if (RoughlyEnoughItemsCore.getConfigManager().getConfig().screenType == RecipeScreenType.VILLAGER)
+ MinecraftClient.getInstance().openScreen(new VillagerRecipeViewingScreen(map));
+ else
+ MinecraftClient.getInstance().openScreen(new RecipeViewingScreen(map));
+ }
+
@Override
public void onInitializeClient() {
ClientHelperImpl.instance = (ClientHelperImpl) this;
diff --git a/src/main/java/me/shedaniel/rei/client/ConfigObject.java b/src/main/java/me/shedaniel/rei/client/ConfigObject.java
index af100f3fc..3522b6f3b 100644
--- a/src/main/java/me/shedaniel/rei/client/ConfigObject.java
+++ b/src/main/java/me/shedaniel/rei/client/ConfigObject.java
@@ -48,6 +48,8 @@ public class ConfigObject {
public boolean lightGrayRecipeBorder = false;
+ public RecipeScreenType screenType = RecipeScreenType.UNSET;
+
@Comment(
"The location of choose page dialog, will automatically be set to your last location so there is no need to change this.")
public RelativePoint choosePageDialogPoint = new RelativePoint(.5, .5);
diff --git a/src/main/java/me/shedaniel/rei/client/RecipeScreenType.java b/src/main/java/me/shedaniel/rei/client/RecipeScreenType.java
new file mode 100644
index 000000000..8e558aaf0
--- /dev/null
+++ b/src/main/java/me/shedaniel/rei/client/RecipeScreenType.java
@@ -0,0 +1,16 @@
+package me.shedaniel.rei.client;
+
+import net.minecraft.client.resource.language.I18n;
+
+import java.util.Locale;
+
+public enum RecipeScreenType {
+ UNSET,
+ ORIGINAL,
+ VILLAGER;
+
+ @Override
+ public String toString() {
+ return I18n.translate("text.rei.config.recipe_screen_type." + name().toLowerCase(Locale.ROOT));
+ }
+}