Search in sources :

Example 1 with IFarmProperties

use of forestry.api.farming.IFarmProperties in project ForestryMC by ForestryMC.

the class PluginIC2 method preInit.

@Override
@Optional.Method(modid = PluginIC2.MOD_ID)
public void preInit() {
    // rubber chain
    rubberWood = IC2Items.getItem("rubber_wood");
    resin = IC2Items.getItem("misc_resource", "resin");
    rubberSapling = IC2Items.getItem("sapling");
    rubber = IC2Items.getItem("crafting", "rubber");
    fertilizer = IC2Items.getItem("crop_res", "fertilizer");
    IFarmProperties rubberFarm = FarmRegistry.getInstance().registerLogic("farmRubber", FarmLogicRubber::new);
    Circuits.farmRubberManual = new CircuitFarmLogic("manualRubber", rubberFarm, true);
    ICircuitLayout layoutEngineTin = new CircuitLayout("engine.tin", CircuitSocketType.ELECTRIC_ENGINE);
    ChipsetManager.circuitRegistry.registerLayout(layoutEngineTin);
    if (fertilizer != null) {
        FarmRegistry.getInstance().registerFertilizer(fertilizer, 250);
    }
}
Also used : FarmLogicRubber(forestry.farming.logic.FarmLogicRubber) ICircuitLayout(forestry.api.circuits.ICircuitLayout) IFarmProperties(forestry.api.farming.IFarmProperties) ICircuitLayout(forestry.api.circuits.ICircuitLayout) CircuitLayout(forestry.core.circuits.CircuitLayout) CircuitFarmLogic(forestry.farming.circuits.CircuitFarmLogic)

Example 2 with IFarmProperties

use of forestry.api.farming.IFarmProperties in project ForestryMC by ForestryMC.

the class PluginNatura method postInit.

/* 
	 * Register soils required by Natura trees. Must run in postInit(), after core PluginFarming has registered FarmingLogic instances
	 */
@Override
public void postInit() {
    IFarmRegistry registry = FarmRegistry.getInstance();
    IFarmProperties mushroomFarm = registry.getProperties("farmShroom");
    IFarmProperties farmArboreal = registry.getProperties("farmArboreal");
    if (farmArboreal != null) {
        farmArboreal.registerSoil(new ItemStack(Blocks.NETHERRACK), Blocks.NETHERRACK.getDefaultState());
    }
    if (mushroomFarm != null) {
        mushroomFarm.registerSoil(new ItemStack(Blocks.NETHERRACK), Blocks.NETHERRACK.getDefaultState());
        mushroomFarm.registerSoil(new ItemStack(Blocks.SOUL_SAND), Blocks.SOUL_SAND.getDefaultState());
    }
}
Also used : IFarmProperties(forestry.api.farming.IFarmProperties) IFarmRegistry(forestry.api.farming.IFarmRegistry) ItemStack(net.minecraft.item.ItemStack)

Example 3 with IFarmProperties

use of forestry.api.farming.IFarmProperties in project ForestryMC by ForestryMC.

the class FarmRegistry method registerLogic.

@Override
public IFarmProperties registerLogic(String identifier, BiFunction<IFarmProperties, Boolean, IFarmLogic> logicFactory, String... farmablesIdentifiers) {
    Set<String> identifiers = new HashSet<>(Arrays.asList(farmablesIdentifiers));
    identifiers.add(identifier);
    IFarmProperties instance = new FarmProperties(logicFactory, identifiers);
    farmInstances.put(identifier, instance);
    return instance;
}
Also used : IFarmProperties(forestry.api.farming.IFarmProperties) FarmProperties(forestry.farming.logic.FarmProperties) IFarmProperties(forestry.api.farming.IFarmProperties) FakeFarmProperties(forestry.farming.logic.FakeFarmProperties) HashSet(java.util.HashSet)

Example 4 with IFarmProperties

use of forestry.api.farming.IFarmProperties in project ForestryMC by ForestryMC.

the class ModuleFarming method doInit.

