more performant turbine cycles, radworld config

This commit is contained in:
Boblet 2020-09-11 14:08:21 +02:00
parent 651a8506cf
commit 7f275d06b1
3 changed files with 19 additions and 13 deletions

View File

@ -12,6 +12,7 @@ public class RadiationConfig {
public static float hellRad = 0.1F;
public static int worldRad = 10;
public static int worldRadThreshold = 20;
public static boolean worldRadEffects = true;
public static void loadFromConfig(Configuration config) {
@ -34,6 +35,7 @@ public class RadiationConfig {
hellRad = netherRad.getInt() * 0.01F;
worldRad = CommonConfig.createConfigInt(config, CATEGORY_NUKE, "6.10_worldRadCount", "How many block operations radiation can perform per tick", 10);
worldRadThreshold = CommonConfig.createConfigInt(config, CATEGORY_NUKE, "6.11_worldRadThreshold", "The least amount of RADs required for block modification to happen", 20);
worldRadEffects = CommonConfig.createConfigBool(config, CATEGORY_NUKE, "6.12_worldRadEffects", "Whether high radiation levels should perform changes in the world", true);
fogCh = CommonConfig.setDef(fogCh, 20);
}

View File

@ -2,6 +2,7 @@ package com.hbm.handler;
import java.util.Map.Entry;
import com.hbm.config.RadiationConfig;
import com.hbm.saveddata.RadiationSavedData;
import net.minecraft.init.Blocks;
@ -17,6 +18,9 @@ public class RadiationWorldHandler {
if(!(world instanceof WorldServer))
return;
if(!RadiationConfig.worldRadEffects)
return;
WorldServer serv = (WorldServer)world;
RadiationSavedData data = RadiationSavedData.getData(serv);

View File

@ -235,19 +235,19 @@ public class TileEntityMachineTurbine extends TileEntity implements ISidedInvent
} else {
tanks[1].setTankType((FluidType) outs[0]);
for(int i = 0; i < 1200; i++) {
if(tanks[0].getFill() >= (Integer)outs[2] && tanks[1].getFill() + (Integer)outs[1] <= tanks[1].getMaxFill()) {
tanks[0].setFill(tanks[0].getFill() - (Integer)outs[2]);
tanks[1].setFill(tanks[1].getFill() + (Integer)outs[1]);
power += (Integer)outs[3];
if(power > maxPower)
power = maxPower;
} else {
break;
}
}
int processMax = 1200; //the maximum amount of cycles based on the 1.2k cycle cap (subject to change)
int processSteam = tanks[0].getFill() / (Integer)outs[2]; //the maximum amount of cycles depending on steam
int processWater = (tanks[1].getMaxFill() - tanks[1].getFill()) / (Integer)outs[1]; //the maximum amount of cycles depending on water
int cycles = Math.min(processMax, Math.min(processSteam, processWater));
tanks[0].setFill(tanks[0].getFill() - (Integer)outs[2] * cycles);
tanks[1].setFill(tanks[1].getFill() + (Integer)outs[1] * cycles);
power += (Integer)outs[3] * cycles;
if(power > maxPower)
power = maxPower;
}
tanks[1].unloadTank(5, 6, slots);