Search in sources :

Example 1 with IBuildingModule

use of com.minecolonies.api.colony.buildings.modules.IBuildingModule in project minecolonies by ldtteam.

the class BuildingEntry method produceBuilding.

public IBuilding produceBuilding(final BlockPos position, final IColony colony) {
    final IBuilding building = buildingProducer.apply(colony, position);
    for (final Supplier<IBuildingModule> module : buildingModuleProducers) {
        building.registerModule(module.get().setBuilding(building));
    }
    building.setBuildingType(this);
    return building;
}
Also used : IBuilding(com.minecolonies.api.colony.buildings.IBuilding) IBuildingModule(com.minecolonies.api.colony.buildings.modules.IBuildingModule)

Example 2 with IBuildingModule

use of com.minecolonies.api.colony.buildings.modules.IBuildingModule in project minecolonies by ldtteam.

the class JEIPlugin method registerCategories.

@Override
public void registerCategories(@NotNull final IRecipeCategoryRegistration registration) {
    final IJeiHelpers jeiHelpers = registration.getJeiHelpers();
    final IGuiHelper guiHelper = jeiHelpers.getGuiHelper();
    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));
                }
            }
            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) BuildingEntry(com.minecolonies.api.colony.buildings.registry.BuildingEntry) IBuildingModule(com.minecolonies.api.colony.buildings.modules.IBuildingModule) AnimalHerdingModule(com.minecolonies.coremod.colony.buildings.modules.AnimalHerdingModule) ICraftingBuildingModule(com.minecolonies.api.colony.buildings.modules.ICraftingBuildingModule) IJeiHelpers(mezz.jei.api.helpers.IJeiHelpers)

Example 3 with IBuildingModule

use of com.minecolonies.api.colony.buildings.modules.IBuildingModule in project minecolonies by Minecolonies.

the class BuildingEntry method produceBuilding.

public IBuilding produceBuilding(final BlockPos position, final IColony colony) {
    final IBuilding building = buildingProducer.apply(colony, position);
    for (final Supplier<IBuildingModule> module : buildingModuleProducers) {
        building.registerModule(module.get().setBuilding(building));
    }
    building.setBuildingType(this);
    return building;
}
Also used : IBuilding(com.minecolonies.api.colony.buildings.IBuilding) IBuildingModule(com.minecolonies.api.colony.buildings.modules.IBuildingModule)

Example 4 with IBuildingModule

use of com.minecolonies.api.colony.buildings.modules.IBuildingModule 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)4 IBuilding (com.minecolonies.api.colony.buildings.IBuilding)2 ICraftingBuildingModule (com.minecolonies.api.colony.buildings.modules.ICraftingBuildingModule)2 BuildingEntry (com.minecolonies.api.colony.buildings.registry.BuildingEntry)2 AnimalHerdingModule (com.minecolonies.coremod.colony.buildings.modules.AnimalHerdingModule)2 IGuiHelper (mezz.jei.api.helpers.IGuiHelper)2 IJeiHelpers (mezz.jei.api.helpers.IJeiHelpers)2 IModIdHelper (mezz.jei.api.helpers.IModIdHelper)1