Search in sources :

Example 1 with BlockLog

use of forestry.arboriculture.gadgets.BlockLog in project ForestryMC by ForestryMC.

the class WorldGenTree method getWood.

@Override
public BlockType getWood() {
    ItemStack woodStack = tree.getGenome().getPrimary().getLogStacks()[0];
    Block block = StackUtils.getBlock(woodStack);
    int meta = woodStack.getItemDamage();
    // if we have a fireproof tree, return the fireproof log
    if (block instanceof BlockLog) {
        IAlleleBoolean fireproof = (IAlleleBoolean) tree.getGenome().getActiveAllele(EnumTreeChromosome.FIREPROOF);
        if (fireproof.getValue()) {
            BlockLog blockLog = (BlockLog) block;
            ForestryBlock fireproofLogBlock = BlockFireproofLog.getFireproofLog(blockLog);
            return new BlockType(fireproofLogBlock.block(), meta);
        }
    }
    return new BlockType(block, meta);
}
Also used : IAlleleBoolean(forestry.api.genetics.IAlleleBoolean) BlockType(forestry.core.worldgen.BlockType) Block(net.minecraft.block.Block) ForestryBlock(forestry.core.config.ForestryBlock) BlockLog(forestry.arboriculture.gadgets.BlockLog) ItemStack(net.minecraft.item.ItemStack) ForestryBlock(forestry.core.config.ForestryBlock)

Example 2 with BlockLog

use of forestry.arboriculture.gadgets.BlockLog in project ForestryMC by ForestryMC.

the class PluginArboriculture method preInit.

@Override
public void preInit() {
    super.preInit();
    ForestryBlock.log1.registerBlock(new BlockLog(LogCat.CAT0), ItemWoodBlock.class, "log1");
    ForestryBlock.log2.registerBlock(new BlockLog(LogCat.CAT1), ItemWoodBlock.class, "log2");
    ForestryBlock.log3.registerBlock(new BlockLog(LogCat.CAT2), ItemWoodBlock.class, "log3");
    ForestryBlock.log4.registerBlock(new BlockLog(LogCat.CAT3), ItemWoodBlock.class, "log4");
    ForestryBlock.log5.registerBlock(new BlockLog(LogCat.CAT4), ItemWoodBlock.class, "log5");
    ForestryBlock.log6.registerBlock(new BlockLog(LogCat.CAT5), ItemWoodBlock.class, "log6");
    ForestryBlock.log7.registerBlock(new BlockLog(LogCat.CAT6), ItemWoodBlock.class, "log7");
    ForestryBlock.log8.registerBlock(new BlockLog(LogCat.CAT7), ItemWoodBlock.class, "log8");
    for (ForestryBlock log : logs) {
        log.block().setHarvestLevel("axe", 0);
        OreDictionary.registerOre("logWood", log.getWildcard());
    }
    ForestryBlock.fireproofLog1.registerBlock(new BlockFireproofLog(LogCat.CAT0), ItemWoodBlock.class, "fireproofLog1");
    ForestryBlock.fireproofLog2.registerBlock(new BlockFireproofLog(LogCat.CAT1), ItemWoodBlock.class, "fireproofLog2");
    ForestryBlock.fireproofLog3.registerBlock(new BlockFireproofLog(LogCat.CAT2), ItemWoodBlock.class, "fireproofLog3");
    ForestryBlock.fireproofLog4.registerBlock(new BlockFireproofLog(LogCat.CAT3), ItemWoodBlock.class, "fireproofLog4");
    ForestryBlock.fireproofLog5.registerBlock(new BlockFireproofLog(LogCat.CAT4), ItemWoodBlock.class, "fireproofLog5");
    ForestryBlock.fireproofLog6.registerBlock(new BlockFireproofLog(LogCat.CAT5), ItemWoodBlock.class, "fireproofLog6");
    ForestryBlock.fireproofLog7.registerBlock(new BlockFireproofLog(LogCat.CAT6), ItemWoodBlock.class, "fireproofLog7");
    ForestryBlock.fireproofLog8.registerBlock(new BlockFireproofLog(LogCat.CAT7), ItemWoodBlock.class, "fireproofLog8");
    for (ForestryBlock fireproofLog : fireproofLogs) {
        fireproofLog.block().setHarvestLevel("axe", 0);
        OreDictionary.registerOre("logWood", fireproofLog.getWildcard());
    }
    ForestryBlock.planks1.registerBlock(new BlockPlanks(PlankCat.CAT0), ItemWoodBlock.class, "planks");
    ForestryBlock.planks2.registerBlock(new BlockPlanks(PlankCat.CAT1), ItemWoodBlock.class, "planks2");
    for (ForestryBlock plank : planks) {
        plank.block().setHarvestLevel("axe", 0);
        OreDictionary.registerOre("plankWood", plank.getWildcard());
    }
    ForestryBlock.fireproofPlanks1.registerBlock(new BlockFireproofPlanks(PlankCat.CAT0), ItemWoodBlock.class, "fireproofPlanks1");
    ForestryBlock.fireproofPlanks2.registerBlock(new BlockFireproofPlanks(PlankCat.CAT1), ItemWoodBlock.class, "fireproofPlanks2");
    for (ForestryBlock plank : fireproofPlanks) {
        plank.block().setHarvestLevel("axe", 0);
        OreDictionary.registerOre("plankWood", plank.getWildcard());
    }
    ForestryBlock.slabs1.registerBlock(new BlockSlab(SlabCat.CAT0), ItemWoodBlock.class, "slabs1");
    ForestryBlock.slabs2.registerBlock(new BlockSlab(SlabCat.CAT1), ItemWoodBlock.class, "slabs2");
    ForestryBlock.slabs3.registerBlock(new BlockSlab(SlabCat.CAT2), ItemWoodBlock.class, "slabs3");
    ForestryBlock.slabs4.registerBlock(new BlockSlab(SlabCat.CAT3), ItemWoodBlock.class, "slabs4");
    for (ForestryBlock plank : slabs) {
        plank.block().setHarvestLevel("axe", 0);
        OreDictionary.registerOre("slabWood", plank.getWildcard());
    }
    // Fences
    ForestryBlock.fences1.registerBlock(new BlockArbFence(FenceCat.CAT0), ItemWoodBlock.class, "fences");
    ForestryBlock.fences2.registerBlock(new BlockArbFence(FenceCat.CAT1), ItemWoodBlock.class, "fences2");
    for (ForestryBlock block : fences) {
        block.block().setHarvestLevel("axe", 0);
        OreDictionary.registerOre("fenceWood", block.getWildcard());
    }
    // Stairs
    ForestryBlock.stairs.registerBlock(new BlockArbStairs(ForestryBlock.planks1.block(), 0), ItemStairs.class, "stairs");
    ForestryBlock.stairs.block().setHarvestLevel("axe", 0);
    // Saplings
    ForestryBlock.saplingGE.registerBlock(new BlockSapling(), ItemForestryBlock.class, "saplingGE");
    // Leaves
    ForestryBlock.leaves.registerBlock(new ForestryBlockLeaves(), ItemLeavesBlock.class, "leaves");
    OreDictionary.registerOre("treeLeaves", ForestryBlock.leaves.getWildcard());
    // Pods
    ForestryBlock.pods.registerBlock(new BlockFruitPod(), ItemForestryBlock.class, "pods");
    // Machines
    ForestryBlock.arboriculture.registerBlock(new BlockBase(Material.iron), ItemForestryBlock.class, "arboriculture");
    ForestryBlock.arboriculture.block().setCreativeTab(Tabs.tabArboriculture);
    definitionChest = ((BlockBase) ForestryBlock.arboriculture.block()).addDefinition(new MachineDefinition(Defaults.DEFINITION_ARBCHEST_META, "forestry.ArbChest", TileArboristChest.class, ShapedRecipeCustom.createShapedRecipe(ForestryBlock.arboriculture.getItemStack(1, Defaults.DEFINITION_ARBCHEST_META), " # ", "XYX", "XXX", '#', Blocks.glass, 'X', "treeSapling", 'Y', Blocks.chest)).setFaces(0, 1, 2, 3, 4, 4, 0, 7));
    // Init rendering
    proxy.initializeRendering();
    // Register vanilla and forestry fence ids
    validFences.add(ForestryBlock.fences1.block());
    validFences.add(ForestryBlock.fences2.block());
    validFences.add(Blocks.fence);
    validFences.add(Blocks.fence_gate);
    validFences.add(Blocks.nether_brick_fence);
    // Commands
    PluginCore.rootCommand.addChildCommand(new CommandTree());
    // Create alleles
    createAlleles();
    createMutations();
    registerTemplates();
    registerErsatzGenomes();
}
Also used : MachineDefinition(forestry.core.gadgets.MachineDefinition) ForestryBlockLeaves(forestry.arboriculture.gadgets.ForestryBlockLeaves) TileArboristChest(forestry.arboriculture.gadgets.TileArboristChest) BlockFireproofPlanks(forestry.arboriculture.gadgets.BlockFireproofPlanks) BlockLog(forestry.arboriculture.gadgets.BlockLog) ItemForestryBlock(forestry.core.items.ItemForestryBlock) ForestryBlock(forestry.core.config.ForestryBlock) BlockPlanks(forestry.arboriculture.gadgets.BlockPlanks) BlockArbStairs(forestry.arboriculture.gadgets.BlockArbStairs) BlockBase(forestry.core.gadgets.BlockBase) BlockSlab(forestry.arboriculture.gadgets.BlockSlab) BlockArbFence(forestry.arboriculture.gadgets.BlockArbFence) BlockSapling(forestry.arboriculture.gadgets.BlockSapling) BlockFireproofLog(forestry.arboriculture.gadgets.BlockFireproofLog) CommandTree(forestry.arboriculture.commands.CommandTree) BlockFruitPod(forestry.arboriculture.gadgets.BlockFruitPod)

