From 2077ebf086543587c4fc7ca9b125809609f749b9 Mon Sep 17 00:00:00 2001 From: shedaniel Date: Fri, 3 Jan 2020 23:20:31 +0800 Subject: Compact the design and add cooking xp details --- src/main/java/me/shedaniel/rei/api/ClientHelper.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/main/java/me/shedaniel/rei/api/ClientHelper.java') diff --git a/src/main/java/me/shedaniel/rei/api/ClientHelper.java b/src/main/java/me/shedaniel/rei/api/ClientHelper.java index 08ab4fcab..112037403 100644 --- a/src/main/java/me/shedaniel/rei/api/ClientHelper.java +++ b/src/main/java/me/shedaniel/rei/api/ClientHelper.java @@ -6,7 +6,6 @@ package me.shedaniel.rei.api; import me.shedaniel.rei.impl.ClientHelperImpl; -import net.fabricmc.fabric.api.client.keybinding.FabricKeyBinding; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.Identifier; @@ -126,7 +125,19 @@ public interface ClientHelper { * @param identifier the identifier to find * @return the mod name */ - String getModFromIdentifier(Identifier identifier); + default String getModFromIdentifier(Identifier identifier) { + if (identifier == null) + return ""; + return getModFromModId(identifier.getNamespace()); + } + + /** + * Gets the mod from a modid + * + * @param modid the modid of the mod + * @return the mod name + */ + String getModFromModId(String modid); /** * Finds all recipes and open them in a recipe screen. -- cgit