use of forestry.farming.logic.farmables.FarmableAgingCrop in project ForestryMC by ForestryMC.
the class PluginNatura method registerRecipes.
@Override
public void registerRecipes() {
int amount = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.seed");
for (ItemStack seed : seeds) {
RecipeManagers.squeezerManager.addRecipe(10, NonNullList.from(seed, seed), Fluids.SEED_OIL.getFluid(amount));
RecipeManagers.moistenerManager.addRecipe(seed, new ItemStack(Blocks.MYCELIUM), 5000);
}
if (ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.FARMING))) {
cropBlocks.forEach(itemStack -> {
Block block = ItemStackUtil.getBlock(itemStack);
ItemStack seedItem;
int maxAge;
try {
maxAge = (int) block.getClass().getDeclaredMethod("getMaxAge").invoke(block);
seedItem = block.getPickBlock(block.getBlockState().getBaseState(), null, null, null, null);
} catch (Exception ignored) {
return;
}
Log.info("[PluginNatura] Addding crop '{}'", itemStack);
if (seedItem.isEmpty()) {
return;
}
FarmRegistry.getInstance().registerFarmables("farmCrops", new FarmableAgingCrop(seedItem, block, (IProperty<Integer>) block.getBlockState().getProperty("age"), maxAge));
});
}
ItemRegistryCore coreItems = ModuleCore.getItems();
amount = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.apple") / 2;
// Produce at least 1 mb of juice.
final int juiceAmount = Math.max(amount, 1);
ItemStack mulch = coreItems.mulch.getItemStack();
fruits.forEach(fruit -> RecipeManagers.squeezerManager.addRecipe(10, NonNullList.from(fruit, fruit), Fluids.JUICE.getFluid(juiceAmount), mulch, ForestryAPI.activeMode.getIntegerSetting("squeezer.mulch.apple")));
amount = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.apple") / 25;
// Produce at least 1 mb of juice.
amount = Math.max(amount, 1);
for (ItemStack berry : berries) {
RecipeManagers.squeezerManager.addRecipe(3, NonNullList.from(berry, berry), Fluids.JUICE.getFluid(amount));
}
crops.forEach(crop -> {
RecipeUtil.addFermenterRecipes(crop, ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.wheat"), Fluids.BIOMASS);
if (crop.getUnlocalizedName().matches("^.*cotton$")) {
return;
}
int compostWheatAmount = ForestryAPI.activeMode.getIntegerSetting("recipe.output.compost.wheat");
if (compostWheatAmount > 0) {
ItemStack compostWheat = coreItems.fertilizerCompound.getItemStack(compostWheatAmount);
RecipeUtil.addRecipe(compostWheat.getUnlocalizedName(), compostWheat, " X ", "X#X", " X ", '#', Blocks.DIRT, 'X', crop);
}
FuelManager.moistenerResource.put(crop, new MoistenerFuel(crop, coreItems.mouldyWheat.getItemStack(), 0, 300));
});
}
use of forestry.farming.logic.farmables.FarmableAgingCrop in project ForestryMC by ForestryMC.
the class PluginRoots method registerRecipes.
@Override
public void registerRecipes() {
ImmutableList<String> crops = ImmutableList.of("moonglow", "terra_moss", "aubergine");
ImmutableList<String> seeds = ImmutableList.of("moontinged_seed", "terra_moss_spore", "aubergine_seeds");
ImmutableList<String> fruits = ImmutableList.of("moonglow_leaf", "terra_moss_ball", "aubergine_item");
IFarmRegistry farmRegistry = ForestryAPI.farmRegistry;
int seedAmount = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.seed");
int juiceAmount = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.apple") / 25;
for (int i = 0; i < fruits.size(); i++) {
ItemStack seed = getItemStack(seeds.get(i));
Block block = getBlock(crops.get(i));
ItemStack fruit = getItemStack(fruits.get(i));
if (seed != null && i != 1) {
RecipeManagers.squeezerManager.addRecipe(10, seed, Fluids.SEED_OIL.getFluid(seedAmount));
}
if (fruit != null && i == 2) {
RecipeManagers.squeezerManager.addRecipe(10, fruit, Fluids.JUICE.getFluid(juiceAmount));
}
if (seed != null && block != null) {
farmRegistry.registerFarmables("farmCrops", new FarmableAgingCrop(seed, block, BlockCrops.AGE, 7, 0));
}
}
}
use of forestry.farming.logic.farmables.FarmableAgingCrop in project ForestryMC by ForestryMC.
the class PluginActuallyAdditions method registerSeedPlant.
private void registerSeedPlant(@Nullable Item seedItem, String blockName) {
if (seedItem != null) {
Block plantBlock = getBlock(blockName);
if (plantBlock != null) {
FarmableAgingCrop crop = new FarmableAgingCrop(new ItemStack(seedItem), plantBlock, BlockCrops.AGE, 7, 0);
ForestryAPI.farmRegistry.registerFarmables("farmCrops", crop);
}
}
}
use of forestry.farming.logic.farmables.FarmableAgingCrop 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);
}
use of forestry.farming.logic.farmables.FarmableAgingCrop in project ForestryMC by ForestryMC.
the class PluginExtraUtilities method registerFarmable.
private void registerFarmable(Block plantBlock, Item plantItem, String identifier) {
IProperty<Integer> growthProperty = BlockUtil.getProperty(plantBlock, "growth", Integer.class);
if (growthProperty == null) {
Log.error("Could not find the growth property of {}.", plantBlock.getLocalizedName());
} else {
IFarmRegistry registry = FarmRegistry.getInstance();
int harvestAge = Collections.max(growthProperty.getAllowedValues());
int replantAge = plantBlock.getDefaultState().getValue(growthProperty);
registry.registerFarmables(identifier, new FarmableAgingCrop(new ItemStack(plantItem), plantBlock, growthProperty, harvestAge, replantAge));
}
}
Aggregations