Search in sources :

Example 1 with WoodType

use of forestry.arboriculture.WoodType in project ForestryMC by ForestryMC.

the class ItemStairs method getItemStackDisplayName.

@Override
public String getItemStackDisplayName(ItemStack itemStack) {
    WoodType woodType = WoodType.getFromCompound(itemStack.getTagCompound());
    if (woodType == null) {
        return null;
    }
    String displayName;
    String customUnlocalizedName = "stairs." + woodType.ordinal() + ".name";
    if (StringUtil.canTranslateTile(customUnlocalizedName)) {
        displayName = StringUtil.localizeTile(customUnlocalizedName);
    } else {
        String woodGrammar = StringUtil.localize("stairs.grammar");
        String woodTypeName = StringUtil.localize("trees.woodType." + woodType);
        displayName = woodGrammar.replaceAll("%TYPE", woodTypeName);
    }
    return displayName;
}
Also used : WoodType(forestry.arboriculture.WoodType)

Example 2 with WoodType

use of forestry.arboriculture.WoodType in project ForestryMC by ForestryMC.

the class PluginArboriculture method registerRecipes.

@Override
protected void registerRecipes() {
    for (ForestryBlock log : logs) {
        Proxies.common.addSmelting(log.getWildcard(), new ItemStack(Items.coal, 1, 1), 0.15F);
    }
    // / Plank recipes
    for (int i = 0; i < 4; i++) {
        Proxies.common.addShapelessRecipe(ForestryBlock.planks1.getItemStack(4, i), ForestryBlock.log1.getItemStack(1, i));
    }
    for (int i = 0; i < 4; i++) {
        Proxies.common.addShapelessRecipe(ForestryBlock.planks1.getItemStack(4, 4 + i), ForestryBlock.log2.getItemStack(1, i));
    }
    for (int i = 0; i < 4; i++) {
        Proxies.common.addShapelessRecipe(ForestryBlock.planks1.getItemStack(4, 8 + i), ForestryBlock.log3.getItemStack(1, i));
    }
    for (int i = 0; i < 4; i++) {
        Proxies.common.addShapelessRecipe(ForestryBlock.planks1.getItemStack(4, 12 + i), ForestryBlock.log4.getItemStack(1, i));
    }
    for (int i = 0; i < 4; i++) {
        Proxies.common.addShapelessRecipe(ForestryBlock.planks2.getItemStack(4, i), ForestryBlock.log5.getItemStack(1, i));
    }
    for (int i = 0; i < 4; i++) {
        Proxies.common.addShapelessRecipe(ForestryBlock.planks2.getItemStack(4, 4 + i), ForestryBlock.log6.getItemStack(1, i));
    }
    for (int i = 0; i < 4; i++) {
        Proxies.common.addShapelessRecipe(ForestryBlock.planks2.getItemStack(4, 8 + i), ForestryBlock.log7.getItemStack(1, i));
    }
    for (int i = 0; i < 1; i++) {
        Proxies.common.addShapelessRecipe(ForestryBlock.planks2.getItemStack(4, 12 + i), ForestryBlock.log8.getItemStack(1, i));
    }
    // Fabricator recipes
    if (PluginManager.Module.FACTORY.isEnabled() && PluginManager.Module.APICULTURE.isEnabled()) {
        // Fireproof log recipes
        for (ForestryBlock forestryBlock : logs) {
            BlockLog blockLog = (BlockLog) forestryBlock.block();
            ForestryBlock fireproofLog = BlockFireproofLog.getFireproofLog(blockLog);
            for (int i = 0; i < 4; i++) {
                if (forestryBlock == ForestryBlock.log8 && i > 0) {
                    break;
                }
                ItemStack logStack = forestryBlock.getItemStack(1, i);
                ItemStack fireproofLogStack = fireproofLog.getItemStack(1, i);
                RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.getFluid(500), fireproofLogStack, new Object[] { " # ", "#X#", " # ", '#', ForestryItem.refractoryWax, 'X', logStack });
            }
        }
        // Fireproof plank recipes
        ForestryBlock plank = ForestryBlock.planks1;
        for (int i = 0; i < 16; i++) {
            ForestryBlock fireproofPlank = BlockFireproofPlanks.getFireproofPlanks((BlockPlanks) plank.block());
            ItemStack plankStack = plank.getItemStack(1, i);
            ItemStack fireproofPlankStack = fireproofPlank.getItemStack(5, i);
            RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.getFluid(500), fireproofPlankStack, new Object[] { "X#X", "#X#", "X#X", '#', ForestryItem.refractoryWax, 'X', plankStack });
        }
        plank = ForestryBlock.planks2;
        for (int i = 0; i < 12; i++) {
            ForestryBlock fireproofPlank = BlockFireproofPlanks.getFireproofPlanks((BlockPlanks) plank.block());
            ItemStack plankStack = plank.getItemStack(1, i);
            ItemStack fireproofPlankStack = fireproofPlank.getItemStack(5, i);
            RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.getFluid(500), fireproofPlankStack, new Object[] { "X#X", "#X#", "X#X", '#', ForestryItem.refractoryWax, 'X', plankStack });
        }
    }
    // / Fireproof Plank recipes
    for (int i = 0; i < 4; i++) {
        Proxies.common.addShapelessRecipe(ForestryBlock.fireproofPlanks1.getItemStack(4, i), ForestryBlock.fireproofLog1.getItemStack(1, i));
    }
    for (int i = 0; i < 4; i++) {
        Proxies.common.addShapelessRecipe(ForestryBlock.fireproofPlanks1.getItemStack(4, 4 + i), ForestryBlock.fireproofLog2.getItemStack(1, i));
    }
    for (int i = 0; i < 4; i++) {
        Proxies.common.addShapelessRecipe(ForestryBlock.fireproofPlanks1.getItemStack(4, 8 + i), ForestryBlock.fireproofLog3.getItemStack(1, i));
    }
    for (int i = 0; i < 4; i++) {
        Proxies.common.addShapelessRecipe(ForestryBlock.fireproofPlanks1.getItemStack(4, 12 + i), ForestryBlock.fireproofLog4.getItemStack(1, i));
    }
    for (int i = 0; i < 4; i++) {
        Proxies.common.addShapelessRecipe(ForestryBlock.fireproofPlanks2.getItemStack(4, i), ForestryBlock.fireproofLog5.getItemStack(1, i));
    }
    for (int i = 0; i < 4; i++) {
        Proxies.common.addShapelessRecipe(ForestryBlock.fireproofPlanks2.getItemStack(4, 4 + i), ForestryBlock.fireproofLog6.getItemStack(1, i));
    }
    for (int i = 0; i < 4; i++) {
        Proxies.common.addShapelessRecipe(ForestryBlock.fireproofPlanks2.getItemStack(4, 8 + i), ForestryBlock.fireproofLog7.getItemStack(1, i));
    }
    for (int i = 0; i < 1; i++) {
        Proxies.common.addShapelessRecipe(ForestryBlock.fireproofPlanks2.getItemStack(4, 12 + i), ForestryBlock.fireproofLog8.getItemStack(1, i));
    }
    // Slab recipes
    for (WoodType woodType : WoodType.values()) {
        int i = woodType.ordinal();
        if (i < 8) {
            Proxies.common.addPriorityRecipe(ForestryBlock.slabs1.getItemStack(6, i % 8), "###", '#', ForestryBlock.planks1.getItemStack(1, i % 16));
        } else if (i < 16) {
            Proxies.common.addPriorityRecipe(ForestryBlock.slabs2.getItemStack(6, i % 8), "###", '#', ForestryBlock.planks1.getItemStack(1, i % 16));
        } else if (i < 24) {
            Proxies.common.addPriorityRecipe(ForestryBlock.slabs3.getItemStack(6, i % 8), "###", '#', ForestryBlock.planks2.getItemStack(1, i % 16));
        } else if (i < 32) {
            Proxies.common.addPriorityRecipe(ForestryBlock.slabs4.getItemStack(6, i % 8), "###", '#', ForestryBlock.planks2.getItemStack(1, i % 16));
        } else {
            throw new RuntimeException("Wood type has no slabs defined");
        }
    }
    // Fence recipes
    for (WoodType woodType : WoodType.values()) {
        int i = woodType.ordinal();
        if (i < 16) {
            Proxies.common.addRecipe(ForestryBlock.fences1.getItemStack(4, i % 16), "###", "# #", '#', ForestryBlock.planks1.getItemStack(1, i % 16));
        } else if (i < 32) {
            Proxies.common.addRecipe(ForestryBlock.fences2.getItemStack(4, i % 16), "###", "# #", '#', ForestryBlock.planks2.getItemStack(1, i % 16));
        } else {
            throw new RuntimeException("Wood type has no fences defined");
        }
    }
    if (PluginManager.Module.FACTORY.isEnabled()) {
        // Treealyzer
        RecipeManagers.carpenterManager.addRecipe(100, Fluids.WATER.getFluid(2000), null, ForestryItem.treealyzer.getItemStack(), "X#X", "X#X", "RDR", '#', Blocks.glass_pane, 'X', "ingotCopper", 'R', Items.redstone, 'D', Items.diamond);
        // SQUEEZER RECIPES
        int seedOilMultiplier = GameMode.getGameMode().getIntegerSetting("squeezer.liquid.seed");
        int juiceMultiplier = GameMode.getGameMode().getIntegerSetting("squeezer.liquid.apple");
        int mulchMultiplier = GameMode.getGameMode().getIntegerSetting("squeezer.mulch.apple");
        RecipeManagers.squeezerManager.addRecipe(20, new ItemStack[] { EnumFruit.CHERRY.getStack() }, Fluids.SEEDOIL.getFluid(5 * seedOilMultiplier), ForestryItem.mulch.getItemStack(), 5);
        RecipeManagers.squeezerManager.addRecipe(60, new ItemStack[] { EnumFruit.WALNUT.getStack() }, Fluids.SEEDOIL.getFluid(18 * seedOilMultiplier), ForestryItem.mulch.getItemStack(), 5);
        RecipeManagers.squeezerManager.addRecipe(70, new ItemStack[] { EnumFruit.CHESTNUT.getStack() }, Fluids.SEEDOIL.getFluid(22 * seedOilMultiplier), ForestryItem.mulch.getItemStack(), 2);
        RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[] { EnumFruit.LEMON.getStack() }, Fluids.JUICE.getFluid(juiceMultiplier * 2), ForestryItem.mulch.getItemStack(), (int) Math.floor(mulchMultiplier * 0.5f));
        RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[] { EnumFruit.PLUM.getStack() }, Fluids.JUICE.getFluid((int) Math.floor(juiceMultiplier * 0.5f)), ForestryItem.mulch.getItemStack(), mulchMultiplier * 3);
        RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[] { EnumFruit.PAPAYA.getStack() }, Fluids.JUICE.getFluid(juiceMultiplier * 3), ForestryItem.mulch.getItemStack(), (int) Math.floor(mulchMultiplier * 0.5f));
        RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[] { EnumFruit.DATES.getStack() }, Fluids.JUICE.getFluid((int) Math.floor(juiceMultiplier * 0.25)), ForestryItem.mulch.getItemStack(), mulchMultiplier);
        RecipeUtil.injectLeveledRecipe(ForestryItem.sapling.getItemStack(), GameMode.getGameMode().getIntegerSetting("fermenter.yield.sapling"), Fluids.BIOMASS);
    }
    // Stairs
    for (WoodType woodType : WoodType.values()) {
        ForestryBlock planks;
        int i = woodType.ordinal();
        if (i < 16) {
            planks = ForestryBlock.planks1;
        } else if (i < 32) {
            planks = ForestryBlock.planks2;
        } else {
            throw new RuntimeException("Wood type has no planks defined");
        }
        NBTTagCompound compound = new NBTTagCompound();
        woodType.saveToCompound(compound);
        ItemStack stairs = ForestryBlock.stairs.getItemStack(4);
        stairs.setTagCompound(compound);
        Proxies.common.addPriorityRecipe(stairs, "#  ", "## ", "###", '#', planks.getItemStack(1, i % 16));
    }
    // Grafter
    Proxies.common.addRecipe(ForestryItem.grafter.getItemStack(), "  B", " # ", "#  ", 'B', "ingotBronze", '#', Items.stick);
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) BlockLog(forestry.arboriculture.gadgets.BlockLog) WoodType(forestry.arboriculture.WoodType) ItemStack(net.minecraft.item.ItemStack) ItemForestryBlock(forestry.core.items.ItemForestryBlock) ForestryBlock(forestry.core.config.ForestryBlock)

