use of forestry.api.fuels.GeneratorFuel in project ForestryMC by ForestryMC.
the class ModuleFluids method doInit.
@Override
public void doInit() {
if (RecipeManagers.squeezerManager != null) {
ItemRegistryCore itemRegistryCore = ModuleCore.getItems();
RecipeManagers.squeezerManager.addContainerRecipe(10, getItems().canEmpty.getItemStack(), itemRegistryCore.ingotTin.copy(), 0.05f);
RecipeManagers.squeezerManager.addContainerRecipe(10, getItems().waxCapsuleEmpty.getItemStack(), itemRegistryCore.beeswax.getItemStack(), 0.10f);
RecipeManagers.squeezerManager.addContainerRecipe(10, getItems().refractoryEmpty.getItemStack(), itemRegistryCore.refractoryWax.getItemStack(), 0.10f);
}
FluidStack ethanol = Fluids.BIO_ETHANOL.getFluid(1);
GeneratorFuel ethanolFuel = new GeneratorFuel(ethanol, (int) (32 * ForestryAPI.activeMode.getFloatSetting("fuel.ethanol.generator")), 4);
FuelManager.generatorFuel.put(ethanol.getFluid(), ethanolFuel);
FluidStack biomass = Fluids.BIOMASS.getFluid(1);
GeneratorFuel biomassFuel = new GeneratorFuel(biomass, (int) (8 * ForestryAPI.activeMode.getFloatSetting("fuel.biomass.generator")), 1);
FuelManager.generatorFuel.put(biomass.getFluid(), biomassFuel);
}
use of forestry.api.fuels.GeneratorFuel in project ForestryMC by ForestryMC.
the class TileEuGenerator method updateServerSide.
@Override
public void updateServerSide() {
if (updateOnInterval(20)) {
FluidHelper.drainContainers(tankManager, this, InventoryGenerator.SLOT_CAN);
}
IErrorLogic errorLogic = getErrorLogic();
// No work to be done if IC2 is unavailable.
if (errorLogic.setCondition(ic2EnergySource == null, EnumErrorCode.NO_ENERGY_NET)) {
return;
}
ic2EnergySource.update();
if (resourceTank.getFluidAmount() > 0) {
GeneratorFuel fuel = FuelManager.generatorFuel.get(resourceTank.getFluid().getFluid());
if (resourceTank.canDrainFluidType(fuel.getFuelConsumed()) && ic2EnergySource.getFreeCapacity() >= fuel.getEu()) {
ic2EnergySource.addEnergy(fuel.getEu());
this.tickCount++;
if (tickCount >= fuel.getRate()) {
tickCount = 0;
resourceTank.drain(fuel.getFuelConsumed().amount, true);
}
}
}
boolean hasFuel = resourceTank.getFluidAmount() > 0;
errorLogic.setCondition(!hasFuel, EnumErrorCode.NO_FUEL);
}
use of forestry.api.fuels.GeneratorFuel 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);
}
}
Aggregations