mezz.jei.api.recipe.IFocus.Mode Java Examples

The following examples show how to use mezz.jei.api.recipe.IFocus.Mode. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FacadeRegistryPlugin.java    From GregTech with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public <V> List<String> getRecipeCategoryUids(IFocus<V> focus) {
    if (focus.getValue() instanceof ItemStack) {
        ItemStack itemStack = (ItemStack) focus.getValue();
        if (focus.getMode() == Mode.OUTPUT) {
            if (MetaItems.COVER_FACADE.isItemEqual(itemStack)) {
                //looking up recipes of facade cover
                return Collections.singletonList(VanillaRecipeCategoryUid.CRAFTING);
            }
        } else if (focus.getMode() == Mode.INPUT) {
            if (FacadeHelper.isValidFacade(itemStack)) {
                //looking up usage of block to make a facade cover
                return Collections.singletonList(VanillaRecipeCategoryUid.CRAFTING);
            }
        }
    }
    return Collections.emptyList();
}
 
Example #2
Source File: FacadeRegistryPlugin.java    From GregTech with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public <T extends IRecipeWrapper, V> List<T> getRecipeWrappers(IRecipeCategory<T> recipeCategory, IFocus<V> focus) {
    if (!VanillaRecipeCategoryUid.CRAFTING.equals(recipeCategory.getUid())) {
        return Collections.emptyList();
    }
    if (focus.getValue() instanceof ItemStack) {
        ItemStack itemStack = (ItemStack) focus.getValue();
        if (focus.getMode() == Mode.OUTPUT) {
            if (MetaItems.COVER_FACADE.isItemEqual(itemStack)) {
                //looking up recipes of facade cover
                return (List<T>) createFacadeRecipes(itemStack);
            }
        } else if (focus.getMode() == Mode.INPUT) {
            if (FacadeHelper.isValidFacade(itemStack)) {
                //looking up usage of block to make a facade cover
                ItemStack coverStack = MetaItems.COVER_FACADE.getStackForm();
                FacadeItem.setFacadeStack(coverStack, itemStack);
                return (List<T>) createFacadeRecipes(coverStack);
            }
        }
    }
    return Collections.emptyList();
}
 
Example #3
Source File: JEIProxy.java    From NotEnoughItems with MIT License 5 votes vote down vote up
@Override
public void openRecipeGui(ItemStack stack) {
    RecipeRegistry registry = Internal.getRuntime().getRecipeRegistry();
    IFocus<ItemStack> focus = registry.createFocus(Mode.OUTPUT, stack);
    if (registry.getRecipeCategories(focus).isEmpty()) {
        return;
    }
    Internal.getRuntime().getRecipesGui().show(focus);
}
 
Example #4
Source File: JEIProxy.java    From NotEnoughItems with MIT License 5 votes vote down vote up
@Override
public void openUsageGui(ItemStack stack) {
    RecipeRegistry registry = Internal.getRuntime().getRecipeRegistry();
    IFocus<ItemStack> focus = registry.createFocus(Mode.INPUT, stack);
    if (registry.getRecipeCategories(focus).isEmpty()) {
        return;
    }
    Internal.getRuntime().getRecipesGui().show(focus);
}