@Override
public void doInit() {
    // Load config
    File configFile = new File(Forestry.instance.getConfigFolder(), Config.CATEGORY_FARM + ".cfg");
    LocalizedConfiguration config = new LocalizedConfiguration(configFile, "1.0.0");
    FarmRegistry.getInstance().loadConfig(config);
    config.save();
    GameRegistry.registerTileEntity(TileFarmPlain.class, "forestry.Farm");
    GameRegistry.registerTileEntity(TileFarmGearbox.class, "forestry.FarmGearbox");
    GameRegistry.registerTileEntity(TileFarmHatch.class, "forestry.FarmHatch");
    GameRegistry.registerTileEntity(TileFarmValve.class, "forestry.FarmValve");
    GameRegistry.registerTileEntity(TileFarmControl.class, "forestry.FarmControl");
    IFarmRegistry registry = FarmRegistry.getInstance();
    BlockRegistryCore coreBlocks = ModuleCore.getBlocks();
    IFarmProperties arborealFarm = registry.registerLogic("farmArboreal", FarmLogicArboreal::new);
    IFarmProperties cropsFarm = registry.registerLogic("farmCrops", FarmLogicCrops::new);
    IFarmProperties mushroomFarm = registry.registerLogic("farmShroom", FarmLogicMushroom::new);
    IFarmProperties succulentFarm = registry.registerLogic("farmSucculentes", FarmLogicSucculent::new);
    IFarmProperties peatFarm = registry.registerLogic("farmPeat", FarmLogicPeat::new);
    IFarmProperties infernalFarm = registry.registerLogic("farmInfernal", FarmLogicInfernal::new);
    IFarmProperties poalesFarm = registry.registerLogic("farmPoales", FarmLogicReeds::new);
    IFarmProperties orchardFarm = registry.registerLogic("farmOrchard", FarmLogicOrchard::new);
    IFarmProperties gourdFarm = registry.registerLogic("farmGourd", FarmLogicGourd::new);
    IFarmProperties cocoaFarm = registry.registerLogic("farmCocoa", FarmLogicCocoa::new);
    IFarmProperties enderFarm = registry.registerLogic("farmEnder", FarmLogicEnder::new);
    Circuits.farmArborealManaged = new CircuitFarmLogic("managedArboreal", arborealFarm, false);
    Circuits.farmArborealManual = new CircuitFarmLogic("manualArboreal", arborealFarm, true);
    arborealFarm.registerSoil(new ItemStack(Blocks.DIRT), coreBlocks.humus.getDefaultState());
    arborealFarm.registerSoil(new ItemStack(coreBlocks.humus), coreBlocks.humus.getDefaultState());
    Circuits.farmShroomManaged = new CircuitFarmLogic("managedShroom", mushroomFarm, false);
    Circuits.farmShroomManual = new CircuitFarmLogic("manualShroom", mushroomFarm, true);
    mushroomFarm.registerSoil(new ItemStack(Blocks.MYCELIUM), Blocks.MYCELIUM.getDefaultState());
    mushroomFarm.registerSoil(new ItemStack(Blocks.DIRT, 1, 2), Blocks.DIRT.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.PODZOL), true);
    Circuits.farmPeatManaged = new CircuitFarmLogic("managedPeat", peatFarm, false);
    Circuits.farmPeatManual = new CircuitFarmLogic("manualPeat", peatFarm, true);
    peatFarm.registerSoil(coreBlocks.bogEarth.get(BlockBogEarth.SoilType.BOG_EARTH, 1), coreBlocks.bogEarth.getDefaultState());
    Circuits.farmCropsManaged = new CircuitFarmLogic("managedCrops", cropsFarm, false);
    Circuits.farmCropsManual = new CircuitFarmLogic("manualCrops", cropsFarm, true);
    cropsFarm.registerSoil(new ItemStack(Blocks.DIRT), Blocks.FARMLAND.getDefaultState());
    cocoaFarm.registerFarmables("farmWheat");
    Circuits.farmInfernalManaged = new CircuitFarmLogic("managedInfernal", infernalFarm, false);
    Circuits.farmInfernalManual = new CircuitFarmLogic("manualInfernal", infernalFarm, true);
    infernalFarm.registerSoil(new ItemStack(Blocks.SOUL_SAND), Blocks.SOUL_SAND.getDefaultState());
    Circuits.farmOrchardManaged = new CircuitFarmLogic("managedOrchard", orchardFarm, false);
    Circuits.farmOrchardManual = new CircuitFarmLogic("manualOrchard", orchardFarm, true);
    Circuits.farmSucculentManaged = new CircuitFarmLogic("managedSucculent", succulentFarm, false);
    Circuits.farmSucculentManual = new CircuitFarmLogic("manualSucculent", succulentFarm, true);
    succulentFarm.registerSoil(new ItemStack(Blocks.SAND), Blocks.SAND.getDefaultState(), true);
    Circuits.farmPoalesManaged = new CircuitFarmLogic("managedPoales", poalesFarm, false);
    Circuits.farmPoalesManual = new CircuitFarmLogic("manualPoales", poalesFarm, true);
    poalesFarm.registerSoil(new ItemStack(Blocks.SAND), Blocks.SAND.getDefaultState(), true);
    poalesFarm.registerSoil(new ItemStack(Blocks.DIRT), Blocks.DIRT.getDefaultState(), false);
    Circuits.farmGourdManaged = new CircuitFarmLogic("managedGourd", gourdFarm, false);
    Circuits.farmGourdManual = new CircuitFarmLogic("manualGourd", gourdFarm, true);
    Circuits.farmCocoaManaged = new CircuitFarmLogic("managedCocoa", cocoaFarm, false);
    Circuits.farmCocoaManual = new CircuitFarmLogic("manualCocoa", cocoaFarm, true);
    Circuits.farmEnderManaged = new CircuitFarmLogic("managedEnder", enderFarm, false);
    Circuits.farmEnderManual = new CircuitFarmLogic("manualEnder", enderFarm, true);
    enderFarm.registerSoil(new ItemStack(Blocks.END_STONE), Blocks.END_STONE.getDefaultState());
}
Also used : BlockRegistryCore(forestry.core.blocks.BlockRegistryCore) FarmLogicMushroom(forestry.farming.logic.FarmLogicMushroom) FarmLogicGourd(forestry.farming.logic.FarmLogicGourd) IFarmProperties(forestry.api.farming.IFarmProperties) FarmLogicArboreal(forestry.farming.logic.FarmLogicArboreal) FarmLogicSucculent(forestry.farming.logic.FarmLogicSucculent) FarmLogicOrchard(forestry.farming.logic.FarmLogicOrchard) FarmLogicCrops(forestry.farming.logic.FarmLogicCrops) FarmLogicInfernal(forestry.farming.logic.FarmLogicInfernal) FarmLogicPeat(forestry.farming.logic.FarmLogicPeat) CircuitFarmLogic(forestry.farming.circuits.CircuitFarmLogic) FarmLogicReeds(forestry.farming.logic.FarmLogicReeds) LocalizedConfiguration(forestry.core.config.LocalizedConfiguration) FarmLogicEnder(forestry.farming.logic.FarmLogicEnder) IFarmRegistry(forestry.api.farming.IFarmRegistry) FarmLogicCocoa(forestry.farming.logic.FarmLogicCocoa) ItemStack(net.minecraft.item.ItemStack) File(java.io.File)