Example 3 with WoodType

use of forestry.arboriculture.WoodType in project ForestryMC by ForestryMC.

the class BlockLog method getIcon.

@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta) {
    int oriented = meta & 12;
    WoodType type = getWoodType(meta);
    if (type == null) {
        return null;
    }
    switch(oriented) {
        case 4:
            if (side > 3) {
                return type.getHeartIcon();
            } else {
                return type.getBarkIcon();
            }
        case 8:
            if (side == 2 || side == 3) {
                return type.getHeartIcon();
            } else {
                return type.getBarkIcon();
            }
        case 0:
        default:
            if (side < 2) {
                return type.getHeartIcon();
            } else {
                return type.getBarkIcon();
            }
    }
}
Also used : WoodType(forestry.arboriculture.WoodType) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 4 with WoodType

use of forestry.arboriculture.WoodType in project ForestryMC by ForestryMC.

the class BlockArbStairs method getSubBlocks.

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
    for (WoodType type : WoodType.VALUES) {
        ItemStack stack = new ItemStack(item, 1, 0);
        NBTTagCompound compound = new NBTTagCompound();
        type.saveToCompound(compound);
        stack.setTagCompound(compound);
        list.add(stack);
    }
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) WoodType(forestry.arboriculture.WoodType) ItemStack(net.minecraft.item.ItemStack) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 5 with WoodType

