Thermodynamic Conductors function properly, added Thermal Evaporation Plant integration with heat system

This commit is contained in:
aidancbrady 2016-02-24 20:29:50 -05:00
parent 2d972edf45
commit b3143d1abb
15 changed files with 149 additions and 40 deletions

View file

@ -6,6 +6,9 @@ import java.util.Set;
import mekanism.api.IHeatTransfer; import mekanism.api.IHeatTransfer;
import mekanism.api.transmitters.DynamicNetwork; import mekanism.api.transmitters.DynamicNetwork;
import mekanism.api.transmitters.IGridTransmitter; import mekanism.api.transmitters.IGridTransmitter;
import mekanism.api.util.UnitDisplayUtils.TemperatureUnit;
import mekanism.common.multipart.MultipartTransmitter;
import mekanism.common.util.MekanismUtils;
import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLCommonHandler;
public class HeatNetwork extends DynamicNetwork<IHeatTransfer, HeatNetwork> public class HeatNetwork extends DynamicNetwork<IHeatTransfer, HeatNetwork>
@ -40,13 +43,13 @@ public class HeatNetwork extends DynamicNetwork<IHeatTransfer, HeatNetwork>
@Override @Override
public String getStoredInfo() public String getStoredInfo()
{ {
return meanTemp + "K above ambient"; return MekanismUtils.getTemperatureDisplay(meanTemp, TemperatureUnit.KELVIN) + " above ambient";
} }
@Override @Override
public String getFlowInfo() public String getFlowInfo()
{ {
return heatTransferred + " transferred to acceptors, " + heatLost + " lost to environment, " + (heatTransferred + heatLost == 0 ? "" : heatTransferred / (heatTransferred + heatLost) * 100 + "% efficiency"); return MekanismUtils.getTemperatureDisplay(heatTransferred, TemperatureUnit.KELVIN) + " transferred to acceptors, " + MekanismUtils.getTemperatureDisplay(heatLost, TemperatureUnit.KELVIN) + " lost to environment, " + (heatTransferred + heatLost == 0 ? "" : heatTransferred / (heatTransferred + heatLost) * 100 + "% efficiency");
} }
@Override @Override
@ -74,9 +77,9 @@ public class HeatNetwork extends DynamicNetwork<IHeatTransfer, HeatNetwork>
{ {
for(IGridTransmitter<IHeatTransfer, HeatNetwork> transmitter : transmitters) for(IGridTransmitter<IHeatTransfer, HeatNetwork> transmitter : transmitters)
{ {
if(transmitter instanceof IHeatTransfer) if(transmitter instanceof MultipartTransmitter && ((MultipartTransmitter)transmitter).getPart() instanceof IHeatTransfer)
{ {
IHeatTransfer heatTransmitter = (IHeatTransfer)transmitter; IHeatTransfer heatTransmitter = (IHeatTransfer)((MultipartTransmitter)transmitter).getPart();
double[] d = heatTransmitter.simulateHeat(); double[] d = heatTransmitter.simulateHeat();
newHeatTransferred += d[0]; newHeatTransferred += d[0];
newHeatLost += d[1]; newHeatLost += d[1];
@ -85,9 +88,9 @@ public class HeatNetwork extends DynamicNetwork<IHeatTransfer, HeatNetwork>
for(IGridTransmitter<IHeatTransfer, HeatNetwork> transmitter : transmitters) for(IGridTransmitter<IHeatTransfer, HeatNetwork> transmitter : transmitters)
{ {
if(transmitter instanceof IHeatTransfer) if(transmitter instanceof MultipartTransmitter && ((MultipartTransmitter)transmitter).getPart() instanceof IHeatTransfer)
{ {
IHeatTransfer heatTransmitter = (IHeatTransfer)transmitter; IHeatTransfer heatTransmitter = (IHeatTransfer)((MultipartTransmitter)transmitter).getPart();
newSumTemp += heatTransmitter.applyTemperatureChange(); newSumTemp += heatTransmitter.applyTemperatureChange();
} }
} }

View file

@ -484,10 +484,10 @@ public final class Tier
public static enum ConductorTier public static enum ConductorTier
{ {
BASIC(5, 1, 0, new ColourRGBA(0.2, 0.2, 0.2, 1), TransmitterType.THERMODYNAMIC_CONDUCTOR_BASIC), BASIC(5, 1, 10, new ColourRGBA(0.2, 0.2, 0.2, 1), TransmitterType.THERMODYNAMIC_CONDUCTOR_BASIC),
ADVANCED(5, 1, 0, new ColourRGBA(0.2, 0.2, 0.2, 1), TransmitterType.THERMODYNAMIC_CONDUCTOR_ADVANCED), ADVANCED(5, 1, 400, new ColourRGBA(0.2, 0.2, 0.2, 1), TransmitterType.THERMODYNAMIC_CONDUCTOR_ADVANCED),
ELITE(5, 1, 0, new ColourRGBA(0.2, 0.2, 0.2, 1), TransmitterType.THERMODYNAMIC_CONDUCTOR_ELITE), ELITE(5, 1, 8000, new ColourRGBA(0.2, 0.2, 0.2, 1), TransmitterType.THERMODYNAMIC_CONDUCTOR_ELITE),
ULTIMATE(5, 1, 0, new ColourRGBA(0.2, 0.2, 0.2, 1), TransmitterType.THERMODYNAMIC_CONDUCTOR_ULTIMATE); ULTIMATE(5, 1, 100000, new ColourRGBA(0.2, 0.2, 0.2, 1), TransmitterType.THERMODYNAMIC_CONDUCTOR_ULTIMATE);
public BaseTier getBaseTier() public BaseTier getBaseTier()
{ {

View file

@ -77,6 +77,7 @@ import mekanism.common.tile.TileEntityOsmiumCompressor;
import mekanism.common.tile.TileEntityPRC; import mekanism.common.tile.TileEntityPRC;
import mekanism.common.tile.TileEntityPrecisionSawmill; import mekanism.common.tile.TileEntityPrecisionSawmill;
import mekanism.common.tile.TileEntityPurificationChamber; import mekanism.common.tile.TileEntityPurificationChamber;
import mekanism.common.tile.TileEntityResistiveHeater;
import mekanism.common.tile.TileEntityRotaryCondensentrator; import mekanism.common.tile.TileEntityRotaryCondensentrator;
import mekanism.common.tile.TileEntitySeismicVibrator; import mekanism.common.tile.TileEntitySeismicVibrator;
import mekanism.common.tile.TileEntitySolarNeutronActivator; import mekanism.common.tile.TileEntitySolarNeutronActivator;
@ -1144,7 +1145,8 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
ENTANGLED_BLOCK(MachineBlock.MACHINE_BLOCK_3, 0, "EntangledBlock", 46, TileEntityEntangledBlock.class, true, false, false), ENTANGLED_BLOCK(MachineBlock.MACHINE_BLOCK_3, 0, "EntangledBlock", 46, TileEntityEntangledBlock.class, true, false, false),
SOLAR_NEUTRON_ACTIVATOR(MachineBlock.MACHINE_BLOCK_3, 1, "SolarNeutronActivator", 47, TileEntitySolarNeutronActivator.class, false, true, false), SOLAR_NEUTRON_ACTIVATOR(MachineBlock.MACHINE_BLOCK_3, 1, "SolarNeutronActivator", 47, TileEntitySolarNeutronActivator.class, false, true, false),
AMBIENT_ACCUMULATOR(MachineBlock.MACHINE_BLOCK_3, 2, "AmbientAccumulator", 48, TileEntityAmbientAccumulator.class, true, false, false), AMBIENT_ACCUMULATOR(MachineBlock.MACHINE_BLOCK_3, 2, "AmbientAccumulator", 48, TileEntityAmbientAccumulator.class, true, false, false),
OREDICTIONIFICATOR(MachineBlock.MACHINE_BLOCK_3, 3, "Oredictionificator", 52, TileEntityOredictionificator.class, false, false, false); OREDICTIONIFICATOR(MachineBlock.MACHINE_BLOCK_3, 3, "Oredictionificator", 52, TileEntityOredictionificator.class, false, false, false),
RESISTIVE_HEATER(MachineBlock.MACHINE_BLOCK_3, 4, "ResistiveHeater", 53, TileEntityResistiveHeater.class, true, true, false);
public MachineBlock typeBlock; public MachineBlock typeBlock;
public int meta; public int meta;
@ -1195,7 +1197,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
for(MachineType type : MachineType.values()) for(MachineType type : MachineType.values())
{ {
if(type != ENTANGLED_BLOCK && type != AMBIENT_ACCUMULATOR) if(type != ENTANGLED_BLOCK && type != AMBIENT_ACCUMULATOR && type != RESISTIVE_HEATER)
{ {
ret.add(type); ret.add(type);
} }

View file

@ -121,9 +121,13 @@ public class PartThermodynamicConductor extends PartTransmitter<IHeatTransfer, H
} }
@Override @Override
protected boolean onConfigure(EntityPlayer player, int part, int side) public boolean onRightClick(EntityPlayer player, int side)
{ {
temperature += 10000; if(!world().isRemote)
{
temperature += 10000; //TODO remove
}
return true; return true;
} }

View file

@ -16,10 +16,8 @@ import mekanism.common.content.boiler.SynchronizedBoilerData;
import mekanism.common.content.boiler.SynchronizedBoilerData.ValveData; import mekanism.common.content.boiler.SynchronizedBoilerData.ValveData;
import mekanism.common.multiblock.MultiblockManager; import mekanism.common.multiblock.MultiblockManager;
import mekanism.common.util.FluidContainerUtils.ContainerEditMode; import mekanism.common.util.FluidContainerUtils.ContainerEditMode;
import mekanism.common.util.HeatUtils;
import mekanism.common.util.LangUtils; import mekanism.common.util.LangUtils;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
@ -315,7 +313,7 @@ public class TileEntityBoilerCasing extends TileEntityMultiblock<SynchronizedBoi
@Override @Override
public double getInverseConductionCoefficient() public double getInverseConductionCoefficient()
{ {
return 50; return 1;
} }
@Override @Override
@ -327,14 +325,16 @@ public class TileEntityBoilerCasing extends TileEntityMultiblock<SynchronizedBoi
@Override @Override
public void transferHeatTo(double heat) public void transferHeatTo(double heat)
{ {
heatToAbsorb += heat; if(structure != null)
{
structure.heatToAbsorb += heat;
}
} }
@Override @Override
public double[] simulateHeat() public double[] simulateHeat()
{ {
innerSide = null; return new double[] {0, 0};
return HeatUtils.simulate(this);
} }
@Override @Override
@ -349,25 +349,12 @@ public class TileEntityBoilerCasing extends TileEntityMultiblock<SynchronizedBoi
@Override @Override
public boolean canConnectHeat(ForgeDirection side) public boolean canConnectHeat(ForgeDirection side)
{ {
return structure == null || !isInnerSide(side); return structure != null;
} }
@Override @Override
public IHeatTransfer getAdjacent(ForgeDirection side) public IHeatTransfer getAdjacent(ForgeDirection side)
{ {
if(structure != null && isInnerSide(side))
{
return structure;
}
else {
TileEntity adj = Coord4D.get(this).getFromSide(side).getTileEntity(worldObj);
if(adj instanceof IHeatTransfer)
{
return (IHeatTransfer)adj;
}
}
return null; return null;
} }

View file

@ -0,0 +1,62 @@
package mekanism.common.tile;
import mekanism.api.IHeatTransfer;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.util.HeatUtils;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityResistiveHeater extends TileEntityElectricBlock implements IHeatTransfer
{
public TileEntityResistiveHeater()
{
super("ResistiveHeater", MachineType.RESISTIVE_HEATER.baseEnergy);
}
@Override
public double getTemp()
{
return 0;
}
@Override
public double getInverseConductionCoefficient()
{
return 1;
}
@Override
public double getInsulationCoefficient(ForgeDirection side)
{
return 0;
}
@Override
public void transferHeatTo(double heat)
{
}
@Override
public double[] simulateHeat()
{
return HeatUtils.simulate(this);
}
@Override
public double applyTemperatureChange()
{
return 0;
}
@Override
public boolean canConnectHeat(ForgeDirection side)
{
return false;
}
@Override
public IHeatTransfer getAdjacent(ForgeDirection side)
{
return null;
}
}

View file

@ -1,6 +1,7 @@
package mekanism.common.tile; package mekanism.common.tile;
import mekanism.api.Coord4D; import mekanism.api.Coord4D;
import mekanism.api.IHeatTransfer;
import mekanism.common.util.PipeUtils; import mekanism.common.util.PipeUtils;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.Fluid;
@ -8,7 +9,7 @@ import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler; import net.minecraftforge.fluids.IFluidHandler;
public class TileEntityThermalEvaporationValve extends TileEntityThermalEvaporationBlock implements IFluidHandler public class TileEntityThermalEvaporationValve extends TileEntityThermalEvaporationBlock implements IFluidHandler, IHeatTransfer
{ {
public boolean prevMaster = false; public boolean prevMaster = false;
@ -95,4 +96,57 @@ public class TileEntityThermalEvaporationValve extends TileEntityThermalEvaporat
return new FluidTankInfo[] {new FluidTankInfo(controller.inputTank), new FluidTankInfo(controller.outputTank)}; return new FluidTankInfo[] {new FluidTankInfo(controller.inputTank), new FluidTankInfo(controller.outputTank)};
} }
@Override
public double getTemp()
{
return 0;
}
@Override
public double getInverseConductionCoefficient()
{
return 1;
}
@Override
public double getInsulationCoefficient(ForgeDirection side)
{
return 0;
}
@Override
public void transferHeatTo(double heat)
{
TileEntityThermalEvaporationController controller = getController();
if(controller != null)
{
controller.heatToAbsorb += heat;
}
}
@Override
public double[] simulateHeat()
{
return new double[] {0, 0};
}
@Override
public double applyTemperatureChange()
{
return 0;
}
@Override
public boolean canConnectHeat(ForgeDirection side)
{
return getController() != null;
}
@Override
public IHeatTransfer getAdjacent(ForgeDirection side)
{
return null;
}
} }

View file

@ -1,18 +1,14 @@
package mekanism.common.util; package mekanism.common.util;
import mekanism.api.Coord4D;
import mekanism.api.IHeatTransfer; import mekanism.api.IHeatTransfer;
import mekanism.api.transmitters.IGridTransmitter;
import mekanism.api.transmitters.ITransmitterTile; import mekanism.api.transmitters.ITransmitterTile;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
public class HeatUtils public class HeatUtils
{ {
public static double[] simulate(IHeatTransfer source) public static double[] simulate(IHeatTransfer source)
{ {
double heatTransferred[] = new double[] {0,0}; double heatTransferred[] = new double[] {0, 0};
for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
{ {

View file

@ -240,6 +240,7 @@ public class TileEntityReactorPort extends TileEntityReactorBlock implements IFl
{ {
return getReactor().getTemp(); return getReactor().getTemp();
} }
return 0; return 0;
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB