Search in sources :

Example 1 with FertilizerForestry

use of powercrystals.minefactoryreloaded.modhelpers.forestry.fertilizer.FertilizerForestry in project MineFactoryReloaded by powercrystals.

the class Forestry method load.

@Init
public static void load(FMLInitializationEvent e) {
    if (!Loader.isModLoaded("Forestry")) {
        FMLLog.warning("Forestry missing - MFR Forestry Compat not loading");
        return;
    }
    try {
        Class<?> forestryItems = Class.forName("forestry.core.config.ForestryItem");
        if (forestryItems != null) {
            Item peat = (Item) forestryItems.getField("peat").get(null);
            MFRRegistry.registerSludgeDrop(5, new ItemStack(peat));
        }
        MFRRegistry.registerPlantable(new PlantableForestryTree());
        MFRRegistry.registerFertilizable(new FertilizableForestryTree());
        for (Field f : Class.forName("forestry.core.config.ForestryBlock").getDeclaredFields()) {
            if (f.getName().contains("log")) {
                Block log = ((Block) f.get(null));
                if (log != null) {
                    MFRRegistry.registerHarvestable(new HarvestableForestryTree(log.blockID));
                    MFRRegistry.registerFruitLogBlockId(log.blockID);
                }
            } else if (f.getName().contains("leaves")) {
                Block leaves = ((Block) f.get(null));
                if (leaves != null) {
                    MFRRegistry.registerFruit(new FruitForestry(leaves.blockID));
                    MFRRegistry.registerFertilizable(new FertilizableForestryLeaves(leaves.blockID));
                }
            } else if (f.getName().contains("pods")) {
                Block pods = ((Block) f.get(null));
                if (pods != null) {
                    MFRRegistry.registerFruit(new FruitForestryPod(pods.blockID));
                    MFRRegistry.registerFertilizable(new FertilizableForestryPods(pods.blockID));
                }
            }
        }
        MFRRegistry.registerFertilizer(new FertilizerForestry(ForestryUtils.getItem("fertilizerCompound")));
    } catch (Exception x) {
        x.printStackTrace();
    }
}
Also used : FertilizableForestryTree(powercrystals.minefactoryreloaded.modhelpers.forestry.trees.FertilizableForestryTree) FruitForestryPod(powercrystals.minefactoryreloaded.modhelpers.forestry.pods.FruitForestryPod) FertilizableForestryPods(powercrystals.minefactoryreloaded.modhelpers.forestry.pods.FertilizableForestryPods) FertilizerForestry(powercrystals.minefactoryreloaded.modhelpers.forestry.fertilizer.FertilizerForestry) Item(net.minecraft.item.Item) Field(java.lang.reflect.Field) FruitForestry(powercrystals.minefactoryreloaded.modhelpers.forestry.leaves.FruitForestry) PlantableForestryTree(powercrystals.minefactoryreloaded.modhelpers.forestry.trees.PlantableForestryTree) Block(net.minecraft.block.Block) ItemStack(net.minecraft.item.ItemStack) HarvestableForestryTree(powercrystals.minefactoryreloaded.modhelpers.forestry.trees.HarvestableForestryTree) FertilizableForestryLeaves(powercrystals.minefactoryreloaded.modhelpers.forestry.leaves.FertilizableForestryLeaves) Init(cpw.mods.fml.common.Mod.Init) PostInit(cpw.mods.fml.common.Mod.PostInit)

Aggregations

Init (cpw.mods.fml.common.Mod.Init)1 PostInit (cpw.mods.fml.common.Mod.PostInit)1 Field (java.lang.reflect.Field)1 Block (net.minecraft.block.Block)1 Item (net.minecraft.item.Item)1 ItemStack (net.minecraft.item.ItemStack)1 FertilizerForestry (powercrystals.minefactoryreloaded.modhelpers.forestry.fertilizer.FertilizerForestry)1 FertilizableForestryLeaves (powercrystals.minefactoryreloaded.modhelpers.forestry.leaves.FertilizableForestryLeaves)1 FruitForestry (powercrystals.minefactoryreloaded.modhelpers.forestry.leaves.FruitForestry)1 FertilizableForestryPods (powercrystals.minefactoryreloaded.modhelpers.forestry.pods.FertilizableForestryPods)1 FruitForestryPod (powercrystals.minefactoryreloaded.modhelpers.forestry.pods.FruitForestryPod)1 FertilizableForestryTree (powercrystals.minefactoryreloaded.modhelpers.forestry.trees.FertilizableForestryTree)1 HarvestableForestryTree (powercrystals.minefactoryreloaded.modhelpers.forestry.trees.HarvestableForestryTree)1 PlantableForestryTree (powercrystals.minefactoryreloaded.modhelpers.forestry.trees.PlantableForestryTree)1