Search in sources :

Example 1 with PlantableCropPlant

use of powercrystals.minefactoryreloaded.farmables.plantables.PlantableCropPlant in project MineFactoryReloaded by powercrystals.

the class Chococraft method load.

@Mod.Init
public void load(FMLInitializationEvent event) {
    if (!Loader.isModLoaded("chococraft")) {
        FMLLog.info("Chococraft is not available; MFR Chococraft Compat not loaded");
        return;
    }
    try {
        Class<?> mod = Class.forName("chococraft.common.ModChocoCraft");
        FMLLog.info("Registering Gysahls for Planter/Harvester/Fertilizer");
        int blockId = ((Block) (mod.getField("gysahlStemBlock").get(null))).blockID;
        int seedId = ((Item) (mod.getField("gysahlSeedsItem").get(null))).itemID;
        MFRRegistry.registerPlantable(new PlantableCropPlant(seedId, blockId));
        MFRRegistry.registerHarvestable(new HarvestableChococraft(blockId));
        MFRRegistry.registerFertilizable(new FertilizableChococraft(blockId));
        // Chocobo List
        FMLLog.info("Registering Chocobos for Grinder...");
        final String[] chocobos = { "Black", "Blue", "Gold", "Green", "Pink", "Purple", "Red", "White", "Yellow" };
        int legItem = ((Item) (mod.getField("chocoboLegRawItem").get(null))).itemID;
        int featherItem = ((Item) (mod.getField("chocoboFeatherItem").get(null))).itemID;
        for (String name : chocobos) {
            try {
                Class<?> chocoboClass = Class.forName(String.format("chococraft.common.entities.colours.EntityChocobo%s", name));
                MFRRegistry.registerGrindable(new GrindableChocobo(chocoboClass, legItem, featherItem));
            } catch (ClassNotFoundException e) {
                FMLLog.warning(String.format("Entity class for the %s Chocobo could not be found", name));
            }
        }
    } catch (ClassNotFoundException e) {
        FMLLog.warning("Unable to load support for Chococraft");
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : Item(net.minecraft.item.Item) PlantableCropPlant(powercrystals.minefactoryreloaded.farmables.plantables.PlantableCropPlant) Block(net.minecraft.block.Block)

Example 2 with PlantableCropPlant

use of powercrystals.minefactoryreloaded.farmables.plantables.PlantableCropPlant in project MineFactoryReloaded by powercrystals.

the class Pam method registerPamMod.

private static void registerPamMod(String modName, String cropName, Category category, boolean isPerennial, boolean hasWild, int plantableBlockId) {
    try {
        Class<?> mod;
        int blockIdCrop;
        int blockIdWild;
        int seedId;
        final String cropNameLC;
        cropNameLC = cropName.toLowerCase();
        final String baseClassPath;
        baseClassPath = String.format("mods.PamHarvestCraft.%s.%s", category.getPackageName(), modName.toLowerCase());
        mod = Class.forName(String.format("%s.PamHC%s", baseClassPath, modName));
        blockIdCrop = ((Block) mod.getField(String.format("pam%sCrop", cropNameLC)).get(null)).blockID;
        seedId = ((Item) mod.getField(String.format("%sseedItem", cropNameLC)).get(null)).itemID;
        if (plantableBlockId == Block.tilledField.blockID) {
            MFRRegistry.registerPlantable(new PlantableCropPlant(seedId, blockIdCrop));
        } else {
            MFRRegistry.registerPlantable(new PlantablePamSpecial(blockIdCrop, seedId, plantableBlockId));
        }
        if (hasWild) {
            blockIdWild = ((Block) mod.getField(String.format("pam%sWild", cropNameLC)).get(null)).blockID;
            MFRRegistry.registerHarvestable(new HarvestableStandard(blockIdWild, HarvestType.Normal));
        }
        if (isPerennial) {
            MFRRegistry.registerHarvestable(new HarvestablePamsPerennial(blockIdCrop));
        } else {
            MFRRegistry.registerHarvestable(new HarvestablePams(blockIdCrop));
        }
        MFRRegistry.registerFertilizable(new FertilizableCropReflection(blockIdCrop, Class.forName(String.format(isPerennial ? "mods.PamHarvestCraft.BlockPamRegrowCrop" : "mods.PamHarvestCraft.BlockPamCrop")).getMethod("fertilize", World.class, int.class, int.class, int.class), 7));
    } catch (ClassNotFoundException x) {
        FMLLog.warning("Unable to load Pam support for %s", modName);
    } catch (Exception x) {
        x.printStackTrace();
    }
}
Also used : HarvestableStandard(powercrystals.minefactoryreloaded.farmables.harvestables.HarvestableStandard) FertilizableCropReflection(powercrystals.minefactoryreloaded.modhelpers.FertilizableCropReflection) PlantableCropPlant(powercrystals.minefactoryreloaded.farmables.plantables.PlantableCropPlant)

Example 3 with PlantableCropPlant

use of powercrystals.minefactoryreloaded.farmables.plantables.PlantableCropPlant in project MineFactoryReloaded by powercrystals.

the class Pam method load.

@Init
public static void load(FMLInitializationEvent e) {
    if (!Loader.isModLoaded("PamHarvestCraft")) {
        FMLLog.warning("Pam's HC base missing - MFR Pam HC Compat not loading");
    } else {
        // Bushes
        registerBush("Blackberry", true, true);
        registerBush("Blueberry", true, true);
        registerBush("Grape", true, true);
        registerBush("Kiwi", true, true);
        registerBush("Raspberry", true, true);
        registerBush("Spiceleaf", true, true);
        registerBush("Strawberry", true, true);
        registerBush("Sunflower", false, true);
        // Crops
        registerCrop("Asparagus", false, false);
        registerCrop("Bean", false, false);
        registerCrop("Beet", false, false);
        registerCrop("Bellpepper", true, false);
        registerCrop("Broccoli", false, false);
        registerCrop("Cantaloupe", true, false);
        registerCrop("Celery", false, false);
        registerCrop("Chilipepper", true, false);
        registerCrop("Coffee", true, false);
        registerCrop("Corn", true, false);
        registerCrop("Cucumber", true, false);
        registerCrop("Eggplant", true, false);
        registerCrop("Garlic", false, false);
        registerCrop("Ginger", false, false);
        registerCrop("Lettuce", false, false);
        registerCrop("Mustard", true, false);
        registerCrop("Onion", false, false);
        registerCrop("Peanut", false, false);
        registerCrop("Peas", true, false);
        registerCrop("Pineapple", false, false);
        registerCrop("Radish", false, false);
        registerCrop("Sweetpotato", false, false);
        registerCrop("Tea", false, false);
        registerCrop("Tomato", true, false);
        registerCrop("Turnip", false, false);
        registerCrop("Zucchini", true, false);
        // misc types
        registerPamMod("Candle", "Candleberry", Category.MISC, true, true, Block.tilledField.blockID);
        registerMisc("Cotton", true, true);
        // plants that require different base soils
        registerPamMod("Rice", "Rice", Category.CROP, false, false, Block.waterStill.blockID);
        registerPamMod("Cranberry", "Cranberry", Category.BUSH, false, true, Block.waterStill.blockID);
        registerPamMod("Whitemushroom", "Whitemushroom", Category.BUSH, false, true, Block.wood.blockID);
        registerPamMod("Rotten", "Rotten", Category.CROP, false, false, Block.slowSand.blockID);
        registerPamMod("Cactusfruit", "Cactusfruit", Category.BUSH, true, true, Block.sand.blockID);
        // fruits
        registerFruit("Apple");
        registerFruit("Avocado");
        registerFruit("Banana");
        registerFruit("Cherry");
        registerFruit("Coconut");
        registerFruit("Lemon");
        registerFruit("Lime");
        registerFruit("Mango");
        registerFruit("Nutmeg");
        registerFruit("Olive");
        registerFruit("Orange");
        registerFruit("Papaya");
        registerFruit("Peach");
        registerFruit("Pear");
        registerFruit("Peppercorn");
        registerFruit("Plum");
        registerFruit("Pomegranate");
        registerFruit("Starfruit");
        registerFruit("Vanillabean");
        registerFruit("Walnut");
        // special case for candle and cinnamon
        registerCandle();
        registerCinnamon();
        try {
            Class<?> mod = Class.forName("mods.PamHarvestCraft.PamHarvestCraft");
            MFRRegistry.registerSludgeDrop(25, new ItemStack((Item) mod.getField("saltItem").get(null)));
        } catch (Exception x) {
            x.printStackTrace();
        }
    }
    if (!Loader.isModLoaded("PamWeeeFlowers")) {
        FMLLog.warning("Pam's Weee! Flowers missing - MFR Pam Weee! Flowers Compat not loading");
    } else {
        String[] flowers = { "White", "Orange", "Magenta", "LightBlue", "Yellow", "Lime", "Pink", "LightGrey", "DarkGrey", "Cyan", "Purple", "Blue", "Brown", "Green", "Red", "Black" };
        try {
            Class<?> mod = Class.forName("mods.PamWeeeFlowers.PamWeeeFlowers");
            MFRRegistry.registerHarvestable(new HarvestableStandard(((Block) mod.getField("pamFlower").get(null)).blockID, HarvestType.Normal));
            for (String flower : flowers) {
                int seedId = ((Item) mod.getField(flower.toLowerCase() + "flowerseedItem").get(null)).itemID;
                int blockId = ((Block) mod.getField("pam" + flower.toLowerCase() + "flowerCrop").get(null)).blockID;
                Method fertilize = Class.forName("mods.PamWeeeFlowers.BlockPamFlowerCrop").getMethod("fertilize", World.class, int.class, int.class, int.class);
                MFRRegistry.registerPlantable(new PlantableCropPlant(seedId, blockId));
                MFRRegistry.registerHarvestable(new HarvestablePams(blockId));
                MFRRegistry.registerFertilizable(new FertilizableCropReflection(blockId, fertilize, 7));
            }
        } catch (ClassNotFoundException x) {
            FMLLog.warning("Unable to load Pam support for Weee! Flowers even though Weee! FLowers was present");
        } catch (Exception x) {
            x.printStackTrace();
        }
    }
}
Also used : Method(java.lang.reflect.Method) Item(net.minecraft.item.Item) HarvestableStandard(powercrystals.minefactoryreloaded.farmables.harvestables.HarvestableStandard) FertilizableCropReflection(powercrystals.minefactoryreloaded.modhelpers.FertilizableCropReflection) PlantableCropPlant(powercrystals.minefactoryreloaded.farmables.plantables.PlantableCropPlant) Block(net.minecraft.block.Block) ItemStack(net.minecraft.item.ItemStack) Init(cpw.mods.fml.common.Mod.Init)

Example 4 with PlantableCropPlant

use of powercrystals.minefactoryreloaded.farmables.plantables.PlantableCropPlant in project MineFactoryReloaded by powercrystals.

the class RP2 method load.

@Init
public static void load(FMLInitializationEvent e) {
    if (!Loader.isModLoaded("RedPowerWorld")) {
        FMLLog.warning("RedPowerWorld missing - MFR RedPower2 Compat not loading");
        return;
    }
    try {
        Class<?> modClass = Class.forName("com.eloraam.redpower.RedPowerWorld");
        int blockIdLeaves = ((Block) modClass.getField("blockLeaves").get(null)).blockID;
        int blockIdLogs = ((Block) modClass.getField("blockLogs").get(null)).blockID;
        int blockIdPlants = ((Block) modClass.getField("blockPlants").get(null)).blockID;
        int blockIdCrops = ((Block) modClass.getField("blockCrops").get(null)).blockID;
        int itemCropSeedId = ((Item) modClass.getField("itemSeeds").get(null)).itemID;
        Method fertilizeMethod = Class.forName("com.eloraam.redpower.world.BlockCustomFlower").getMethod("growTree", World.class, int.class, int.class, int.class);
        MFRRegistry.registerHarvestable(new HarvestableTreeLeaves(blockIdLeaves));
        MFRRegistry.registerHarvestable(new HarvestableStandard(blockIdLogs, HarvestType.Tree));
        MFRRegistry.registerHarvestable(new HarvestableRedPowerPlant(blockIdPlants));
        MFRRegistry.registerHarvestable(new HarvestableRedPowerFlax(blockIdCrops));
        MFRRegistry.registerPlantable(new PlantableStandard(blockIdPlants, blockIdPlants));
        MFRRegistry.registerPlantable(new PlantableCropPlant(itemCropSeedId, blockIdCrops));
        MFRRegistry.registerFertilizable(new FertilizableRedPowerFlax(blockIdCrops));
        MFRRegistry.registerFertilizable(new FertilizableRedPowerRubberTree(blockIdPlants, fertilizeMethod));
    } catch (Exception x) {
        x.printStackTrace();
    }
}
Also used : Method(java.lang.reflect.Method) HarvestableTreeLeaves(powercrystals.minefactoryreloaded.farmables.harvestables.HarvestableTreeLeaves) Item(net.minecraft.item.Item) HarvestableStandard(powercrystals.minefactoryreloaded.farmables.harvestables.HarvestableStandard) PlantableCropPlant(powercrystals.minefactoryreloaded.farmables.plantables.PlantableCropPlant) Block(net.minecraft.block.Block) PlantableStandard(powercrystals.minefactoryreloaded.farmables.plantables.PlantableStandard) Init(cpw.mods.fml.common.Mod.Init)

Example 5 with PlantableCropPlant

use of powercrystals.minefactoryreloaded.farmables.plantables.PlantableCropPlant in project MineFactoryReloaded by powercrystals.

the class MagicalCrops method load.

@Init
public static void load(FMLInitializationEvent e) {
    if (!Loader.isModLoaded("Magical-Crops")) {
        FMLLog.warning("Magical Crops missing - MFR Compat: Magical Crops not loading");
        return;
    }
    try {
        Class<?> mod = Class.forName("magicCrop.mod_mCrops");
        // the various plants are separated by type to make future changes easier (mostly considering magicFertilizer behavior)
        String[] crops = { "Sberry", "Tomato", "Sweetcorn", "Cucum", "Melon", "Bberry", "Rberry", "Grape", "Chil" };
        String[] namedAsMagicalCropButExtendsBlockCrops = { "Nether" };
        String[] magicalCrops = { "Coal", "Dye", "Iron", "Redstone", "Glowstone", "Gold", "Diamond", "Lapis", "Blaze", "Emerald", "Ender", "Gunpowder", "XP", "Copper", "Tin", "Obsidian" };
        String[] soulCrops = { "Cow", "Pigmen", "Skele", "Spider" };
        int seedId;
        int blockId;
        Method fertilize;
        for (String crop : crops) {
            seedId = ((Item) mod.getField("seed" + crop).get(null)).itemID;
            blockId = ((Block) mod.getField("crop" + crop).get(null)).blockID;
            fertilize = Class.forName("magicCrop.crop" + crop).getMethod("func_72272_c_", World.class, int.class, int.class, int.class);
            MFRRegistry.registerPlantable(new PlantableCropPlant(seedId, blockId));
            MFRRegistry.registerHarvestable(new HarvestableCropPlant(blockId, 7));
            MFRRegistry.registerFertilizable(new FertilizableCropReflection(blockId, fertilize, 7));
        }
        for (String crop : namedAsMagicalCropButExtendsBlockCrops) {
            seedId = ((Item) mod.getField("mSeeds" + crop).get(null)).itemID;
            blockId = ((Block) mod.getField("mCrop" + crop).get(null)).blockID;
            fertilize = Class.forName("magicCrop.mCrop" + crop).getMethod("func_72272_c_", World.class, int.class, int.class, int.class);
            MFRRegistry.registerPlantable(new PlantableCropPlant(seedId, blockId));
            MFRRegistry.registerHarvestable(new HarvestableCropPlant(blockId, 7));
            MFRRegistry.registerFertilizable(new FertilizableCropReflection(blockId, fertilize, 7));
        }
        for (String magicalCrop : magicalCrops) {
            seedId = ((Item) mod.getField("mSeeds" + magicalCrop).get(null)).itemID;
            blockId = ((Block) mod.getField("mCrop" + magicalCrop).get(null)).blockID;
            fertilize = Class.forName("magicCrop.mCrop" + magicalCrop).getMethod("fertilize", World.class, int.class, int.class, int.class);
            MFRRegistry.registerPlantable(new PlantableCropPlant(seedId, blockId));
            MFRRegistry.registerHarvestable(new HarvestableCropPlant(blockId, 7));
            MFRRegistry.registerFertilizable(new FertilizableMagicalCropReflection(blockId, fertilize, 7));
        }
        for (String soulCrop : soulCrops) {
            seedId = ((Item) mod.getField("soulSeed" + soulCrop).get(null)).itemID;
            blockId = ((Block) mod.getField("soulCrop" + soulCrop).get(null)).blockID;
            fertilize = Class.forName("magicCrop.soulCrop" + soulCrop).getMethod("fertilize", World.class, int.class, int.class, int.class);
            MFRRegistry.registerPlantable(new PlantableCropPlant(seedId, blockId));
            MFRRegistry.registerHarvestable(new HarvestableCropPlant(blockId, 7));
            MFRRegistry.registerFertilizable(new FertilizableMagicalCropReflection(blockId, fertilize, 7));
        }
        Item magicalFertilizer = (Item) mod.getField("magicFertilizer").get(null);
        if (magicalFertilizer != null) {
            MFRRegistry.registerFertilizer(new FertilizerStandard(magicalFertilizer.itemID, 0, FertilizerType.GrowMagicalCrop));
        }
    } catch (Exception x) {
        FMLLog.warning("Something went wrong in MFR Compat: Magical Crops. Probably Emy's fault.");
        System.out.println("Last updated for " + lastUpdated);
        x.printStackTrace();
    }
}
Also used : Method(java.lang.reflect.Method) World(net.minecraft.world.World) Item(net.minecraft.item.Item) HarvestableCropPlant(powercrystals.minefactoryreloaded.farmables.harvestables.HarvestableCropPlant) FertilizerStandard(powercrystals.minefactoryreloaded.farmables.fertilizables.FertilizerStandard) FertilizableCropReflection(powercrystals.minefactoryreloaded.modhelpers.FertilizableCropReflection) PlantableCropPlant(powercrystals.minefactoryreloaded.farmables.plantables.PlantableCropPlant) Init(cpw.mods.fml.common.Mod.Init)

Aggregations

PlantableCropPlant (powercrystals.minefactoryreloaded.farmables.plantables.PlantableCropPlant)7 Init (cpw.mods.fml.common.Mod.Init)5 Item (net.minecraft.item.Item)5 Block (net.minecraft.block.Block)4 Method (java.lang.reflect.Method)3 HarvestableStandard (powercrystals.minefactoryreloaded.farmables.harvestables.HarvestableStandard)3 FertilizableCropReflection (powercrystals.minefactoryreloaded.modhelpers.FertilizableCropReflection)3 ItemStack (net.minecraft.item.ItemStack)2 EntitySlime (net.minecraft.entity.monster.EntitySlime)1 EntityChicken (net.minecraft.entity.passive.EntityChicken)1 EntityOcelot (net.minecraft.entity.passive.EntityOcelot)1 EntityWolf (net.minecraft.entity.passive.EntityWolf)1 World (net.minecraft.world.World)1 MobDrop (powercrystals.minefactoryreloaded.api.MobDrop)1 Fanout (powercrystals.minefactoryreloaded.circuits.Fanout)1 Noop (powercrystals.minefactoryreloaded.circuits.Noop)1 Passthrough (powercrystals.minefactoryreloaded.circuits.Passthrough)1 PassthroughGated (powercrystals.minefactoryreloaded.circuits.PassthroughGated)1 PassthroughRoundRobin (powercrystals.minefactoryreloaded.circuits.PassthroughRoundRobin)1 AdderAnalog (powercrystals.minefactoryreloaded.circuits.analog.AdderAnalog)1