Search in sources :

Example 1 with BlockRegistryFarming

use of forestry.farming.blocks.BlockRegistryFarming in project ForestryMC by ForestryMC.

the class ModuleFarming method preInit.

@Override
public void preInit() {
    ItemRegistryCore coreItems = ModuleCore.getItems();
    BlockRegistryFarming blocks = getBlocks();
    MinecraftForge.EVENT_BUS.register(this);
    IFarmRegistry registry = ForestryAPI.farmRegistry;
    registry.registerFarmables("farmArboreal", new FarmableVanillaSapling());
    if (ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.ARBORICULTURE))) {
        registry.registerFarmables("farmArboreal", new FarmableGE());
    }
    registry.registerFarmables("farmCrops", new FarmableAgingCrop(new ItemStack(Items.WHEAT_SEEDS), Blocks.WHEAT, BlockCrops.AGE, 7, 0), new FarmableAgingCrop(new ItemStack(Items.POTATO), Blocks.POTATOES, BlockCrops.AGE, 7, 0), new FarmableAgingCrop(new ItemStack(Items.CARROT), Blocks.CARROTS, BlockCrops.AGE, 7, 0), new FarmableAgingCrop(new ItemStack(Items.BEETROOT_SEEDS), Blocks.BEETROOTS, BlockBeetroot.BEETROOT_AGE, 3, 0));
    IBlockState plantedBrownMushroom = blocks.mushroom.getDefaultState().withProperty(BlockMushroom.VARIANT, BlockMushroom.MushroomType.BROWN);
    registry.registerFarmables("farmShroom", new FarmableVanillaMushroom(new ItemStack(Blocks.BROWN_MUSHROOM), plantedBrownMushroom, Blocks.BROWN_MUSHROOM_BLOCK));
    IBlockState plantedRedMushroom = blocks.mushroom.getDefaultState().withProperty(BlockMushroom.VARIANT, BlockMushroom.MushroomType.RED);
    registry.registerFarmables("farmShroom", new FarmableVanillaMushroom(new ItemStack(Blocks.RED_MUSHROOM), plantedRedMushroom, Blocks.RED_MUSHROOM_BLOCK));
    registry.registerFarmables("farmGourd", new FarmableGourd(new ItemStack(Items.PUMPKIN_SEEDS), Blocks.PUMPKIN_STEM, Blocks.PUMPKIN));
    registry.registerFarmables("farmGourd", new FarmableGourd(new ItemStack(Items.MELON_SEEDS), Blocks.MELON_STEM, Blocks.MELON_BLOCK));
    registry.registerFarmables("farmInfernal", new FarmableAgingCrop(new ItemStack(Items.NETHER_WART), Blocks.NETHER_WART, BlockNetherWart.AGE, 3));
    registry.registerFarmables("farmPoales", new FarmableStacked(new ItemStack(Items.REEDS), Blocks.REEDS, 3));
    registry.registerFarmables("farmSucculentes", new FarmableStacked(new ItemStack(Blocks.CACTUS), Blocks.CACTUS, 3));
    registry.registerFarmables("farmEnder", FarmableChorus.INSTANCE);
    // Forestry fertilizer
    registry.registerFertilizer(new ItemStack(coreItems.fertilizerCompound, 1, OreDictionary.WILDCARD_VALUE), 500);
    proxy.initializeModels();
    // Layouts
    ICircuitLayout layoutManaged = new CircuitLayout("farms.managed", CircuitSocketType.FARM);
    ChipsetManager.circuitRegistry.registerLayout(layoutManaged);
    ICircuitLayout layoutManual = new CircuitLayout("farms.manual", CircuitSocketType.FARM);
    ChipsetManager.circuitRegistry.registerLayout(layoutManual);
}
Also used : BlockRegistryFarming(forestry.farming.blocks.BlockRegistryFarming) FarmableGE(forestry.farming.logic.farmables.FarmableGE) IBlockState(net.minecraft.block.state.IBlockState) FarmableVanillaSapling(forestry.farming.logic.farmables.FarmableVanillaSapling) ICircuitLayout(forestry.api.circuits.ICircuitLayout) CircuitLayout(forestry.core.circuits.CircuitLayout) FarmableStacked(forestry.farming.logic.farmables.FarmableStacked) FarmableVanillaMushroom(forestry.farming.logic.farmables.FarmableVanillaMushroom) ICircuitLayout(forestry.api.circuits.ICircuitLayout) ItemRegistryCore(forestry.core.items.ItemRegistryCore) ResourceLocation(net.minecraft.util.ResourceLocation) FarmableGourd(forestry.farming.logic.farmables.FarmableGourd) IFarmRegistry(forestry.api.farming.IFarmRegistry) FarmableAgingCrop(forestry.farming.logic.farmables.FarmableAgingCrop) ItemStack(net.minecraft.item.ItemStack)

