Search in sources :

Example 1 with CustomSeedFarmer

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

the class ExU2Util method registerFarmers.

@SubscribeEvent(priority = EventPriority.NORMAL)
public static void registerFarmers(@Nonnull RegistryEvent.Register<IFarmerJoe> event) {
    int count = 0;
    CustomSeedFarmer farmer = FarmersRegistry.addSeed(event, "extrautils2", "enderlilly", "enderlilly");
    if (farmer != null) {
        farmer.setIgnoreGroundCanSustainCheck(true);
        // disables tilling
        farmer.setRequiresTilling(false);
        // extra check needed when not tilling
        farmer.setCheckGroundForFarmland(true);
        // remove farmland
        farmer.clearTilledBlocks();
        farmer.addTilledBlock(Blocks.DIRT);
        farmer.addTilledBlock(Blocks.GRASS);
        farmer.addTilledBlock(Blocks.END_STONE);
        count++;
    }
    farmer = FarmersRegistry.addSeed(event, "extrautils2", "redorchid", "redorchid");
    if (farmer != null) {
        farmer.setIgnoreGroundCanSustainCheck(true);
        // disables tilling
        farmer.setRequiresTilling(false);
        // extra check needed when not tilling
        farmer.setCheckGroundForFarmland(true);
        // remove farmland
        farmer.clearTilledBlocks();
        farmer.addTilledBlock(Blocks.REDSTONE_ORE);
        farmer.addTilledBlock(Blocks.LIT_REDSTONE_ORE);
        count++;
    }
    if (count == 2) {
        Log.info("Farming Station: Extra Utilities 2 integration fully loaded");
    } else if (count == 0) {
        Log.info("Farming Station: Extra Utilities 2 integration not loaded");
    } else {
        Log.info("Farming Station: Extra Utilities 2 integration partially loaded (" + count + " of 2)");
    }
}
Also used : CustomSeedFarmer(crazypants.enderio.base.farming.farmers.CustomSeedFarmer) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 2 with CustomSeedFarmer

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

the class HempFarmerIE method create.

public static HempFarmerIE create() {
    if (Block.REGISTRY.containsKey(new ResourceLocation("ImmersiveEngineering", "hemp"))) {
        Block hempBlock = Block.REGISTRY.getObject(new ResourceLocation("ImmersiveEngineering", "hemp"));
        Item hempSeedItem = Item.REGISTRY.getObject(new ResourceLocation("ImmersiveEngineering", "seed"));
        if (hempSeedItem != null) {
            ItemStack hempSeed = new ItemStack(hempSeedItem);
            return new HempFarmerIE(new CustomSeedFarmer(hempBlock, 4, hempSeed), new StemFarmer(hempBlock, hempSeed));
        }
    }
    return null;
}
Also used : Item(net.minecraft.item.Item) StemFarmer(crazypants.enderio.base.farming.farmers.StemFarmer) CustomSeedFarmer(crazypants.enderio.base.farming.farmers.CustomSeedFarmer) ResourceLocation(net.minecraft.util.ResourceLocation) Block(net.minecraft.block.Block) ItemStack(net.minecraft.item.ItemStack)

Example 3 with CustomSeedFarmer

use of crazypants.enderio.base.farming.farmers.CustomSeedFarmer 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)

Example 4 with CustomSeedFarmer

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

the class FarmersRegistry method addSeed.

public static CustomSeedFarmer addSeed(@Nonnull RegistryEvent.Register<IFarmerJoe> event, @Nonnull String mod, @Nonnull String blockName, @Nonnull String itemName, Block... extraFarmland) {
    Block cropBlock = findBlock(mod, blockName);
    Item seedItem = findItem(mod, itemName);
    if (cropBlock != null && seedItem != null) {
        CustomSeedFarmer farmer = new CustomSeedFarmer(cropBlock, new ItemStack(seedItem));
        if (extraFarmland != null) {
            for (Block farmland : extraFarmland) {
                if (farmland != null) {
                    farmer.addTilledBlock(farmland);
                }
            }
        }
        event.getRegistry().register(farmer.setRegistryName(mod, blockName));
        return farmer;
    }
    return null;
}
Also used : Item(net.minecraft.item.Item) CustomSeedFarmer(crazypants.enderio.base.farming.farmers.CustomSeedFarmer) Block(net.minecraft.block.Block) ItemStack(net.minecraft.item.ItemStack)

Aggregations

CustomSeedFarmer (crazypants.enderio.base.farming.farmers.CustomSeedFarmer)4 ItemStack (net.minecraft.item.ItemStack)3 StemFarmer (crazypants.enderio.base.farming.farmers.StemFarmer)2 Block (net.minecraft.block.Block)2 Item (net.minecraft.item.Item)2 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)2 ChorusFarmer (crazypants.enderio.base.farming.farmers.ChorusFarmer)1 CocoaFarmer (crazypants.enderio.base.farming.farmers.CocoaFarmer)1 FlowerPicker (crazypants.enderio.base.farming.farmers.FlowerPicker)1 MelonFarmer (crazypants.enderio.base.farming.farmers.MelonFarmer)1 TreeFarmer (crazypants.enderio.base.farming.farmers.TreeFarmer)1 ResourceLocation (net.minecraft.util.ResourceLocation)1