Search in sources :

Example 1 with TreeFarmer

use of crazypants.enderio.base.farming.farmers.TreeFarmer in project EnderIO by SleepyTrousers.

the class MFRUtil method registerFarmers.

@SubscribeEvent(priority = EventPriority.NORMAL)
public static void registerFarmers(@Nonnull RegistryEvent.Register<IFarmerJoe> event) {
    Block cropBlock = FarmersRegistry.findBlock("minefactoryreloaded", "rubberwood.sapling");
    Block woodBlock = FarmersRegistry.findBlock("minefactoryreloaded", "rubberwood.log");
    if (cropBlock != null && woodBlock != null) {
        event.getRegistry().register(new TreeFarmer(cropBlock, woodBlock).setRegistryName("minefactoryreloaded", "trees"));
        Log.info("Farming Station: MFR integration fully loaded");
    } else {
        Log.info("Farming Station: MFR integration not loaded");
    }
}
Also used : Block(net.minecraft.block.Block) TreeFarmer(crazypants.enderio.base.farming.farmers.TreeFarmer) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 2 with TreeFarmer

use of crazypants.enderio.base.farming.farmers.TreeFarmer in project EnderIO by SleepyTrousers.

the class NaturaUtil method registerFarmers.

@SubscribeEvent(priority = EventPriority.NORMAL)
public static void registerFarmers(@Nonnull RegistryEvent.Register<IFarmerJoe> event) {
    int count = 0;
    Item overworldSeeds = FarmersRegistry.findItem("natura", "overworld_seeds");
    if (overworldSeeds != null) {
        Block barleyBlock = FarmersRegistry.findBlock("natura", "barley_crop");
        Block cottonBlock = FarmersRegistry.findBlock("natura", "cotton_crop");
        if (barleyBlock != null) {
            new PlantableFarmer().addHarvestExlude(barleyBlock);
            event.getRegistry().register(new PickableFarmer(barleyBlock, 0, 3, new ItemStack(overworldSeeds, 1, 0)).setRegistryName("natura", "barley"));
            count++;
        }
        if (cottonBlock != null) {
            new PlantableFarmer().addHarvestExlude(cottonBlock);
            event.getRegistry().register(new PickableFarmer(cottonBlock, 0, 4, new ItemStack(overworldSeeds, 1, 1)).setRegistryName("natura", "cotton"));
            count++;
        }
    }
    NNIterator<String> iterator = new NNList<>("overworld_berrybush_raspberry", "overworld_berrybush_blueberry", "overworld_berrybush_blackberry", "overworld_berrybush_maloberry", "nether_berrybush_blightberry", "nether_berrybush_duskberry", "nether_berrybush_skyberry", "nether_berrybush_stingberry").iterator();
    while (iterator.hasNext()) {
        String berry = iterator.next();
        Block berryBlock = FarmersRegistry.findBlock("natura", berry);
        Item berryItem = FarmersRegistry.findItem("natura", berry);
        if (berryBlock != null && berryItem != null) {
            new PlantableFarmer().addHarvestExlude(berryBlock);
            PickableFarmer farmer = new NaturaBerryFarmer(berryBlock, 0, 3, new ItemStack(berryItem, 1, 0));
            farmer.setRequiresTilling(false);
            event.getRegistry().register(farmer.setRegistryName("natura", "berries"));
            // berry bushes are leaves, idiotic...
            IHarvestingTarget.addLeavesExcemption(berryBlock);
            count++;
        }
    }
    Block shroomSapling = FarmersRegistry.findBlock("natura", "nether_glowshroom");
    Block shroomGreenBlock = FarmersRegistry.findBlock("natura", "nether_green_large_glowshroom");
    Block shroomBlueBlock = FarmersRegistry.findBlock("natura", "nether_blue_large_glowshroom");
    Block shroomPurpleBlock = FarmersRegistry.findBlock("natura", "nether_purple_large_glowshroom");
    if (shroomSapling != null && shroomGreenBlock != null && shroomBlueBlock != null && shroomPurpleBlock != null) {
        final TreeFarmer shroomFarmer = new TreeFarmer(shroomSapling, shroomGreenBlock, shroomBlueBlock, shroomPurpleBlock);
        shroomFarmer.setIgnoreMeta(true);
        event.getRegistry().register(shroomFarmer.setRegistryName("natura", "shroom"));
        count++;
    }
    // TODO add farmer for the whole thing
    FarmersRegistry.registerFlower("block:natura:saguaro_fruit");
    Block saguaroBlock = FarmersRegistry.findBlock("natura", "saguaro");
    Item saguaroBabyItem = FarmersRegistry.findItem("natura", "saguaro_baby");
    if (saguaroBlock != null && saguaroBabyItem != null) {
        event.getRegistry().register(new StemFarmer(saguaroBlock, new ItemStack(saguaroBabyItem)) {

            @Override
            public boolean canHarvest(@Nonnull IFarmer farm, @Nonnull BlockPos bc, @Nonnull Block block, @Nonnull IBlockState meta) {
                return false;
            }
        }.setRegistryName("natura", "saguaro"));
        count++;
    }
    FarmersRegistry.registerFlower("block:natura:bluebells_flower");
    if (count == 12) {
        Log.info("Farming Station: Natura integration fully loaded");
    } else if (count == 0) {
        Log.info("Farming Station: Natura integration not loaded");
    } else {
        Log.info("Farming Station: Natura integration partially loaded (" + count + " of 12)");
    }
}
Also used : StemFarmer(crazypants.enderio.base.farming.farmers.StemFarmer) IBlockState(net.minecraft.block.state.IBlockState) Nonnull(javax.annotation.Nonnull) IFarmer(crazypants.enderio.api.farm.IFarmer) PickableFarmer(crazypants.enderio.base.farming.farmers.PickableFarmer) PlantableFarmer(crazypants.enderio.base.farming.farmers.PlantableFarmer) Item(net.minecraft.item.Item) Block(net.minecraft.block.Block) BlockPos(net.minecraft.util.math.BlockPos) ItemStack(net.minecraft.item.ItemStack) TreeFarmer(crazypants.enderio.base.farming.farmers.TreeFarmer) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 3 with TreeFarmer

