Search in sources :

Example 1 with RollingMachineRecipeHandler

use of mods.railcraft.common.plugins.jei.rolling.RollingMachineRecipeHandler in project Railcraft by Railcraft.

the class RailcraftJEIPlugin method register.

@Override
public void register(IModRegistry registry) {
    ISubtypeRegistry subtypeRegistry = registry.getJeiHelpers().getSubtypeRegistry();
    Item trackOutfitted = RailcraftBlocks.TRACK_OUTFITTED.item();
    if (trackOutfitted != null)
        subtypeRegistry.registerNbtInterpreter(trackOutfitted, stack -> ((ItemTrackOutfitted) stack.getItem()).getSuffix(stack));
    IJeiHelpers jeiHelpers = registry.getJeiHelpers();
    IGuiHelper guiHelper = jeiHelpers.getGuiHelper();
    registry.addRecipeCategories(new RollingMachineRecipeCategory(guiHelper));
    registry.addRecipeHandlers(new RollingMachineRecipeHandler(jeiHelpers));
    registry.addRecipeClickArea(GuiRollingMachine.class, 90, 45, 23, 9, ROLLING);
    registry.addRecipeClickArea(GuiRollingMachinePowered.class, 90, 45, 23, 9, ROLLING);
    IRecipeTransferRegistry recipeTransferRegistry = registry.getRecipeTransferRegistry();
    recipeTransferRegistry.addRecipeTransferHandler(ContainerRollingMachine.class, ROLLING, 2, 9, 11, 36);
    recipeTransferRegistry.addRecipeTransferHandler(ContainerRollingMachinePowered.class, ROLLING, 2, 9, 11, 36);
    boolean rolling = false;
    ItemStack stack = RailcraftBlocks.EQUIPMENT.getStack(EquipmentVariant.ROLLING_MACHINE_MANUAL);
    if (!InvTools.isEmpty(stack)) {
        registry.addRecipeCategoryCraftingItem(stack, ROLLING);
        rolling = true;
    }
    stack = RailcraftBlocks.EQUIPMENT.getStack(EquipmentVariant.ROLLING_MACHINE_POWERED);
    if (!InvTools.isEmpty(stack)) {
        registry.addRecipeCategoryCraftingItem(stack, ROLLING);
        rolling = true;
    }
    if (rolling)
        registry.addRecipes(RollingMachineRecipeMaker.getRecipes(registry.getJeiHelpers()));
    RailcraftObjects.processBlockVariants((block, variant) -> addDescription(registry, block.getStack(variant)));
    RailcraftObjects.processItemVariants((item, variant) -> addDescription(registry, item.getStack(variant)));
}
Also used : InvTools(mods.railcraft.common.util.inventory.InvTools) GuiRollingMachine(mods.railcraft.client.gui.GuiRollingMachine) Item(net.minecraft.item.Item) ItemTrackOutfitted(mods.railcraft.common.blocks.tracks.outfitted.ItemTrackOutfitted) RailcraftBlocks(mods.railcraft.common.blocks.RailcraftBlocks) EquipmentVariant(mods.railcraft.common.blocks.machine.equipment.EquipmentVariant) IRecipeTransferRegistry(mezz.jei.api.recipe.transfer.IRecipeTransferRegistry) RollingMachineRecipeHandler(mods.railcraft.common.plugins.jei.rolling.RollingMachineRecipeHandler) LocalizationPlugin(mods.railcraft.common.plugins.forge.LocalizationPlugin) ItemStack(net.minecraft.item.ItemStack) RailcraftObjects(mods.railcraft.common.core.RailcraftObjects) ContainerRollingMachinePowered(mods.railcraft.common.gui.containers.ContainerRollingMachinePowered) RollingMachineRecipeCategory(mods.railcraft.common.plugins.jei.rolling.RollingMachineRecipeCategory) mezz.jei.api(mezz.jei.api) RollingMachineRecipeMaker(mods.railcraft.common.plugins.jei.rolling.RollingMachineRecipeMaker) GuiRollingMachinePowered(mods.railcraft.client.gui.GuiRollingMachinePowered) ContainerRollingMachine(mods.railcraft.common.gui.containers.ContainerRollingMachine) Nullable(javax.annotation.Nullable) Item(net.minecraft.item.Item) RollingMachineRecipeCategory(mods.railcraft.common.plugins.jei.rolling.RollingMachineRecipeCategory) RollingMachineRecipeHandler(mods.railcraft.common.plugins.jei.rolling.RollingMachineRecipeHandler) ItemTrackOutfitted(mods.railcraft.common.blocks.tracks.outfitted.ItemTrackOutfitted) ItemStack(net.minecraft.item.ItemStack) IRecipeTransferRegistry(mezz.jei.api.recipe.transfer.IRecipeTransferRegistry)

Aggregations

Nullable (javax.annotation.Nullable)1 mezz.jei.api (mezz.jei.api)1 IRecipeTransferRegistry (mezz.jei.api.recipe.transfer.IRecipeTransferRegistry)1 GuiRollingMachine (mods.railcraft.client.gui.GuiRollingMachine)1 GuiRollingMachinePowered (mods.railcraft.client.gui.GuiRollingMachinePowered)1 RailcraftBlocks (mods.railcraft.common.blocks.RailcraftBlocks)1 EquipmentVariant (mods.railcraft.common.blocks.machine.equipment.EquipmentVariant)1 ItemTrackOutfitted (mods.railcraft.common.blocks.tracks.outfitted.ItemTrackOutfitted)1 RailcraftObjects (mods.railcraft.common.core.RailcraftObjects)1 ContainerRollingMachine (mods.railcraft.common.gui.containers.ContainerRollingMachine)1 ContainerRollingMachinePowered (mods.railcraft.common.gui.containers.ContainerRollingMachinePowered)1 LocalizationPlugin (mods.railcraft.common.plugins.forge.LocalizationPlugin)1 RollingMachineRecipeCategory (mods.railcraft.common.plugins.jei.rolling.RollingMachineRecipeCategory)1 RollingMachineRecipeHandler (mods.railcraft.common.plugins.jei.rolling.RollingMachineRecipeHandler)1 RollingMachineRecipeMaker (mods.railcraft.common.plugins.jei.rolling.RollingMachineRecipeMaker)1 InvTools (mods.railcraft.common.util.inventory.InvTools)1 Item (net.minecraft.item.Item)1 ItemStack (net.minecraft.item.ItemStack)1