Search in sources :

Example 1 with EnumForestryWoodType

use of forestry.api.arboriculture.EnumForestryWoodType in project ForestryMC by ForestryMC.

the class BlockArbDoor method getBlockHardness.

@Override
public float getBlockHardness(IBlockState blockState, World worldIn, BlockPos pos) {
    int meta = getMetaFromState(blockState);
    EnumForestryWoodType woodType = getWoodType(meta);
    return woodType.getHardness();
}
Also used : EnumForestryWoodType(forestry.api.arboriculture.EnumForestryWoodType)

Example 2 with EnumForestryWoodType

use of forestry.api.arboriculture.EnumForestryWoodType in project ForestryMC by ForestryMC.

the class WoodHelper method getDisplayName.

public static String getDisplayName(IWoodTyped wood, IWoodType woodType) {
    WoodBlockKind blockKind = wood.getBlockKind();
    String displayName;
    if (woodType instanceof EnumForestryWoodType) {
        String customUnlocalizedName = "tile.for." + blockKind + "." + woodType + ".name";
        if (Translator.canTranslateToLocal(customUnlocalizedName)) {
            displayName = Translator.translateToLocal(customUnlocalizedName);
        } else {
            String woodGrammar = Translator.translateToLocal("for." + blockKind + ".grammar");
            String woodTypeName = Translator.translateToLocal("for.trees.woodType." + woodType);
            displayName = woodGrammar.replaceAll("%TYPE", woodTypeName);
        }
    } else if (woodType instanceof EnumVanillaWoodType) {
        displayName = TreeManager.woodAccess.getStack(woodType, blockKind, false).getDisplayName();
    } else {
        throw new IllegalArgumentException("Unknown wood type: " + woodType);
    }
    if (wood.isFireproof()) {
        displayName = Translator.translateToLocalFormatted("tile.for.fireproof", displayName);
    }
    return displayName;
}
Also used : WoodBlockKind(forestry.api.arboriculture.WoodBlockKind) EnumVanillaWoodType(forestry.api.arboriculture.EnumVanillaWoodType) EnumForestryWoodType(forestry.api.arboriculture.EnumForestryWoodType)

Example 3 with EnumForestryWoodType

use of forestry.api.arboriculture.EnumForestryWoodType in project ForestryMC by ForestryMC.

the class ModuleArboriculture method registerRecipes.

