-
Notifications
You must be signed in to change notification settings - Fork 214
Expand file tree
/
Copy pathJEIUtil.java
More file actions
29 lines (23 loc) · 1.02 KB
/
JEIUtil.java
File metadata and controls
29 lines (23 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package gregtech.api.util;
import net.minecraft.enchantment.EnchantmentData;
import com.cleanroommc.modularui.integration.jei.JeiGhostIngredientSlot;
import com.cleanroommc.modularui.integration.jei.ModularUIJeiPlugin;
import mezz.jei.Internal;
public class JEIUtil {
/**
* Check if the player is currently hovering over a valid ingredient for this slot. <br/>
* Will always return false is JEI is not installed.
*/
public static boolean hoveringOverIngredient(JeiGhostIngredientSlot<?> jeiGhostIngredientSlot) {
if (!Mods.JustEnoughItems.isModLoaded()) return false;
return ModularUIJeiPlugin.hoveringOverIngredient(jeiGhostIngredientSlot);
}
public static Object getBookStackIfEnchantment(Object ingredient) {
if (ingredient instanceof EnchantmentData enchantmentData) {
return Internal.getIngredientRegistry()
.getIngredientHelper(enchantmentData)
.getCheatItemStack(enchantmentData);
}
return ingredient;
}
}