Search in sources :

Example 1 with IModIdHelper

use of mezz.jei.api.helpers.IModIdHelper in project minecolonies by Minecolonies.

the class JEIPlugin method registerCategories.

@Override
public void registerCategories(@NotNull final IRecipeCategoryRegistration registration) {
    final IJeiHelpers jeiHelpers = registration.getJeiHelpers();
    final IGuiHelper guiHelper = jeiHelpers.getGuiHelper();
    final IModIdHelper modIdHelper = jeiHelpers.getModIdHelper();
    registration.addRecipeCategories(new CompostRecipeCategory(guiHelper));
    registration.addRecipeCategories(new FishermanRecipeCategory(guiHelper));
    categories.clear();
    for (final BuildingEntry building : IMinecoloniesAPI.getInstance().getBuildingRegistry()) {
        for (final Supplier<IBuildingModule> producer : building.getModuleProducers()) {
            final IBuildingModule module = producer.get();
            if (module instanceof ICraftingBuildingModule) {
                final ICraftingBuildingModule crafting = (ICraftingBuildingModule) module;
                final IJob<?> job = crafting.getCraftingJob();
                if (job != null) {
                    registerCategory(registration, new GenericRecipeCategory(building, job, crafting, guiHelper, modIdHelper));
                }
            }
            if (module instanceof AnimalHerdingModule) {
                final AnimalHerdingModule herding = (AnimalHerdingModule) module;
                registerCategory(registration, new HerderRecipeCategory(building, herding.getHerdingJob(), herding, guiHelper));
            }
        }
    }
}
Also used : IGuiHelper(mezz.jei.api.helpers.IGuiHelper) IBuildingModule(com.minecolonies.api.colony.buildings.modules.IBuildingModule) AnimalHerdingModule(com.minecolonies.coremod.colony.buildings.modules.AnimalHerdingModule) IModIdHelper(mezz.jei.api.helpers.IModIdHelper) IJeiHelpers(mezz.jei.api.helpers.IJeiHelpers) BuildingEntry(com.minecolonies.api.colony.buildings.registry.BuildingEntry) ICraftingBuildingModule(com.minecolonies.api.colony.buildings.modules.ICraftingBuildingModule)

Aggregations

IBuildingModule (com.minecolonies.api.colony.buildings.modules.IBuildingModule)1 ICraftingBuildingModule (com.minecolonies.api.colony.buildings.modules.ICraftingBuildingModule)1 BuildingEntry (com.minecolonies.api.colony.buildings.registry.BuildingEntry)1 AnimalHerdingModule (com.minecolonies.coremod.colony.buildings.modules.AnimalHerdingModule)1 IGuiHelper (mezz.jei.api.helpers.IGuiHelper)1 IJeiHelpers (mezz.jei.api.helpers.IJeiHelpers)1 IModIdHelper (mezz.jei.api.helpers.IModIdHelper)1