use of forestry.farming.logic.farmables.FarmableDoubleCrop 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.farming.logic.farmables.FarmableDoubleCrop 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