Example 5 with IFarmProperties

use of forestry.api.farming.IFarmProperties in project ForestryMC by ForestryMC.

the class PluginExtraUtilities method doInit.

@Override
public void doInit() {
    Block redOrchid = getBlock("redorchid");
    Block enderLilly = getBlock("enderlilly");
    if (Config.isExUtilRedOrchidEnabled() && redOrchid != null) {
        Item item = Item.getItemFromBlock(redOrchid);
        registerFarmable(redOrchid, item, "farmOrchid");
        IFarmProperties orchidFarm = FarmRegistry.getInstance().registerLogic("farmOrchid", FarmLogicRedOrchid::new);
        orchidFarm.registerSoil(new ItemStack(Blocks.REDSTONE_ORE), Blocks.REDSTONE_ORE.getDefaultState());
        orchidFarm.registerSoil(new ItemStack(Blocks.LIT_REDSTONE_ORE), Blocks.LIT_REDSTONE_ORE.getDefaultState());
        Circuits.farmOrchidManaged = new CircuitFarmLogic("managedOrchid", orchidFarm, false);
        Circuits.farmOrchidManual = new CircuitFarmLogic("manualOrchid", orchidFarm, true);
        orchidStack = new ItemStack(item);
    }
    if (Config.isExUtilEnderLilyEnabled() && enderLilly != null) {
        Item item = Item.getItemFromBlock(enderLilly);
        registerFarmable(enderLilly, item, "farmEnder");
    }
}
Also used : FarmLogicRedOrchid(forestry.farming.logic.FarmLogicRedOrchid) Item(net.minecraft.item.Item) IFarmProperties(forestry.api.farming.IFarmProperties) Block(net.minecraft.block.Block) ItemStack(net.minecraft.item.ItemStack) CircuitFarmLogic(forestry.farming.circuits.CircuitFarmLogic)

Aggregations

IFarmProperties (forestry.api.farming.IFarmProperties)5 CircuitFarmLogic (forestry.farming.circuits.CircuitFarmLogic)3 ItemStack (net.minecraft.item.ItemStack)3 IFarmRegistry (forestry.api.farming.IFarmRegistry)2 ICircuitLayout (forestry.api.circuits.ICircuitLayout)1 BlockRegistryCore (forestry.core.blocks.BlockRegistryCore)1 CircuitLayout (forestry.core.circuits.CircuitLayout)1 LocalizedConfiguration (forestry.core.config.LocalizedConfiguration)1 FakeFarmProperties (forestry.farming.logic.FakeFarmProperties)1 FarmLogicArboreal (forestry.farming.logic.FarmLogicArboreal)1 FarmLogicCocoa (forestry.farming.logic.FarmLogicCocoa)1 FarmLogicCrops (forestry.farming.logic.FarmLogicCrops)1 FarmLogicEnder (forestry.farming.logic.FarmLogicEnder)1 FarmLogicGourd (forestry.farming.logic.FarmLogicGourd)1 FarmLogicInfernal (forestry.farming.logic.FarmLogicInfernal)1 FarmLogicMushroom (forestry.farming.logic.FarmLogicMushroom)1 FarmLogicOrchard (forestry.farming.logic.FarmLogicOrchard)1 FarmLogicPeat (forestry.farming.logic.FarmLogicPeat)1 FarmLogicRedOrchid (forestry.farming.logic.FarmLogicRedOrchid)1 FarmLogicReeds (forestry.farming.logic.FarmLogicReeds)1