From a5c90bb7d4748ba2da024ce468ffeeda99bf4a0f Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 8 May 2019 00:55:25 +0800 Subject: start of 2.9 update beta --- .../me/shedaniel/rei/client/ClientHelperImpl.java | 24 +++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'src/main/java/me/shedaniel/rei/client/ClientHelperImpl.java') 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; @@ -53,6 +54,14 @@ public class ClientHelperImpl implements ClientHelper { return "§9§o" + mod; } + @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> 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> 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> 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> 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; -- cgit From 7de38369a5dbf1abe106c7f825ed94fde6dab05a Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 9 May 2019 23:46:15 +0800 Subject: selection screen --- src/main/java/me/shedaniel/rei/client/ClientHelperImpl.java | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/main/java/me/shedaniel/rei/client/ClientHelperImpl.java') diff --git a/src/main/java/me/shedaniel/rei/client/ClientHelperImpl.java b/src/main/java/me/shedaniel/rei/client/ClientHelperImpl.java index 5a05f0e74..832375918 100644 --- a/src/main/java/me/shedaniel/rei/client/ClientHelperImpl.java +++ b/src/main/java/me/shedaniel/rei/client/ClientHelperImpl.java @@ -9,6 +9,7 @@ import me.shedaniel.rei.api.ClientHelper; import me.shedaniel.rei.api.RecipeCategory; import me.shedaniel.rei.api.RecipeDisplay; import me.shedaniel.rei.api.RecipeHelper; +import me.shedaniel.rei.gui.PreRecipeViewingScreen; import me.shedaniel.rei.gui.RecipeViewingScreen; import me.shedaniel.rei.gui.VillagerRecipeViewingScreen; import net.fabricmc.fabric.api.client.keybinding.FabricKeyBinding; @@ -189,9 +190,12 @@ public class ClientHelperImpl implements ClientHelper { return map.keySet().size() > 0; } + @Override public void openRecipeViewingScreen(Map> map) { if (RoughlyEnoughItemsCore.getConfigManager().getConfig().screenType == RecipeScreenType.VILLAGER) MinecraftClient.getInstance().openScreen(new VillagerRecipeViewingScreen(map)); + else if (RoughlyEnoughItemsCore.getConfigManager().getConfig().screenType == RecipeScreenType.UNSET) + MinecraftClient.getInstance().openScreen(new PreRecipeViewingScreen(map)); else MinecraftClient.getInstance().openScreen(new RecipeViewingScreen(map)); } -- cgit