Example 2 with BlockRegistryFarming

use of forestry.farming.blocks.BlockRegistryFarming in project ForestryMC by ForestryMC.

the class ModuleFarming method registerRecipes.

@Override
public void registerRecipes() {
    ItemRegistryCore coreItems = ModuleCore.getItems();
    BlockRegistryFarming blocks = getBlocks();
    ItemStack basic = blocks.farm.get(EnumFarmBlockType.PLAIN, 1);
    ItemStack gearbox = blocks.farm.get(EnumFarmBlockType.GEARBOX, 1);
    ItemStack hatch = blocks.farm.get(EnumFarmBlockType.HATCH, 1);
    ItemStack valve = blocks.farm.get(EnumFarmBlockType.VALVE, 1);
    ItemStack control = blocks.farm.get(EnumFarmBlockType.CONTROL, 1);
    for (EnumFarmBlockTexture block : EnumFarmBlockTexture.values()) {
        NBTTagCompound compound = new NBTTagCompound();
        block.saveToCompound(compound);
        basic.setTagCompound(compound);
        gearbox.setTagCompound(compound);
        hatch.setTagCompound(compound);
        valve.setTagCompound(compound);
        control.setTagCompound(compound);
        RecipeUtil.addRecipe("farm_basic_" + block.getUid(), basic, "I#I", "WCW", '#', block.getBase(), 'W', "slabWood", 'C', coreItems.tubes.get(EnumElectronTube.TIN, 1), 'I', "ingotCopper");
        RecipeUtil.addRecipe("farm_gearbox_" + block.getUid(), gearbox, " # ", "TTT", '#', basic, 'T', "gearTin");
        RecipeUtil.addRecipe("farm_hatch_" + block.getUid(), hatch, " # ", "TDT", '#', basic, 'T', "gearTin", 'D', OreDictUtil.TRAPDOOR_WOOD);
        RecipeUtil.addRecipe("farm_valve_" + block.getUid(), valve, " # ", "XTX", '#', basic, 'T', "gearTin", 'X', "blockGlass");
        RecipeUtil.addRecipe("farm_control_" + block.getUid(), control, " # ", "XTX", '#', basic, 'T', coreItems.tubes.get(EnumElectronTube.GOLD, 1), 'X', "dustRedstone");
    }
    // Circuits
    ICircuitLayout layoutManaged = ChipsetManager.circuitRegistry.getLayout("forestry.farms.managed");
    ICircuitLayout layoutManual = ChipsetManager.circuitRegistry.getLayout("forestry.farms.manual");
    ChipsetManager.circuitRegistry.registerDeprecatedCircuitReplacement("managedCereal", Circuits.farmCropsManaged);
    ChipsetManager.circuitRegistry.registerDeprecatedCircuitReplacement("manualCereal", Circuits.farmCropsManual);
    ChipsetManager.circuitRegistry.registerDeprecatedCircuitReplacement("managedVegetable", Circuits.farmCropsManaged);
    ChipsetManager.circuitRegistry.registerDeprecatedCircuitReplacement("manualVegetable", Circuits.farmCropsManual);
    if (layoutManaged == null || layoutManual == null) {
        return;
    }
    ChipsetManager.solderManager.addRecipe(layoutManaged, coreItems.tubes.get(EnumElectronTube.GOLD, 1), Circuits.farmArborealManaged);
    ChipsetManager.solderManager.addRecipe(layoutManaged, coreItems.tubes.get(EnumElectronTube.COPPER, 1), Circuits.farmSucculentManaged);
    ChipsetManager.solderManager.addRecipe(layoutManaged, coreItems.tubes.get(EnumElectronTube.OBSIDIAN, 1), Circuits.farmPeatManaged);
    ChipsetManager.solderManager.addRecipe(layoutManaged, coreItems.tubes.get(EnumElectronTube.BRONZE, 1), Circuits.farmCropsManaged);
    ChipsetManager.solderManager.addRecipe(layoutManaged, coreItems.tubes.get(EnumElectronTube.BLAZE, 1), Circuits.farmInfernalManaged);
    ChipsetManager.solderManager.addRecipe(layoutManaged, coreItems.tubes.get(EnumElectronTube.TIN, 1), Circuits.farmPoalesManual);
    ChipsetManager.solderManager.addRecipe(layoutManaged, coreItems.tubes.get(EnumElectronTube.LAPIS, 1), Circuits.farmGourdManaged);
    ChipsetManager.solderManager.addRecipe(layoutManaged, coreItems.tubes.get(EnumElectronTube.APATITE, 1), Circuits.farmShroomManaged);
    ChipsetManager.solderManager.addRecipe(layoutManaged, coreItems.tubes.get(EnumElectronTube.DIAMOND, 1), Circuits.farmCocoaManaged);
    ChipsetManager.solderManager.addRecipe(layoutManaged, coreItems.tubes.get(EnumElectronTube.EMERALD, 1), Circuits.farmOrchardManaged);
    ChipsetManager.solderManager.addRecipe(layoutManaged, coreItems.tubes.get(EnumElectronTube.ENDER, 1), Circuits.farmEnderManaged);
    ChipsetManager.solderManager.addRecipe(layoutManual, coreItems.tubes.get(EnumElectronTube.GOLD, 1), Circuits.farmArborealManual);
    ChipsetManager.solderManager.addRecipe(layoutManual, coreItems.tubes.get(EnumElectronTube.COPPER, 1), Circuits.farmSucculentManual);
    ChipsetManager.solderManager.addRecipe(layoutManual, coreItems.tubes.get(EnumElectronTube.OBSIDIAN, 1), Circuits.farmPeatManual);
    ChipsetManager.solderManager.addRecipe(layoutManual, coreItems.tubes.get(EnumElectronTube.BRONZE, 1), Circuits.farmCropsManual);
    ChipsetManager.solderManager.addRecipe(layoutManual, coreItems.tubes.get(EnumElectronTube.TIN, 1), Circuits.farmPoalesManual);
    ChipsetManager.solderManager.addRecipe(layoutManual, coreItems.tubes.get(EnumElectronTube.LAPIS, 1), Circuits.farmGourdManual);
    ChipsetManager.solderManager.addRecipe(layoutManual, coreItems.tubes.get(EnumElectronTube.APATITE, 1), Circuits.farmShroomManual);
    ChipsetManager.solderManager.addRecipe(layoutManual, coreItems.tubes.get(EnumElectronTube.DIAMOND, 1), Circuits.farmCocoaManual);
    ChipsetManager.solderManager.addRecipe(layoutManual, coreItems.tubes.get(EnumElectronTube.EMERALD, 1), Circuits.farmOrchardManual);
    ChipsetManager.solderManager.addRecipe(layoutManual, coreItems.tubes.get(EnumElectronTube.ENDER, 1), Circuits.farmEnderManual);
}
Also used : BlockRegistryFarming(forestry.farming.blocks.BlockRegistryFarming) ICircuitLayout(forestry.api.circuits.ICircuitLayout) ItemRegistryCore(forestry.core.items.ItemRegistryCore) EnumFarmBlockTexture(forestry.farming.models.EnumFarmBlockTexture) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) ItemStack(net.minecraft.item.ItemStack)

