Reactors now a Heat source. Awaiting Balance.
This commit is contained in:
parent
3544addf20
commit
7296c3dbcb
3 changed files with 127 additions and 5 deletions
src/main/java/mekanism
api/reactor
generators/common
|
@ -1,10 +1,11 @@
|
|||
package mekanism.api.reactor;
|
||||
|
||||
import mekanism.api.IHeatTransfer;
|
||||
import mekanism.api.gas.GasTank;
|
||||
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
|
||||
public interface IFusionReactor
|
||||
public interface IFusionReactor extends IHeatTransfer
|
||||
{
|
||||
public void addTemperatureFromEnergyInput(double energyAdded);
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.IHeatTransfer;
|
||||
import mekanism.api.gas.GasRegistry;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.api.gas.GasTank;
|
||||
|
@ -34,6 +35,7 @@ public class FusionReactor implements IFusionReactor
|
|||
public TileEntityReactorController controller;
|
||||
public Set<IReactorBlock> reactorBlocks = new HashSet<IReactorBlock>();
|
||||
public Set<INeutronCapture> neutronCaptors = new HashSet<INeutronCapture>();
|
||||
public Set<IHeatTransfer> heatTransfers = new HashSet<IHeatTransfer>();
|
||||
|
||||
//Current stores of temperature
|
||||
public double plasmaTemperature;
|
||||
|
@ -43,6 +45,8 @@ public class FusionReactor implements IFusionReactor
|
|||
public double lastPlasmaTemperature;
|
||||
public double lastCaseTemperature;
|
||||
|
||||
public double heatToAbsorb = 0;
|
||||
|
||||
//Reaction characteristics
|
||||
public static double burnTemperature = 1E8;
|
||||
public static double burnRatio = 1;
|
||||
|
@ -152,7 +156,7 @@ public class FusionReactor implements IFusionReactor
|
|||
|
||||
getDeuteriumTank().draw(amountToInject / 2, true);
|
||||
getTritiumTank().draw(amountToInject / 2, true);
|
||||
getFuelTank().receive(new GasStack(GasRegistry.getGas("fusionFuel"), amountToInject), true);
|
||||
getFuelTank().receive(new GasStack(GasRegistry.getGas("fusionFuelDT"), amountToInject), true);
|
||||
}
|
||||
|
||||
public int burnFuel()
|
||||
|
@ -196,18 +200,22 @@ public class FusionReactor implements IFusionReactor
|
|||
{
|
||||
double caseWaterHeat = caseWaterConductivity * lastCaseTemperature;
|
||||
int waterToVaporize = (int)(steamTransferEfficiency * caseWaterHeat / enthalpyOfVaporization);
|
||||
//Mekanism.logger.info("Wanting to vaporise " + waterToVaporize + "mB of water");
|
||||
waterToVaporize = min(waterToVaporize, min(getWaterTank().getFluidAmount(), getSteamTank().getCapacity() - getSteamTank().getFluidAmount()));
|
||||
|
||||
if(waterToVaporize > 0)
|
||||
{
|
||||
//Mekanism.logger.info("Vaporising " + waterToVaporize + "mB of water");
|
||||
getWaterTank().drain(waterToVaporize, true);
|
||||
getSteamTank().fill(new FluidStack(FluidRegistry.getFluid("steam"), waterToVaporize), true);
|
||||
}
|
||||
|
||||
caseWaterHeat = waterToVaporize * enthalpyOfVaporization / steamTransferEfficiency;
|
||||
caseTemperature -= caseWaterHeat / caseHeatCapacity;
|
||||
|
||||
for(IHeatTransfer source : heatTransfers)
|
||||
{
|
||||
source.simulateHeat();
|
||||
}
|
||||
applyTemperatureChange();
|
||||
}
|
||||
|
||||
//Transfer from casing to environment
|
||||
|
@ -402,6 +410,10 @@ public class FusionReactor implements IFusionReactor
|
|||
{
|
||||
neutronCaptors.add((INeutronCapture)tile);
|
||||
}
|
||||
if(tile instanceof IHeatTransfer)
|
||||
{
|
||||
heatTransfers.add((IHeatTransfer)tile);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
|
@ -503,4 +515,55 @@ public class FusionReactor implements IFusionReactor
|
|||
|
||||
return (int)(steamTransferEfficiency * caseWaterConductivity * temperature / enthalpyOfVaporization);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getTemp()
|
||||
{
|
||||
return lastCaseTemperature;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getInverseConductionCoefficient()
|
||||
{
|
||||
return 1 / caseAirConductivity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getInsulationCoefficient(ForgeDirection side)
|
||||
{
|
||||
return 100000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transferHeatTo(double heat)
|
||||
{
|
||||
heatToAbsorb += heat;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] simulateHeat()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double applyTemperatureChange()
|
||||
{
|
||||
caseTemperature += heatToAbsorb / caseHeatCapacity;
|
||||
heatToAbsorb = 0;
|
||||
|
||||
return caseTemperature;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectHeat(ForgeDirection side)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IHeatTransfer getAdjacent(ForgeDirection side)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,14 +2,19 @@ package mekanism.generators.common.tile.reactor;
|
|||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.IHeatTransfer;
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.api.gas.GasRegistry;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.api.gas.IGasHandler;
|
||||
import mekanism.api.gas.ITubeConnection;
|
||||
import mekanism.api.reactor.IReactorBlock;
|
||||
import mekanism.common.util.CableUtils;
|
||||
import mekanism.common.util.HeatUtils;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
|
@ -17,7 +22,7 @@ import net.minecraftforge.fluids.FluidStack;
|
|||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
public class TileEntityReactorPort extends TileEntityReactorBlock implements IFluidHandler, IGasHandler, ITubeConnection
|
||||
public class TileEntityReactorPort extends TileEntityReactorBlock implements IFluidHandler, IGasHandler, ITubeConnection, IHeatTransfer
|
||||
{
|
||||
public TileEntityReactorPort()
|
||||
{
|
||||
|
@ -214,4 +219,57 @@ public class TileEntityReactorPort extends TileEntityReactorBlock implements IFl
|
|||
{
|
||||
return 1000000000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getTemp()
|
||||
{
|
||||
return getReactor().getTemp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getInverseConductionCoefficient()
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getInsulationCoefficient(ForgeDirection side)
|
||||
{
|
||||
return getReactor().getInsulationCoefficient(side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transferHeatTo(double heat)
|
||||
{
|
||||
getReactor().transferHeatTo(heat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] simulateHeat()
|
||||
{
|
||||
return HeatUtils.simulate(this, Coord4D.get(this), worldObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double applyTemperatureChange()
|
||||
{
|
||||
return getReactor().applyTemperatureChange();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectHeat(ForgeDirection side)
|
||||
{
|
||||
return getReactor() != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IHeatTransfer getAdjacent(ForgeDirection side)
|
||||
{
|
||||
TileEntity adj = Coord4D.get(this).getFromSide(side).getTileEntity(worldObj);
|
||||
if(adj instanceof IHeatTransfer && !(adj instanceof IReactorBlock))
|
||||
{
|
||||
return (IHeatTransfer)adj;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue