NaturesAura/src/main/java/de/ellpeck/naturesaura/compat/jei/JEINaturesAuraPlugin.java

78 lines
3.7 KiB
Java
Raw Normal View History

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-23 19:20:47 +01:00
import de.ellpeck.naturesaura.items.AuraBottle;
import de.ellpeck.naturesaura.items.EffectPowder;
import de.ellpeck.naturesaura.items.ModItems;
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;
2018-10-16 21:10:38 +02:00
import net.minecraft.item.ItemStack;
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),
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) {
registration.registerSubtypeInterpreter(ModItems.EFFECT_POWDER, stack -> EffectPowder.getEffect(stack).toString());
registration.registerSubtypeInterpreter(ModItems.AURA_BOTTLE, stack -> AuraBottle.getType(stack).getName().toString());
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.CONVERSION_CATALYST), 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) {
registration.addRecipes(NaturesAuraAPI.TREE_RITUAL_RECIPES.values(), TREE_RITUAL);
registration.addRecipes(NaturesAuraAPI.ALTAR_RECIPES.values(), ALTAR);
registration.addRecipes(NaturesAuraAPI.OFFERING_RECIPES.values(), OFFERING);
registration.addRecipes(NaturesAuraAPI.ANIMAL_SPAWNER_RECIPES.values(), SPAWNER);
2018-10-16 21:10:38 +02:00
}
}