Example 3 with BlockRegistryFarming

use of forestry.farming.blocks.BlockRegistryFarming in project ForestryMC by ForestryMC.

the class FarmingJeiPlugin method registerItemSubtypes.

@Override
public void registerItemSubtypes(ISubtypeRegistry subtypeRegistry) {
    if (!ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.FARMING))) {
        return;
    }
    BlockRegistryFarming blocks = ModuleFarming.getBlocks();
    Item farmBlock = Item.getItemFromBlock(blocks.farm);
    subtypeRegistry.registerSubtypeInterpreter(farmBlock, itemStack -> {
        NBTTagCompound nbt = itemStack.getTagCompound();
        EnumFarmBlockTexture texture = EnumFarmBlockTexture.getFromCompound(nbt);
        return itemStack.getItemDamage() + "." + texture.getUid();
    });
}
Also used : Item(net.minecraft.item.Item) BlockRegistryFarming(forestry.farming.blocks.BlockRegistryFarming) EnumFarmBlockTexture(forestry.farming.models.EnumFarmBlockTexture) ResourceLocation(net.minecraft.util.ResourceLocation) NBTTagCompound(net.minecraft.nbt.NBTTagCompound)

Aggregations

BlockRegistryFarming (forestry.farming.blocks.BlockRegistryFarming)3 ICircuitLayout (forestry.api.circuits.ICircuitLayout)2 ItemRegistryCore (forestry.core.items.ItemRegistryCore)2 EnumFarmBlockTexture (forestry.farming.models.EnumFarmBlockTexture)2 ItemStack (net.minecraft.item.ItemStack)2 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)2 ResourceLocation (net.minecraft.util.ResourceLocation)2 IFarmRegistry (forestry.api.farming.IFarmRegistry)1 CircuitLayout (forestry.core.circuits.CircuitLayout)1 FarmableAgingCrop (forestry.farming.logic.farmables.FarmableAgingCrop)1 FarmableGE (forestry.farming.logic.farmables.FarmableGE)1 FarmableGourd (forestry.farming.logic.farmables.FarmableGourd)1 FarmableStacked (forestry.farming.logic.farmables.FarmableStacked)1 FarmableVanillaMushroom (forestry.farming.logic.farmables.FarmableVanillaMushroom)1 FarmableVanillaSapling (forestry.farming.logic.farmables.FarmableVanillaSapling)1 IBlockState (net.minecraft.block.state.IBlockState)1 Item (net.minecraft.item.Item)1