2018-10-22 00:14:52 +02:00
|
|
|
package de.ellpeck.naturesaura.compat.jei;
|
2018-10-16 21:10:38 +02:00
|
|
|
|
|
|
|
import de.ellpeck.naturesaura.NaturesAura;
|
2018-11-11 13:26:19 +01:00
|
|
|
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
2020-01-23 19:20:47 +01:00
|
|
|
import de.ellpeck.naturesaura.api.aura.container.IAuraContainer;
|
2018-10-16 21:10:38 +02:00
|
|
|
import de.ellpeck.naturesaura.blocks.ModBlocks;
|
2020-01-26 01:41:49 +01:00
|
|
|
import de.ellpeck.naturesaura.items.ItemAuraBottle;
|
|
|
|
import de.ellpeck.naturesaura.items.ItemEffectPowder;
|
2020-01-23 19:20:47 +01:00
|
|
|
import de.ellpeck.naturesaura.items.ModItems;
|
2020-04-29 16:38:50 +02:00
|
|
|
import de.ellpeck.naturesaura.recipes.ModRecipes;
|
2018-10-16 21:10:38 +02:00
|
|
|
import mezz.jei.api.IModPlugin;
|
2020-01-21 21:04:44 +01:00
|
|
|
import mezz.jei.api.JeiPlugin;
|
|
|
|
import mezz.jei.api.helpers.IGuiHelper;
|
2020-01-23 19:20:47 +01:00
|
|
|
import mezz.jei.api.ingredients.subtypes.ISubtypeInterpreter;
|
2020-01-21 21:04:44 +01:00
|
|
|
import mezz.jei.api.registration.IRecipeCatalystRegistration;
|
|
|
|
import mezz.jei.api.registration.IRecipeCategoryRegistration;
|
|
|
|
import mezz.jei.api.registration.IRecipeRegistration;
|
2020-01-23 19:20:47 +01:00
|
|
|
import mezz.jei.api.registration.ISubtypeRegistration;
|
2020-04-29 16:38:50 +02:00
|
|
|
import net.minecraft.client.Minecraft;
|
2018-10-16 21:10:38 +02:00
|
|
|
import net.minecraft.item.ItemStack;
|
2020-04-29 16:38:50 +02:00
|
|
|
import net.minecraft.item.crafting.RecipeManager;
|
2020-01-21 21:04:44 +01:00
|
|
|
import net.minecraft.util.ResourceLocation;
|
2018-10-16 21:10:38 +02:00
|
|
|
|
2020-01-21 21:04:44 +01:00
|
|
|
@JeiPlugin
|
2018-10-16 21:10:38 +02:00
|
|
|
public class JEINaturesAuraPlugin implements IModPlugin {
|
|
|
|
|
2020-01-21 21:04:44 +01:00
|
|
|
public static final ResourceLocation TREE_RITUAL = new ResourceLocation(NaturesAura.MOD_ID, "tree_ritual");
|
|
|
|
public static final ResourceLocation ALTAR = new ResourceLocation(NaturesAura.MOD_ID, "altar");
|
|
|
|
public static final ResourceLocation OFFERING = new ResourceLocation(NaturesAura.MOD_ID, "offering");
|
|
|
|
public static final ResourceLocation SPAWNER = new ResourceLocation(NaturesAura.MOD_ID, "animal_spawner");
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public ResourceLocation getPluginUid() {
|
|
|
|
return new ResourceLocation(NaturesAura.MOD_ID, "jei_plugin");
|
|
|
|
}
|
2018-10-16 21:10:38 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void registerCategories(IRecipeCategoryRegistration registry) {
|
|
|
|
IGuiHelper helper = registry.getJeiHelpers().getGuiHelper();
|
|
|
|
registry.addRecipeCategories(
|
2018-10-18 18:00:21 +02:00
|
|
|
new TreeRitualCategory(helper),
|
2018-11-21 01:05:50 +01:00
|
|
|
new AltarCategory(helper),
|
2018-12-31 17:32:38 +01:00
|
|
|
new OfferingCategory(helper),
|
|
|
|
new AnimalSpawnerCategory(helper)
|
2018-10-16 21:10:38 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-01-23 19:20:47 +01:00
|
|
|
@Override
|
|
|
|
public void registerItemSubtypes(ISubtypeRegistration registration) {
|
2020-01-26 01:41:49 +01:00
|
|
|
registration.registerSubtypeInterpreter(ModItems.EFFECT_POWDER, stack -> ItemEffectPowder.getEffect(stack).toString());
|
|
|
|
registration.registerSubtypeInterpreter(ModItems.AURA_BOTTLE, stack -> ItemAuraBottle.getType(stack).getName().toString());
|
2020-01-23 19:20:47 +01:00
|
|
|
|
|
|
|
ISubtypeInterpreter auraInterpreter = stack -> {
|
|
|
|
IAuraContainer container = stack.getCapability(NaturesAuraAPI.capAuraContainer).orElse(null);
|
|
|
|
if (container != null)
|
|
|
|
return String.valueOf(container.getStoredAura());
|
|
|
|
return ISubtypeInterpreter.NONE;
|
|
|
|
};
|
|
|
|
registration.registerSubtypeInterpreter(ModItems.AURA_CACHE, auraInterpreter);
|
|
|
|
registration.registerSubtypeInterpreter(ModItems.AURA_TROVE, auraInterpreter);
|
|
|
|
}
|
|
|
|
|
2018-10-16 21:10:38 +02:00
|
|
|
@Override
|
2020-01-21 21:04:44 +01:00
|
|
|
public void registerRecipeCatalysts(IRecipeCatalystRegistration registration) {
|
|
|
|
registration.addRecipeCatalyst(new ItemStack(ModBlocks.GOLD_POWDER), TREE_RITUAL);
|
|
|
|
registration.addRecipeCatalyst(new ItemStack(ModBlocks.WOOD_STAND), TREE_RITUAL);
|
|
|
|
registration.addRecipeCatalyst(new ItemStack(ModBlocks.NATURE_ALTAR), ALTAR);
|
|
|
|
registration.addRecipeCatalyst(new ItemStack(ModBlocks.OFFERING_TABLE), OFFERING);
|
|
|
|
registration.addRecipeCatalyst(new ItemStack(ModBlocks.ANIMAL_SPAWNER), SPAWNER);
|
|
|
|
}
|
2018-10-16 21:10:38 +02:00
|
|
|
|
2020-01-21 21:04:44 +01:00
|
|
|
@Override
|
|
|
|
public void registerRecipes(IRecipeRegistration registration) {
|
2021-12-04 15:40:09 +01:00
|
|
|
RecipeManager manager = Minecraft.getInstance().level.getRecipeManager();
|
2020-04-29 16:38:50 +02:00
|
|
|
registration.addRecipes(manager.getRecipes(ModRecipes.TREE_RITUAL_TYPE, null, null), TREE_RITUAL);
|
|
|
|
registration.addRecipes(manager.getRecipes(ModRecipes.ALTAR_TYPE, null, null), ALTAR);
|
|
|
|
registration.addRecipes(manager.getRecipes(ModRecipes.OFFERING_TYPE, null, null), OFFERING);
|
|
|
|
registration.addRecipes(manager.getRecipes(ModRecipes.ANIMAL_SPAWNER_TYPE, null, null), SPAWNER);
|
2018-10-16 21:10:38 +02:00
|
|
|
}
|
|
|
|
}
|