Railcraft

Railcraft

34M Downloads

[suggestion] water tank config

WarlordWossman opened this issue · 1 comments

commented

Is your feature request related to a problem? Please describe.
Not really a problem within RC itself but it would massively improve how RC can work together with other mods that need an automatic water supply.

Describe the solution you'd like
A config option to multiply the water tank output.

Describe alternatives you've considered
A more detailed config would also work so you can set all the values for biomes and rain/snow (de)buffs yourself but I think it would be simpler if you could just scale the existing values up.

Additional context
Options for making modpacks. It was always hard to give Railcraft the importance it should have when other mods are installed and configs give you the option to really make it happen.
In my specific example (modpack) water is finite in biomes other than rivers and oceans and the watertank is a cool earlygame alternative. Due to other mods installed you would sometimes need 10 or even more water tanks to fullfill the needs for water and I would like to buff them a little.

The fact that we are getting config options for the multiblock tanks and the chest minecarts already go into that direction and having control over the water tank as well would be very nice!

commented

I reworked the algorithm for water generation as well:

public class WaterGeneratorLogic extends Logic {
private static final int REFILL_INTERVAL = 16;
private static final float REFILL_PENALTY_FROZEN = 0.5f;
private static final float REFILL_BOOST_RAIN = 3.0f;
public WaterGeneratorLogic(Adapter adapter) {
super(adapter);
}
@Override
protected void updateServer() {
super.updateServer();
World world = theWorldAsserted();
if (clock(REFILL_INTERVAL)) {
BlockPos up = getPos().up();
double rate = 0.0;
Biome biome = world.getBiome(getPos());
if (world.canBlockSeeSky(up)) {
rate += RailcraftConfig.getBaseWaterGeneratorRate();
rate *= biome.getRainfall();
if (world.canSnowAt(up, false))
rate *= REFILL_PENALTY_FROZEN;
else if (world.isRainingAt(up))
rate *= REFILL_BOOST_RAIN;
}
double temp = biome.getTemperature(up);
if (temp > 1.0)
rate -= temp - 1.0;
final int rateFinal = MathHelper.floor(rate);
getLogic(IFluidHandler.class).ifPresent(tank -> {
if (rateFinal > 0)
tank.fill(Fluids.WATER.get(rateFinal), true);
else
tank.drain(Fluids.WATER.get(Math.abs(rateFinal)), true);
});
}
}
}

This code runs every 16 ticks (REFILL_INTERVAL) on every block of the water tank. The old code ran only for the master block with a base rate of 10 mB every 8 ticks. The base rate is now, by default, 4 mB * width * length every 16 ticks and can be adjusted in the config.

Additionally, biomes with temperature values over 1.0 will result in evaporation.

It should also be affected by the seasonal changes of the Serene Seasons mod.