commit
2892a32022
1 changed files with 81 additions and 62 deletions
|
@ -82,56 +82,75 @@ public class GT_MetaTileEntity_HeatExchanger extends GT_MetaTileEntity_MultiBloc
|
||||||
return aFacing > 1;
|
return aFacing > 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean checkRecipe(ItemStack aStack)
|
public boolean checkRecipe(ItemStack aStack) {
|
||||||
{
|
if (mInputHotFluidHatch.getFluid() == null)
|
||||||
if(GT_ModHandler.isLava(mInputHotFluidHatch.getFluid())){
|
return true;
|
||||||
int fluidAmount = mInputHotFluidHatch.getFluidAmount();
|
|
||||||
if(fluidAmount >= 500){superheated=true;}else{superheated=false;}
|
|
||||||
if(fluidAmount>1000){fluidAmount=1000;}
|
|
||||||
mInputHotFluidHatch.drain(fluidAmount, true);
|
|
||||||
mOutputColdFluidHatch.fill(FluidRegistry.getFluidStack("ic2pahoehoelava", fluidAmount), true);
|
|
||||||
|
|
||||||
|
int fluidAmountToConsume = mInputHotFluidHatch.getFluidAmount(); // how much fluid is in hatch
|
||||||
|
|
||||||
|
int superheated_threshold = 4000; // default: must have 4000L per second to generate superheated steam
|
||||||
|
float efficiency = 1f; // default: operate at 100% efficiency with no integrated circuitry
|
||||||
|
float penalty_per_config = 0.015f; // penalize 1.5% efficiency per circuitry level (1-25)
|
||||||
|
int shs_reduction_per_config = 150; // reduce threshold 150L/s per circuitry level (1-25)
|
||||||
|
float steam_output_multiplier = 4f; // default: multiply output by 4
|
||||||
|
float penalty = 0.0f; // penalty to apply to output based on circuitry level (1-25).
|
||||||
|
boolean do_lava = false;
|
||||||
|
|
||||||
|
// Do we have an integrated circuit with a valid configuration?
|
||||||
|
if (mInventory[1] != null && mInventory[1].getUnlocalizedName().startsWith("gt.integrated_circuit")) {
|
||||||
|
int circuit_config = mInventory[1].getItemDamage();
|
||||||
|
if (circuit_config >= 1 && circuit_config <= 25) {
|
||||||
|
// If so, apply the penalty and reduced threshold.
|
||||||
|
penalty = (circuit_config - 1) * penalty_per_config;
|
||||||
|
superheated_threshold -= (shs_reduction_per_config * (circuit_config - 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
efficiency -= penalty;
|
||||||
|
|
||||||
|
// If we're working with lava, adjust the threshold and multipliers accordingly.
|
||||||
|
if (GT_ModHandler.isLava(mInputHotFluidHatch.getFluid())) {
|
||||||
|
superheated_threshold /= 4;
|
||||||
|
do_lava = true;
|
||||||
|
} else if (mInputHotFluidHatch.getFluid().isFluidEqual(FluidRegistry.getFluidStack("ic2hotcoolant", 1))) {
|
||||||
|
steam_output_multiplier = 0.5f;
|
||||||
|
} else {
|
||||||
|
// If we're working with neither, fail out
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
superheated = fluidAmountToConsume >= superheated_threshold; // set the internal superheated flag if we have enough hot fluid. Used in the onRunningTick method.
|
||||||
|
fluidAmountToConsume = Math.min(fluidAmountToConsume, superheated_threshold * 2); // Don't consume too much hot fluid per second
|
||||||
|
mInputHotFluidHatch.drain(fluidAmountToConsume, true);
|
||||||
this.mMaxProgresstime = 20;
|
this.mMaxProgresstime = 20;
|
||||||
this.mEUt = fluidAmount*4;
|
this.mEUt = (int) (fluidAmountToConsume * steam_output_multiplier * efficiency);
|
||||||
|
if (do_lava) {
|
||||||
|
mOutputColdFluidHatch.fill(FluidRegistry.getFluidStack("ic2pahoehoelava", fluidAmountToConsume), true);
|
||||||
this.mEfficiencyIncrease = 80;
|
this.mEfficiencyIncrease = 80;
|
||||||
|
} else {
|
||||||
|
mOutputColdFluidHatch.fill(FluidRegistry.getFluidStack("ic2coolant", fluidAmountToConsume), true);
|
||||||
|
this.mEfficiencyIncrease = 80;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mInputHotFluidHatch.getFluid().isFluidEqual(FluidRegistry.getFluidStack("ic2hotcoolant", 1))){
|
|
||||||
int fluidAmount = mInputHotFluidHatch.getFluidAmount();
|
|
||||||
if(fluidAmount >= 4000){superheated=true;}else{superheated=false;}
|
|
||||||
if(fluidAmount>8000){fluidAmount=8000;}
|
|
||||||
mInputHotFluidHatch.drain(fluidAmount, true);
|
|
||||||
mOutputColdFluidHatch.fill(FluidRegistry.getFluidStack("ic2coolant", fluidAmount), true);
|
|
||||||
|
|
||||||
|
|
||||||
this.mMaxProgresstime = 20;
|
|
||||||
this.mEUt = fluidAmount/2;
|
|
||||||
this.mEfficiencyIncrease = 20;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;}
|
|
||||||
|
|
||||||
private float water;
|
private float water;
|
||||||
private int useWater(float input){
|
private int useWater(float input) {
|
||||||
water = water + input;
|
water = water + input;
|
||||||
int usage = (int)water;
|
int usage = (int) water;
|
||||||
water = water - (int)usage;
|
water = water - (int) usage;
|
||||||
return usage;
|
return usage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onRunningTick(ItemStack aStack) {
|
public boolean onRunningTick(ItemStack aStack) {
|
||||||
|
|
||||||
if (this.mEUt > 0) {
|
if (this.mEUt > 0) {
|
||||||
int tGeneratedEU = (int) (this.mEUt * 2L * this.mEfficiency / 10000L); // APPROXIMATELY how much steam to generate.
|
int tGeneratedEU = (int) (this.mEUt * 2L * this.mEfficiency / 10000L); // APPROXIMATELY how much steam to generate.
|
||||||
|
|
||||||
if (tGeneratedEU > 0) {
|
if (tGeneratedEU > 0) {
|
||||||
|
|
||||||
if (superheated)
|
if (superheated)
|
||||||
tGeneratedEU /= 2; // We produce half as much superheated steam if necessary
|
tGeneratedEU /= 2; // We produce half as much superheated steam if necessary
|
||||||
|
|
||||||
int distilledConsumed = useWater(tGeneratedEU / 160f); // how much distilled water to consume
|
int distilledConsumed = useWater(tGeneratedEU / 160f); // how much distilled water to consume
|
||||||
tGeneratedEU = distilledConsumed * 160; // EXACTLY how much steam to generate, producing a perfect 1:160 ratio with distilled water consumption
|
//tGeneratedEU = distilledConsumed * 160; // EXACTLY how much steam to generate, producing a perfect 1:160 ratio with distilled water consumption
|
||||||
|
|
||||||
FluidStack distilledStack = GT_ModHandler.getDistilledWater(distilledConsumed);
|
FluidStack distilledStack = GT_ModHandler.getDistilledWater(distilledConsumed);
|
||||||
if (depleteInput(distilledStack)) // Consume the distilled water
|
if (depleteInput(distilledStack)) // Consume the distilled water
|
||||||
|
|
Loading…
Reference in a new issue