@Override
public void registerRecipes() {
    ItemRegistryCore coreItems = ModuleCore.getItems();
    BlockRegistryArboriculture blocks = getBlocks();
    ItemRegistryArboriculture items = getItems();
    for (BlockArbLog log : blocks.logs) {
        ItemStack logInput = new ItemStack(log, 1, OreDictionary.WILDCARD_VALUE);
        ItemStack coalOutput = new ItemStack(Items.COAL, 1, 1);
        RecipeUtil.addSmelting(logInput, coalOutput, 0.15F);
    }
    List<IWoodType> allWoodTypes = new ArrayList<>();
    Collections.addAll(allWoodTypes, EnumForestryWoodType.VALUES);
    Collections.addAll(allWoodTypes, EnumVanillaWoodType.VALUES);
    for (IWoodType woodType : allWoodTypes) {
        ItemStack planks = TreeManager.woodAccess.getStack(woodType, WoodBlockKind.PLANKS, false);
        ItemStack logs = TreeManager.woodAccess.getStack(woodType, WoodBlockKind.LOG, false);
        ItemStack slabs = TreeManager.woodAccess.getStack(woodType, WoodBlockKind.SLAB, false);
        ItemStack fences = TreeManager.woodAccess.getStack(woodType, WoodBlockKind.FENCE, false);
        ItemStack fenceGates = TreeManager.woodAccess.getStack(woodType, WoodBlockKind.FENCE_GATE, false);
        ItemStack stairs = TreeManager.woodAccess.getStack(woodType, WoodBlockKind.STAIRS, false);
        ItemStack doors = TreeManager.woodAccess.getStack(woodType, WoodBlockKind.DOOR, false);
        ItemStack fireproofPlanks = TreeManager.woodAccess.getStack(woodType, WoodBlockKind.PLANKS, true);
        ItemStack fireproofLogs = TreeManager.woodAccess.getStack(woodType, WoodBlockKind.LOG, true);
        ItemStack fireproofSlabs = TreeManager.woodAccess.getStack(woodType, WoodBlockKind.SLAB, true);
        ItemStack fireproofFences = TreeManager.woodAccess.getStack(woodType, WoodBlockKind.FENCE, true);
        ItemStack fireproofFenceGates = TreeManager.woodAccess.getStack(woodType, WoodBlockKind.FENCE_GATE, true);
        ItemStack fireproofStairs = TreeManager.woodAccess.getStack(woodType, WoodBlockKind.STAIRS, true);
        if (woodType instanceof EnumForestryWoodType) {
            planks.setCount(4);
            logs.setCount(1);
            RecipeUtil.addShapelessRecipe("planks_" + woodType.getName(), planks.copy(), logs.copy());
            slabs.setCount(6);
            planks.setCount(1);
            RecipeUtil.addRecipe("slabs_" + woodType.getName(), slabs.copy(), "###", '#', planks.copy());
            fences.setCount(3);
            planks.setCount(1);
            RecipeUtil.addRecipe("fences_" + woodType.getName(), fences.copy(), "#X#", "#X#", '#', planks.copy(), 'X', "stickWood");
            fenceGates.setCount(1);
            planks.setCount(1);
            RecipeUtil.addRecipe("fence_gates_" + woodType.getName(), fenceGates.copy(), "X#X", "X#X", '#', planks.copy(), 'X', "stickWood");
            stairs.setCount(4);
            planks.setCount(1);
            RecipeUtil.addRecipe("stairs_" + woodType.getName(), stairs.copy(), "#  ", "## ", "###", '#', planks.copy());
            doors.setCount(3);
            planks.setCount(1);
            RecipeUtil.addRecipe("doors_" + woodType.getName(), doors.copy(), "## ", "## ", "## ", '#', planks.copy());
        }
        fireproofPlanks.setCount(4);
        fireproofLogs.setCount(1);
        RecipeUtil.addShapelessRecipe("fireproof_planks_" + woodType.getName(), fireproofPlanks.copy(), fireproofLogs.copy());
        fireproofSlabs.setCount(6);
        fireproofPlanks.setCount(1);
        RecipeUtil.addRecipe("fireproof_slabs_" + woodType.getName(), fireproofSlabs.copy(), "###", '#', fireproofPlanks.copy());
        fireproofFences.setCount(3);
        fireproofPlanks.setCount(1);
        RecipeUtil.addRecipe("fireproof_fences_" + woodType.getName(), fireproofFences.copy(), "#X#", "#X#", '#', fireproofPlanks.copy(), 'X', "stickWood");
        fireproofFenceGates.setCount(1);
        fireproofPlanks.setCount(1);
        RecipeUtil.addRecipe("fireproof_fence_gates_" + woodType.getName(), fireproofFenceGates.copy(), "X#X", "X#X", '#', fireproofPlanks.copy(), 'X', "stickWood");
        fireproofStairs.setCount(4);
        fireproofPlanks.setCount(1);
        RecipeUtil.addRecipe("fireproof_stairs_" + woodType.getName(), fireproofStairs.copy(), "#  ", "## ", "###", '#', fireproofPlanks.copy());
        doors.setCount(3);
        fireproofPlanks.setCount(1);
        RecipeUtil.addRecipe("fireproof_doors_" + woodType.getName(), doors.copy(), "## ", "## ", "## ", '#', fireproofPlanks.copy());
        // Fabricator recipes
        if (ForestryAPI.enabledModules.containsAll(Arrays.asList(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.FACTORY), new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.APICULTURE)))) {
            logs.setCount(1);
            fireproofLogs.setCount(1);
            RecipeManagers.fabricatorManager.addRecipe(ItemStack.EMPTY, Fluids.GLASS.getFluid(500), fireproofLogs.copy(), new Object[] { " # ", "#X#", " # ", '#', coreItems.refractoryWax, 'X', logs.copy() });
            planks.setCount(1);
            fireproofPlanks.setCount(5);
            RecipeManagers.fabricatorManager.addRecipe(ItemStack.EMPTY, Fluids.GLASS.getFluid(500), fireproofPlanks.copy(), new Object[] { "X#X", "#X#", "X#X", '#', coreItems.refractoryWax, 'X', planks.copy() });
        }
    }
    if (ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.FACTORY))) {
        // SQUEEZER RECIPES
        int seedOilMultiplier = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.seed");
        int juiceMultiplier = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.apple");
        int mulchMultiplier = ForestryAPI.activeMode.getIntegerSetting("squeezer.mulch.apple");
        ItemStack mulch = new ItemStack(coreItems.mulch);
        RecipeManagers.squeezerManager.addRecipe(20, EnumFruit.CHERRY.getStack(), Fluids.SEED_OIL.getFluid(5 * seedOilMultiplier), mulch, 5);
        RecipeManagers.squeezerManager.addRecipe(60, EnumFruit.WALNUT.getStack(), Fluids.SEED_OIL.getFluid(18 * seedOilMultiplier), mulch, 5);
        RecipeManagers.squeezerManager.addRecipe(70, EnumFruit.CHESTNUT.getStack(), Fluids.SEED_OIL.getFluid(22 * seedOilMultiplier), mulch, 2);
        RecipeManagers.squeezerManager.addRecipe(10, EnumFruit.LEMON.getStack(), Fluids.JUICE.getFluid(juiceMultiplier * 2), mulch, (int) Math.floor(mulchMultiplier * 0.5f));
        RecipeManagers.squeezerManager.addRecipe(10, EnumFruit.PLUM.getStack(), Fluids.JUICE.getFluid((int) Math.floor(juiceMultiplier * 0.5f)), mulch, mulchMultiplier * 3);
        RecipeManagers.squeezerManager.addRecipe(10, EnumFruit.PAPAYA.getStack(), Fluids.JUICE.getFluid(juiceMultiplier * 3), mulch, (int) Math.floor(mulchMultiplier * 0.5f));
        RecipeManagers.squeezerManager.addRecipe(10, EnumFruit.DATES.getStack(), Fluids.JUICE.getFluid((int) Math.floor(juiceMultiplier * 0.25)), mulch, mulchMultiplier);
        RecipeUtil.addFermenterRecipes(new ItemStack(items.sapling, 1, OreDictionary.WILDCARD_VALUE), ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.sapling"), Fluids.BIOMASS);
    }
    // Grafter
    RecipeUtil.addRecipe("grafter", items.grafter.getItemStack(), "  B", " # ", "#  ", 'B', "ingotBronze", '#', "stickWood");
    RecipeUtil.addRecipe("tree_chest", blocks.treeChest, " # ", "XYX", "XXX", '#', "blockGlass", 'X', "treeSapling", 'Y', "chestWood");
}
Also used : IWoodType(forestry.api.arboriculture.IWoodType) ItemRegistryArboriculture(forestry.arboriculture.items.ItemRegistryArboriculture) ItemRegistryCore(forestry.core.items.ItemRegistryCore) ResourceLocation(net.minecraft.util.ResourceLocation) ArrayList(java.util.ArrayList) BlockRegistryArboriculture(forestry.arboriculture.blocks.BlockRegistryArboriculture) EnumForestryWoodType(forestry.api.arboriculture.EnumForestryWoodType) BlockArbLog(forestry.arboriculture.blocks.BlockArbLog) ItemStack(net.minecraft.item.ItemStack)

Aggregations

EnumForestryWoodType (forestry.api.arboriculture.EnumForestryWoodType)3 EnumVanillaWoodType (forestry.api.arboriculture.EnumVanillaWoodType)1 IWoodType (forestry.api.arboriculture.IWoodType)1 WoodBlockKind (forestry.api.arboriculture.WoodBlockKind)1 BlockArbLog (forestry.arboriculture.blocks.BlockArbLog)1 BlockRegistryArboriculture (forestry.arboriculture.blocks.BlockRegistryArboriculture)1 ItemRegistryArboriculture (forestry.arboriculture.items.ItemRegistryArboriculture)1 ItemRegistryCore (forestry.core.items.ItemRegistryCore)1 ArrayList (java.util.ArrayList)1 ItemStack (net.minecraft.item.ItemStack)1 ResourceLocation (net.minecraft.util.ResourceLocation)1