From 954f2c87e1bfd45681508ee70fd6be63849bdd92 Mon Sep 17 00:00:00 2001 From: Nicholas Ignoffo Date: Tue, 26 Jun 2018 16:42:35 -0700 Subject: [PATCH] Fix bound orbs not allowing JEI interactions (#1349) --- .../bloodmagic/compat/jei/BloodMagicJEIPlugin.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/java/WayofTime/bloodmagic/compat/jei/BloodMagicJEIPlugin.java b/src/main/java/WayofTime/bloodmagic/compat/jei/BloodMagicJEIPlugin.java index 0f183c45..7f82a21a 100644 --- a/src/main/java/WayofTime/bloodmagic/compat/jei/BloodMagicJEIPlugin.java +++ b/src/main/java/WayofTime/bloodmagic/compat/jei/BloodMagicJEIPlugin.java @@ -7,6 +7,8 @@ import WayofTime.bloodmagic.api.impl.recipe.RecipeBloodAltar; import WayofTime.bloodmagic.api.impl.recipe.RecipeTartaricForge; import WayofTime.bloodmagic.compat.jei.alchemyTable.AlchemyTableRecipeJEI; import WayofTime.bloodmagic.core.registry.AlchemyTableRecipeRegistry; +import WayofTime.bloodmagic.orb.BloodOrb; +import WayofTime.bloodmagic.orb.IBloodOrb; import WayofTime.bloodmagic.recipe.alchemyTable.AlchemyTableRecipe; import WayofTime.bloodmagic.util.Constants; import WayofTime.bloodmagic.livingArmour.LivingArmourHandler; @@ -89,8 +91,17 @@ public class BloodMagicJEIPlugin implements IModPlugin { @Override public void registerItemSubtypes(ISubtypeRegistry subtypeRegistry) { subtypeRegistry.useNbtForSubtypes(RegistrarBloodMagicItems.UPGRADE_TOME); - subtypeRegistry.useNbtForSubtypes(RegistrarBloodMagicItems.BLOOD_ORB); subtypeRegistry.useNbtForSubtypes(RegistrarBloodMagicItems.POTION_FLASK); + subtypeRegistry.registerSubtypeInterpreter(RegistrarBloodMagicItems.BLOOD_ORB, stack -> { + if (!(stack.getItem() instanceof IBloodOrb)) + return ISubtypeRegistry.ISubtypeInterpreter.NONE; + + BloodOrb orb = ((IBloodOrb) stack.getItem()).getOrb(stack); + if (orb == null) + return ISubtypeRegistry.ISubtypeInterpreter.NONE; + + return orb.getRegistryName().toString(); + }); } @Override