Example 3 with BlockLog

use of forestry.arboriculture.gadgets.BlockLog 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)

Aggregations

BlockLog (forestry.arboriculture.gadgets.BlockLog)3 ForestryBlock (forestry.core.config.ForestryBlock)3 ItemForestryBlock (forestry.core.items.ItemForestryBlock)2 ItemStack (net.minecraft.item.ItemStack)2 IAlleleBoolean (forestry.api.genetics.IAlleleBoolean)1 WoodType (forestry.arboriculture.WoodType)1 CommandTree (forestry.arboriculture.commands.CommandTree)1 BlockArbFence (forestry.arboriculture.gadgets.BlockArbFence)1 BlockArbStairs (forestry.arboriculture.gadgets.BlockArbStairs)1 BlockFireproofLog (forestry.arboriculture.gadgets.BlockFireproofLog)1 BlockFireproofPlanks (forestry.arboriculture.gadgets.BlockFireproofPlanks)1 BlockFruitPod (forestry.arboriculture.gadgets.BlockFruitPod)1 BlockPlanks (forestry.arboriculture.gadgets.BlockPlanks)1 BlockSapling (forestry.arboriculture.gadgets.BlockSapling)1 BlockSlab (forestry.arboriculture.gadgets.BlockSlab)1 ForestryBlockLeaves (forestry.arboriculture.gadgets.ForestryBlockLeaves)1 TileArboristChest (forestry.arboriculture.gadgets.TileArboristChest)1 BlockBase (forestry.core.gadgets.BlockBase)1 MachineDefinition (forestry.core.gadgets.MachineDefinition)1 BlockType (forestry.core.worldgen.BlockType)1