use of crazypants.enderio.base.farming.farmers.TreeFarmer in project EnderIO by SleepyTrousers.

the class FarmersRegistry method registerFarmersLow.

@SubscribeEvent(priority = EventPriority.LOW)
public static void registerFarmersLow(@Nonnull RegistryEvent.Register<IFarmerJoe> event) {
    event.getRegistry().register(new FlowerPicker(FLOWERS).setRegistryName(EnderIO.DOMAIN, "flowers"));
    event.getRegistry().register(new StemFarmer(Blocks.REEDS, new ItemStack(Items.REEDS)).setRegistryName(EnderIO.DOMAIN, "reeds"));
    event.getRegistry().register(new StemFarmer(Blocks.CACTUS, new ItemStack(Blocks.CACTUS)).setRegistryName(EnderIO.DOMAIN, "cactus"));
    event.getRegistry().register(new TreeFarmer(SAPLINGS, WOODS).setRegistryName(EnderIO.DOMAIN, "trees"));
    event.getRegistry().register(new TreeFarmer(true, Blocks.RED_MUSHROOM, Blocks.RED_MUSHROOM_BLOCK).setRegistryName(EnderIO.DOMAIN, "red_mushrooms"));
    event.getRegistry().register(new TreeFarmer(true, Blocks.BROWN_MUSHROOM, Blocks.BROWN_MUSHROOM_BLOCK).setRegistryName(EnderIO.DOMAIN, "brown_mushrooms"));
    // special case of plantables to get spacing correct
    event.getRegistry().register(new MelonFarmer(Blocks.MELON_STEM, Blocks.MELON_BLOCK, new ItemStack(Items.MELON_SEEDS)).setRegistryName(EnderIO.DOMAIN, "melons"));
    event.getRegistry().register(new MelonFarmer(Blocks.PUMPKIN_STEM, Blocks.PUMPKIN, new ItemStack(Items.PUMPKIN_SEEDS)).setRegistryName(EnderIO.DOMAIN, "pumpkins"));
    // 'BlockNetherWart' is not an IGrowable
    event.getRegistry().register(new CustomSeedFarmer(Blocks.NETHER_WART, 3, new ItemStack(Items.NETHER_WART)).setRequiresTilling(false).setRegistryName(EnderIO.DOMAIN, "netherwart"));
    // Cocoa is odd
    event.getRegistry().register(new CocoaFarmer().setRegistryName(EnderIO.DOMAIN, "cocoa"));
    // Chorus plant is even odder
    event.getRegistry().register(new ChorusFarmer().setRegistryName(EnderIO.DOMAIN, "chorus"));
}
Also used : StemFarmer(crazypants.enderio.base.farming.farmers.StemFarmer) FlowerPicker(crazypants.enderio.base.farming.farmers.FlowerPicker) CocoaFarmer(crazypants.enderio.base.farming.farmers.CocoaFarmer) CustomSeedFarmer(crazypants.enderio.base.farming.farmers.CustomSeedFarmer) MelonFarmer(crazypants.enderio.base.farming.farmers.MelonFarmer) ChorusFarmer(crazypants.enderio.base.farming.farmers.ChorusFarmer) ItemStack(net.minecraft.item.ItemStack) TreeFarmer(crazypants.enderio.base.farming.farmers.TreeFarmer) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

TreeFarmer (crazypants.enderio.base.farming.farmers.TreeFarmer)3 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)3 StemFarmer (crazypants.enderio.base.farming.farmers.StemFarmer)2 Block (net.minecraft.block.Block)2 ItemStack (net.minecraft.item.ItemStack)2 IFarmer (crazypants.enderio.api.farm.IFarmer)1 ChorusFarmer (crazypants.enderio.base.farming.farmers.ChorusFarmer)1 CocoaFarmer (crazypants.enderio.base.farming.farmers.CocoaFarmer)1 CustomSeedFarmer (crazypants.enderio.base.farming.farmers.CustomSeedFarmer)1 FlowerPicker (crazypants.enderio.base.farming.farmers.FlowerPicker)1 MelonFarmer (crazypants.enderio.base.farming.farmers.MelonFarmer)1 PickableFarmer (crazypants.enderio.base.farming.farmers.PickableFarmer)1 PlantableFarmer (crazypants.enderio.base.farming.farmers.PlantableFarmer)1 Nonnull (javax.annotation.Nonnull)1 IBlockState (net.minecraft.block.state.IBlockState)1 Item (net.minecraft.item.Item)1 BlockPos (net.minecraft.util.math.BlockPos)1