diff options
| author | Daniel She <shekwancheung0528@gmail.com> | 2019-05-10 00:20:16 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-05-10 00:20:16 +0800 |
| commit | 67fc756047f34bdbb9f028e48fc725534b3beafc (patch) | |
| tree | 670f0694b3313eaf712020a9d60dc34404725777 /src/main/java/me/shedaniel/rei/client/ClientHelperImpl.java | |
| parent | 766b4837c2512cefa3188adc897605a83144f711 (diff) | |
| parent | 467511401a783fc0a8d625947e69519da1c815e1 (diff) | |
| download | RoughlyEnoughItems-67fc756047f34bdbb9f028e48fc725534b3beafc.tar.gz RoughlyEnoughItems-67fc756047f34bdbb9f028e48fc725534b3beafc.tar.bz2 RoughlyEnoughItems-67fc756047f34bdbb9f028e48fc725534b3beafc.zip | |
Merge pull request #86 from shedaniel/1.14-dev
REi v2.9 (WIP)
Diffstat (limited to 'src/main/java/me/shedaniel/rei/client/ClientHelperImpl.java')
| -rw-r--r-- | src/main/java/me/shedaniel/rei/client/ClientHelperImpl.java | 28 |
1 files changed, 25 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..832375918 100644 --- a/src/main/java/me/shedaniel/rei/client/ClientHelperImpl.java +++ b/src/main/java/me/shedaniel/rei/client/ClientHelperImpl.java @@ -9,7 +9,9 @@ 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; import net.fabricmc.fabric.api.network.ClientSidePacketRegistry; import net.fabricmc.fabric.impl.client.keybinding.KeyBindingRegistryImpl; @@ -54,6 +56,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 +88,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 +159,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 +167,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,11 +186,21 @@ 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; } @Override + public void openRecipeViewingScreen(Map<RecipeCategory, List<RecipeDisplay>> 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)); + } + + @Override public void onInitializeClient() { ClientHelperImpl.instance = (ClientHelperImpl) this; registerFabricKeyBinds(); |
