use of forestry.api.farming.IFarmRegistry in project ForestryMC by ForestryMC.
the class PluginHarvestCraft method registerRecipes.
@Override
public void registerRecipes() {
ImmutableList<String> berries = ImmutableList.of("cranberry", "blackberry", "blueberry", "raspberry", "strawberry");
ImmutableList<String> fruits = ImmutableList.of("pineapple", "cactusfruit", "cantaloupe", "grape", "kiwi", "chilipepper");
ImmutableList<String> treeFruits = ImmutableList.of("banana", "dragonfruit", "lemon", "lime", "mango", "orange", "papaya", "peach", "pear", "plum", "pomegranate", "starfruit", "apricot", "date", "fig", "grapefruit", "persimmon", "avocado", "coconut", "durian");
ImmutableList<String> trees = ImmutableList.of("nutmeg", "olive", "peppercorn");
ImmutableList<String> treesSpecial = ImmutableList.of("cinnamon", "maple", "paperbark", "vanillabean", // to prevent apples from getting double registered
"apple");
ImmutableList<String> herbs = ImmutableList.of("garlic");
ImmutableList<String> spices = ImmutableList.of("ginger", "spiceleaf");
ImmutableList<String> vegetables = ImmutableList.of("asparagus", "bean", "beet", "broccoli", "cauliflower", "celery", "leek", "lettuce", "onion", "parsnip", "radish", "rutabaga", "scallion", "soybean", "sweetpotato", "turnip", "whitemushroom", "artichoke", "bellpepper", "brusselsprout", "cabbage", "corn", "cucumber", "eggplant", "okra", "peas", "rhubarb", "seaweed", "tomato", "wintersquash", "zucchini", "bambooshoot", "spinach");
ImmutableList<String> grains = ImmutableList.of("barley", "oats", "rye");
ImmutableList<String> cropNuts = ImmutableList.of("peanut");
ImmutableList<String> nuts = ImmutableList.of("walnut", "almond", "cashew", "chestnut", "pecan", "pistachio", // Cherries in forestry make seed oil
"cherry");
ImmutableList.Builder<String> genericCropsBuilder = ImmutableList.builder();
genericCropsBuilder.add("cotton", "rice", "tealeaf", "coffeebean", "candleberry");
genericCropsBuilder.addAll(herbs);
genericCropsBuilder.addAll(spices);
IFarmRegistry farmRegistry = ForestryAPI.farmRegistry;
ImmutableList<String> genericCrops = genericCropsBuilder.build();
ImmutableList.Builder<String> plants = ImmutableList.builder();
int juiceAmount = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.apple") / 25;
int seedamount = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.seed");
int wheatamount = ForestryAPI.activeMode.getIntegerSetting("recipe.output.compost.wheat");
PropertyInteger plantAGE = PropertyInteger.create("age", 0, 3);
PropertyInteger fruitAGE = PropertyInteger.create("age", 0, 2);
// Produce at least 1 mb of juice.
juiceAmount = Math.max(juiceAmount, 1);
for (String berryName : berries) {
ItemStack berry = getItemStack(berryName + "item");
ItemStack berrySeed = getItemStack(berryName + "seeditem");
Block berryBlock = getBlock("pam" + berryName + "crop");
if (berry != null) {
RecipeManagers.squeezerManager.addRecipe(10, berry, Fluids.JUICE.getFluid(juiceAmount));
}
if (berrySeed != null) {
RecipeManagers.squeezerManager.addRecipe(10, berrySeed, Fluids.SEED_OIL.getFluid(seedamount));
}
if (ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.FARMING)) && berrySeed != null && berryBlock != null) {
farmRegistry.registerFarmables("farmCrops", new FarmableAgingCrop(berrySeed, berryBlock, plantAGE, 3, 0));
}
plants.add(berryName);
}
juiceAmount = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.apple");
for (String fruitName : fruits) {
ItemStack fruit = getItemStack(fruitName + "item");
ItemStack fruitSeed = getItemStack(fruitName + "seeditem");
Block fruitBlock = getBlock("pam" + fruitName + "crop");
if (fruit != null) {
RecipeManagers.squeezerManager.addRecipe(10, fruit, Fluids.JUICE.getFluid(juiceAmount));
}
if (fruitSeed != null) {
RecipeManagers.squeezerManager.addRecipe(10, fruitSeed, Fluids.SEED_OIL.getFluid(seedamount));
}
if (ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.FARMING)) && fruitSeed != null && fruitBlock != null) {
farmRegistry.registerFarmables("farmCrops", new FarmableAgingCrop(fruitSeed, fruitBlock, plantAGE, 3, 0));
}
plants.add(fruitName);
}
// vegetables produce less juice
juiceAmount = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.apple") / 2;
// Produce at least 1 mb of juice.
juiceAmount = Math.max(juiceAmount, 1);
for (String vegetableName : vegetables) {
ItemStack vegetable = getItemStack(vegetableName + "item");
ItemStack vegetableSeed = getItemStack(vegetableName + "seeditem");
Block vegetableBlock = getBlock("pam" + vegetableName + "crop");
if (vegetable != null) {
RecipeManagers.squeezerManager.addRecipe(10, vegetable, Fluids.JUICE.getFluid(juiceAmount));
}
if (vegetableSeed != null) {
RecipeManagers.squeezerManager.addRecipe(10, vegetableSeed, Fluids.SEED_OIL.getFluid(seedamount));
}
if (ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.FARMING)) && vegetableSeed != null && vegetableBlock != null) {
farmRegistry.registerFarmables("farmCrops", new FarmableAgingCrop(vegetableSeed, vegetableBlock, plantAGE, 3, 0));
}
plants.add(vegetableName);
}
ItemRegistryCore coreItems = ModuleCore.getItems();
for (String grainName : grains) {
ItemStack grain = getItemStack(grainName + "item");
ItemStack grainSeed = getItemStack(grainName + "seeditem");
Block grainBlock = getBlock("pam" + grainName + "crop");
if (grain != null && wheatamount > 0) {
RecipeUtil.addRecipe("pam_compost_" + grainName, coreItems.compost.getItemStack(wheatamount), " X ", "X#X", " X ", '#', Blocks.DIRT, 'X', grain);
FuelManager.moistenerResource.put(grain, new MoistenerFuel(grain, coreItems.mouldyWheat.getItemStack(), 0, 300));
}
if (grainSeed != null) {
RecipeManagers.squeezerManager.addRecipe(10, grainSeed, Fluids.SEED_OIL.getFluid(seedamount));
RecipeManagers.moistenerManager.addRecipe(grainSeed, new ItemStack(Blocks.MYCELIUM), 5000);
}
if (ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.FARMING)) && grainSeed != null && grainBlock != null) {
farmRegistry.registerFarmables("farmCrops", new FarmableAgingCrop(grainSeed, grainBlock, plantAGE, 3, 0));
}
plants.add(grainName);
}
for (String treeFruitName : treeFruits) {
ItemStack treeFruit = getItemStack(treeFruitName + "item");
Block treeFruitBlock = getBlock("pam" + treeFruitName);
if (ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.FARMING)) && treeFruitBlock != null) {
farmRegistry.registerFarmables("farmOrchard", new FarmableAgingCrop(ItemStack.EMPTY, treeFruitBlock, fruitAGE, 2, 0));
}
if (treeFruit != null) {
RecipeManagers.squeezerManager.addRecipe(10, treeFruit, Fluids.JUICE.getFluid(juiceAmount));
}
plants.add(treeFruitName);
}
for (String treeName : trees) {
Block fruitBlock = getBlock("pam" + treeName);
if (ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.FARMING)) && fruitBlock != null) {
farmRegistry.registerFarmables("farmOrchard", new FarmableAgingCrop(ItemStack.EMPTY, fruitBlock, fruitAGE, 2, 0));
}
plants.add(treeName);
}
for (String treeName : treesSpecial) {
Block fruitBlock = getBlock("pam" + treeName);
if (ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.FARMING)) && fruitBlock != null) {
farmRegistry.registerFarmables("farmOrchard", new FarmableAgingCrop(ItemStack.EMPTY, fruitBlock, fruitAGE, 2, 0));
}
}
for (String cropName : genericCrops) {
String seedPrefix = cropName;
if (seedPrefix.equals("tealeaf")) {
seedPrefix = "tea";
}
if (seedPrefix.equals("coffeebean")) {
seedPrefix = "coffee";
}
ItemStack genericCropSeed = getItemStack(seedPrefix + "seeditem");
Block genericCropBlock = getBlock("pam" + cropName + "crop");
if (genericCropSeed != null) {
RecipeManagers.squeezerManager.addRecipe(10, genericCropSeed, Fluids.SEED_OIL.getFluid(seedamount));
}
if (ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.FARMING)) && genericCropSeed != null && genericCropBlock != null) {
farmRegistry.registerFarmables("farmCrops", new FarmableAgingCrop(genericCropSeed, genericCropBlock, plantAGE, 3, 0));
}
plants.add(cropName);
}
ItemStack mustardCropSeed = getItemStack("mustard" + "seeditem");
Block mustardCropBlock = getBlock("pam" + "mustardseeds" + "crop");
ItemStack mustardFruit = getItemStack("mustard" + "seedsitem");
if (mustardCropSeed != null) {
RecipeManagers.squeezerManager.addRecipe(10, mustardCropSeed, Fluids.SEED_OIL.getFluid(seedamount));
}
if (ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.FARMING)) && mustardCropSeed != null && mustardCropBlock != null) {
farmRegistry.registerFarmables("farmCrops", new FarmableAgingCrop(mustardCropSeed, mustardCropBlock, plantAGE, 3, 0));
}
if (mustardFruit != null) {
RecipeUtil.addFermenterRecipes(mustardFruit, ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.wheat"), Fluids.BIOMASS);
}
for (String plantName : plants.build()) {
ItemStack plant = getItemStack(plantName + "item");
if (plant != null) {
RecipeUtil.addFermenterRecipes(plant, ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.wheat"), Fluids.BIOMASS);
}
}
for (String cropnutName : cropNuts) {
ItemStack cropnut = getItemStack(cropnutName + "item");
ItemStack cropnutSeed = getItemStack(cropnutName + "seeditem");
Block cropnutBlock = getBlock("pam" + cropnutName + "crop");
if (cropnutSeed != null) {
RecipeManagers.squeezerManager.addRecipe(10, cropnutSeed, Fluids.SEED_OIL.getFluid(seedamount));
}
if (ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.FARMING)) && cropnutSeed != null && cropnutBlock != null) {
farmRegistry.registerFarmables("farmCrops", new FarmableAgingCrop(cropnutSeed, cropnutBlock, plantAGE, 3, 0));
}
if (cropnut != null) {
RecipeManagers.squeezerManager.addRecipe(20, cropnut, Fluids.SEED_OIL.getFluid(12 * seedamount));
}
}
for (String nutName : nuts) {
ItemStack nut = getItemStack(nutName + "item");
Block nutBlock = getBlock("pam" + nutName);
if (ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.FARMING)) && nutBlock != null) {
farmRegistry.registerFarmables("farmOrchard", new FarmableAgingCrop(ItemStack.EMPTY, nutBlock, fruitAGE, 2, 0));
}
if (nut != null) {
RecipeManagers.squeezerManager.addRecipe(20, nut, Fluids.SEED_OIL.getFluid(15 * seedamount));
}
}
if (ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.APICULTURE))) {
ItemStack hcHoneyItem = getItemStack("honeyitem");
if (hcHoneyItem != null) {
RecipeManagers.squeezerManager.addRecipe(10, hcHoneyItem, Fluids.FOR_HONEY.getFluid(Constants.FLUID_PER_HONEY_DROP));
}
ItemStack hcBeeswaxItem = getItemStack("beeswaxitem");
if (hcBeeswaxItem != null) {
RecipeUtil.addRecipe("pam_wax_capsule", ModuleFluids.getItems().waxCapsuleEmpty.getItemStack(ForestryAPI.activeMode.getIntegerSetting("recipe.output.capsule")), "XXX ", 'X', hcBeeswaxItem);
}
}
}
use of forestry.api.farming.IFarmRegistry in project ForestryMC by ForestryMC.
the class PluginImmersiveEngineering method postInit.
@Override
public void postInit() {
IFarmRegistry farmRegistry = ForestryAPI.farmRegistry;
ItemStack hempSeed = getItemStack("seed");
Block hempCrop = getBlock("hemp");
if (hempCrop != null) {
int seedAmount = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.seed");
Stream<IProperty<?>> propertyStream = hempCrop.getBlockState().getProperties().stream();
IProperty age = propertyStream.filter(p -> p.getName().equals("type")).findAny().orElseGet(null);
if (hempSeed != null && hempCrop != Blocks.AIR && age != null) {
Optional bottom0 = age.parseValue("bottom0");
Optional bottom4 = age.parseValue("bottom4");
Optional top0 = age.parseValue("top0");
if (bottom0.isPresent() && top0.isPresent()) {
IBlockState defaultState = hempCrop.getDefaultState();
IBlockState planted = defaultState.withProperty(age, (Comparable) bottom0.get());
IBlockState mature = defaultState.withProperty(age, (Comparable) bottom4.get());
IBlockState topMature = defaultState.withProperty(age, (Comparable) top0.get());
farmRegistry.registerFarmables("farmWheat", new FarmableDoubleCrop(hempSeed, planted, mature, topMature, false));
farmRegistry.registerFarmables("farmOrchard", new FarmableDoubleCrop(hempSeed, planted, mature, topMature, true));
RecipeManagers.squeezerManager.addRecipe(10, hempSeed, Fluids.SEED_OIL.getFluid(seedAmount));
}
}
}
Fluid ethanol = FluidRegistry.getFluid("ethanol");
if (ethanol != null) {
GeneratorFuel ethanolFuel = new GeneratorFuel(new FluidStack(ethanol, 1), (int) (32 * ForestryAPI.activeMode.getFloatSetting("fuel.ethanol.generator")), 4);
FuelManager.generatorFuel.put(ethanol, ethanolFuel);
}
}
use of forestry.api.farming.IFarmRegistry in project ForestryMC by ForestryMC.
the class PluginMysticalAgriculture method registerRecipes.
@Override
public void registerRecipes() {
if (ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.FARMING))) {
ImmutableList<String> crops = ImmutableList.of("stone", "dirt", "nature", "wood", "water", "ice", "fire", "dye", "nether", "coal", "iron", "nether_quartz", "glowstone", "redstone", "obsidian", "gold", "lapis_lazuli", "end", "experience", "diamond", "emerald", "zombie", "pig", "chicken", "cow", "sheep", "slime", "skeleton", "creeper", "spider", "rabbit", "guardian", "blaze", "ghast", "enderman", "wither_skeleton", "rubber", "silicon", "sulfur", "aluminum", "copper", "saltpeter", "tin", "bronze", "zinc", "brass", "silver", "lead", "steel", "nickel", "constantan", "electrum", "invar", "mithril", "tungsten", "titanium", "chrome", "platinum", "iridium", "ruby", "sapphire", "peridot", "amber", "topaz", "malachite", "tanzanite", "blizz", "blitz", "basalz", "signalum", "lumium", "enderium", "aluminum_brass", "knightslime", "ardite", "cobalt", "manyullyn", "electrical_steel", "redstone_alloy", "conductive_iron", "soularium", "dark_steel", "pulsating_iron", "energetic_alloy", "vibrant_alloy", "mystical_flower", "manasteel", "terrasteel", "osmium", "glowstone_ingot", "refined_obsidian", "aquarium", "cold_iron", "star_steel", "adamantine", "marble", "limestone", "basalt", "apatite", "steeleaf", "ironwood", "knightmetal", "fiery_ingot", "meteoric_iron", "desh", "black_quartz", "vinteum", "chimerite", "blue_topaz", "moonstone", "sunstone", "aquamarine", "starmetal", "rock_crystal", "ender_biotite", "slate", "ender_amethyst", "draconium", "yellorium", "certus_quartz", "fluix", "quartz_enriched_iron");
IFarmRegistry farmRegistry = ForestryAPI.farmRegistry;
int seedAmount = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.seed");
for (String cropName : crops) {
ItemStack seeds = getItemStack(cropName + "_seeds");
Block block = getBlock(cropName + "_crop");
if (seeds != null) {
RecipeManagers.squeezerManager.addRecipe(10, seeds, Fluids.SEED_OIL.getFluid(seedAmount));
}
if (seeds != null && block != null) {
farmRegistry.registerFarmables("farmCrops", new FarmableAgingCrop(seeds, block, BlockCrops.AGE, 7, 0));
}
}
for (int i = 1; i <= 5; i++) {
ItemStack seeds = getItemStack("tier" + i + "_inferium_seeds");
Block block = getBlock("tier" + i + "_inferium_crop");
if (seeds != null) {
RecipeManagers.squeezerManager.addRecipe(10, seeds, Fluids.SEED_OIL.getFluid(seedAmount));
}
if (seeds != null && block != null) {
farmRegistry.registerFarmables("farmCrops", new FarmableAgingCrop(seeds, block, BlockCrops.AGE, 7, 0));
}
}
}
}
use of forestry.api.farming.IFarmRegistry in project ForestryMC by ForestryMC.
the class PluginRustic method registerRecipes.
@Override
public void registerRecipes() {
ImmutableList<String> fruits = ImmutableList.of("tomato", "chili_pepper");
ImmutableList<String> crops = ImmutableList.of("tomato", "chili");
PropertyInteger cropAge = PropertyInteger.create("age", 0, 3);
int seedAmount = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.seed");
int juiceAmount = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.apple");
IFarmRegistry farmRegistry = ForestryAPI.farmRegistry;
ItemStack grapes = getItemStack("grapes");
ItemStack grapeSeeds = getItemStack("grape_stem");
Block grapeLeaves = getBlock("grape_leaves");
if (grapeSeeds != null) {
RecipeManagers.squeezerManager.addRecipe(10, grapeSeeds, Fluids.SEED_OIL.getFluid(seedAmount));
}
if (grapes != null) {
RecipeManagers.squeezerManager.addRecipe(10, grapes, Fluids.JUICE.getFluid(juiceAmount / 12));
}
if (grapeLeaves != null) {
farmRegistry.registerFarmables("farmOrchard", new FarmableRusticGrape(grapeLeaves));
}
ItemStack sapling = getItemStack("sapling");
ItemStack ironBerries = getItemStack("ironberries");
ItemStack olives = getItemStack("olives");
if (sapling != null && ironBerries != null && olives != null) {
farmRegistry.registerFarmables("farmArboreal", new FarmableRusticSapling(sapling.getItem(), new ItemStack[] { ironBerries, olives }));
}
for (int i = 0; i < fruits.size(); i++) {
String fruitName = fruits.get(i);
ItemStack seeds = getItemStack(fruitName + "_seeds");
Block block = getBlock(crops.get(i) + "_crop");
ItemStack fruit = getItemStack(fruitName);
if (seeds != null) {
RecipeManagers.squeezerManager.addRecipe(10, seeds, Fluids.SEED_OIL.getFluid(seedAmount));
}
if (fruit != null) {
RecipeManagers.squeezerManager.addRecipe(10, fruit, Fluids.JUICE.getFluid(juiceAmount / 25));
}
if (seeds != null && block != null) {
farmRegistry.registerFarmables("farmOrchard", new FarmableAgingCrop(seeds, block, cropAge, 3, 2));
}
}
}
use of forestry.api.farming.IFarmRegistry in project ForestryMC by ForestryMC.
the class PluginBetterWithMods method registerRecipes.
@Override
public void registerRecipes() {
IFarmRegistry farmRegistry = ForestryAPI.farmRegistry;
int seedAmount = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.seed");
PropertyBool TOP = PropertyBool.create("top");
PropertyInteger AGE = BlockCrops.AGE;
ItemStack hempSeed = getItemStack("hemp");
Block hempCrop = getBlock("hemp");
if (hempSeed != null && hempCrop != null) {
IBlockState defaultState = hempCrop.getDefaultState();
IBlockState planted = defaultState.withProperty(AGE, 0).withProperty(TOP, false);
IBlockState mature = defaultState.withProperty(AGE, 7).withProperty(TOP, false);
IBlockState topMature = defaultState.withProperty(AGE, 7).withProperty(TOP, true);
farmRegistry.registerFarmables("farmCrops", new FarmableDoubleCrop(hempSeed, planted, mature, topMature, true));
RecipeManagers.squeezerManager.addRecipe(10, hempSeed, Fluids.SEED_OIL.getFluid(seedAmount));
}
}
Aggregations