Search in sources :

Example 1 with MultiFenceRecipePattern

use of binnie.extratrees.blocks.decor.MultiFenceRecipePattern in project Binnie by ForestryMC.

the class MultiFenceRecipeRegistryPlugin method getRecipes.

private List<IRecipeWrapper> getRecipes(IFocus<ItemStack> focus) {
    ItemStack ingredient = focus.getValue();
    List<IRecipeWrapper> recipes = new ArrayList<>();
    if (focus.getMode() == Mode.INPUT) {
        IPlankType plankType = WoodManager.getPlankType(ingredient);
        if (plankType != null) {
            for (MultiFenceRecipePattern pattern : MultiFenceRecipePattern.VALUES) {
                recipes.add(new MultiFenceRecipeSizeWrapper(pattern, plankType));
            }
            for (int size = 0; size < 3; size++) {
                for (final boolean solid : new boolean[] { false, true }) {
                    recipes.add(new MultiFenceRecipeEmbeddedWrapper(plankType, new FenceType(size, solid, false)));
                }
            }
        } else {
            FenceDescription desc = WoodManager.getFenceDescription(ingredient);
            if (desc != null) {
                if (!desc.getFenceType().isEmbossed()) {
                    recipes.add(new MultiFenceRecipeEmbeddedWrapper(desc));
                }
                if (!desc.getFenceType().isSolid()) {
                    recipes.add(new MultiFenceRecipeSolidWrapper(desc));
                }
            }
        }
    } else {
        FenceDescription desc = WoodManager.getFenceDescription(ingredient);
        if (desc != null) {
            int size = desc.getFenceType().getSize();
            recipes.add(new MultiFenceRecipeSizeWrapper(MultiFenceRecipePattern.VALUES[size * 2], desc.getPlankType(), desc.getSecondaryPlankType()));
            recipes.add(new MultiFenceRecipeSizeWrapper(MultiFenceRecipePattern.VALUES[size * 2 + 1], desc.getPlankType(), desc.getSecondaryPlankType()));
            if (desc.getFenceType().isEmbossed()) {
                recipes.add(new MultiFenceRecipeEmbeddedWrapper(desc));
            }
            if (desc.getFenceType().isSolid()) {
                recipes.add(new MultiFenceRecipeSolidWrapper(desc));
            }
        }
    }
    return recipes;
}
Also used : IPlankType(binnie.extratrees.wood.planks.IPlankType) ArrayList(java.util.ArrayList) IRecipeWrapper(mezz.jei.api.recipe.IRecipeWrapper) FenceType(binnie.extratrees.blocks.decor.FenceType) FenceDescription(binnie.extratrees.blocks.decor.FenceDescription) MultiFenceRecipePattern(binnie.extratrees.blocks.decor.MultiFenceRecipePattern) ItemStack(net.minecraft.item.ItemStack)

Example 2 with MultiFenceRecipePattern

use of binnie.extratrees.blocks.decor.MultiFenceRecipePattern in project Binnie by ForestryMC.

the class MultiFenceRecipeRegistryPlugin method getRecipeWrappers.

@Override
public <T extends IRecipeWrapper> List<T> getRecipeWrappers(IRecipeCategory<T> recipeCategory) {
    if (!recipeCategory.getUid().equals(VanillaRecipeCategoryUid.CRAFTING)) {
        return Collections.emptyList();
    }
    if (recipes.isEmpty()) {
        for (MultiFenceRecipePattern pattern : MultiFenceRecipePattern.VALUES) {
            recipes.add(new MultiFenceRecipeSizeWrapper(pattern));
        }
        for (FenceType fenceType : FenceType.getValues()) {
            recipes.add(new MultiFenceRecipeEmbeddedWrapper(fenceType));
            recipes.add(new MultiFenceRecipeSolidWrapper(fenceType));
        }
    }
    return (List<T>) recipes;
}
Also used : MultiFenceRecipePattern(binnie.extratrees.blocks.decor.MultiFenceRecipePattern) FenceType(binnie.extratrees.blocks.decor.FenceType) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

FenceType (binnie.extratrees.blocks.decor.FenceType)2 MultiFenceRecipePattern (binnie.extratrees.blocks.decor.MultiFenceRecipePattern)2 ArrayList (java.util.ArrayList)2 FenceDescription (binnie.extratrees.blocks.decor.FenceDescription)1 IPlankType (binnie.extratrees.wood.planks.IPlankType)1 List (java.util.List)1 IRecipeWrapper (mezz.jei.api.recipe.IRecipeWrapper)1 ItemStack (net.minecraft.item.ItemStack)1