Search in sources :

Example 1 with FenceDescription

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

the class ExtraTreesJeiPlugin method registerItemSubtypes.

@Override
public void registerItemSubtypes(ISubtypeRegistry subtypeRegistry) {
    if (ModuleManager.isModuleEnabled(Constants.EXTRA_TREES_MOD_ID, ExtraTreesModuleUIDs.WOOD)) {
        subtypeRegistry.registerSubtypeInterpreter(Item.getItemFromBlock(ModuleWood.blockMultiFence), (ItemStack itemStack) -> {
            FenceDescription desc = WoodManager.getFenceDescription(itemStack);
            if (desc != null) {
                FenceType type = WoodManager.getFenceType(itemStack);
                return type + ":" + desc.getPlankType().getDesignMaterialName().toLowerCase() + ':' + desc.getSecondaryPlankType().getDesignMaterialName().toLowerCase();
            }
            return Integer.toString(itemStack.getItemDamage());
        });
    }
    if (ModuleManager.isModuleEnabled(Constants.EXTRA_TREES_MOD_ID, ExtraTreesModuleUIDs.ALCOHOL)) {
        subtypeRegistry.registerSubtypeInterpreter(ModuleAlcohol.drink, (ItemStack itemStack) -> {
            String glassware = ModuleAlcohol.drink.getGlassware(itemStack).getName();
            FluidStack fluidStack = FluidUtil.getFluidContained(itemStack);
            if (fluidStack == null) {
                return glassware;
            }
            return glassware + ':' + fluidStack.getFluid().getName();
        });
    }
}
Also used : FluidStack(net.minecraftforge.fluids.FluidStack) FenceDescription(binnie.extratrees.blocks.decor.FenceDescription) FenceType(binnie.extratrees.blocks.decor.FenceType) ItemStack(net.minecraft.item.ItemStack)

Example 2 with FenceDescription

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

the class MultiFenceRecipeRegistryPlugin method getRecipeCategoryUids.

@Override
public <V> List<String> getRecipeCategoryUids(IFocus<V> focus) {
    V ingredient = focus.getValue();
    if (!(ingredient instanceof ItemStack)) {
        return Collections.emptyList();
    }
    ItemStack itemStack = (ItemStack) ingredient;
    FenceDescription desc;
    switch(focus.getMode()) {
        case INPUT:
            desc = WoodManager.getFenceDescription(itemStack);
            IPlankType plankType = WoodManager.getPlankType(itemStack);
            if (plankType != null || desc != null && (!desc.getFenceType().isEmbossed() || !desc.getFenceType().isEmbossed())) {
                return Collections.singletonList(VanillaRecipeCategoryUid.CRAFTING);
            }
            return Collections.emptyList();
        case OUTPUT:
            desc = WoodManager.getFenceDescription(itemStack);
            if (desc != null) {
                return Collections.singletonList(VanillaRecipeCategoryUid.CRAFTING);
            }
            return Collections.emptyList();
        default:
            return Collections.singletonList(VanillaRecipeCategoryUid.CRAFTING);
    }
}
Also used : IPlankType(binnie.extratrees.wood.planks.IPlankType) FenceDescription(binnie.extratrees.blocks.decor.FenceDescription) ItemStack(net.minecraft.item.ItemStack)

Example 3 with FenceDescription

use of binnie.extratrees.blocks.decor.FenceDescription 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)

Aggregations

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