use of forestry.arboriculture.WoodType in project ForestryMC by ForestryMC.

the class ItemWoodBlock method getItemStackDisplayName.

@Override
public String getItemStackDisplayName(ItemStack itemstack) {
    if (this.getBlock() instanceof IWoodTyped) {
        IWoodTyped block = (IWoodTyped) getBlock();
        int meta = itemstack.getItemDamage();
        WoodType woodType = block.getWoodType(meta);
        if (woodType == null) {
            return null;
        }
        String displayName;
        String customUnlocalizedName = block.getBlockKind() + "." + woodType.ordinal() + ".name";
        if (StringUtil.canTranslateTile(customUnlocalizedName)) {
            displayName = StringUtil.localizeTile(customUnlocalizedName);
        } else {
            String woodGrammar = StringUtil.localize(block.getBlockKind() + ".grammar");
            String woodTypeName = StringUtil.localize("trees.woodType." + woodType);
            displayName = woodGrammar.replaceAll("%TYPE", woodTypeName);
        }
        if (this.getBlock() instanceof IWoodFireproof) {
            displayName = StringUtil.localizeAndFormatRaw("tile.for.fireproof", displayName);
        }
        return displayName;
    }
    return super.getItemStackDisplayName(itemstack);
}
Also used : IWoodTyped(forestry.arboriculture.IWoodTyped) WoodType(forestry.arboriculture.WoodType) IWoodFireproof(forestry.arboriculture.IWoodFireproof)

Aggregations

WoodType (forestry.arboriculture.WoodType)5 SideOnly (cpw.mods.fml.relauncher.SideOnly)2 ItemStack (net.minecraft.item.ItemStack)2 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)2 IWoodFireproof (forestry.arboriculture.IWoodFireproof)1 IWoodTyped (forestry.arboriculture.IWoodTyped)1 BlockLog (forestry.arboriculture.gadgets.BlockLog)1 ForestryBlock (forestry.core.config.ForestryBlock)1 ItemForestryBlock (forestry.core.items.ItemForestryBlock)1