public interface IHeatExchangerLogic
extends net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundNBT>
PNCCapabilities.HEAT_EXCHANGER_CAPABILITY or get your own
instance with @CapabilityInject.
If you are implementing a tile entity with a heat exchanger, you should not implement this
interface yourself; get an instance of it via IHeatRegistry.makeHeatExchangerLogic(), store it as field
in your TE, and provide via capability as described above. Your TE should also call tick() and
initializeAsHull(World, BlockPos, BiPredicate, Direction...) as documented in those methods.
If you want to attach this capability as an adapater to other mods' heat systems, see
IHeatExchangerAdapter and IHeatExchangerAdapter.Simple which are convenience extensions and
implementations of this interface.
| Modifier and Type | Field and Description |
|---|---|
static java.util.function.BiPredicate<net.minecraft.world.IWorld,net.minecraft.util.math.BlockPos> |
ALL_BLOCKS |
| Modifier and Type | Method and Description |
|---|---|
default void |
addConnectedExchanger(IHeatExchangerLogic exchanger)
When called, this will create a thermal connection between this heat exchanger and the given one.
|
default void |
addConnectedExchanger(IHeatExchangerLogic exchanger,
boolean reciprocate) |
void |
addHeat(double amount)
Adds heat (= deltaT * Thermal Capacity) to this exchanger.
|
default void |
deserializeNBT(net.minecraft.nbt.CompoundNBT nbt) |
double |
getAmbientTemperature()
Get the heat exchanger's ambient temperature, i.e.
|
default <T extends HeatBehaviour<?>> |
getHeatBehaviour(net.minecraft.util.math.BlockPos pos,
java.lang.Class<T> cls)
Get the
HeatBehaviour at the given position, which must be adjacent to this heat exchanger's owning tile
entity, and in this heat exchanger's list of heat behaviours that it handles. |
double |
getTemperature()
Get the heat exchanger's current (precise) temperature.
|
int |
getTemperatureAsInt()
Get the heat exchanger's current temperature to the nearest integer.
|
double |
getThermalCapacity()
Get this heat exchanger's thermal capacity.
|
double |
getThermalResistance()
Get this heat exchanger's thermal resistance.
|
void |
initializeAmbientTemperature(net.minecraft.world.World world,
net.minecraft.util.math.BlockPos pos)
Initialize this heat exchanger's ambient temperature based on the given world & position.
|
void |
initializeAsHull(net.minecraft.world.World world,
net.minecraft.util.math.BlockPos pos,
java.util.function.BiPredicate<net.minecraft.world.IWorld,net.minecraft.util.math.BlockPos> blockFilter,
net.minecraft.util.Direction... validSides)
When called (on tile entity first tick and on neighbor block updates), this discovers all heat
exchanging neighbor tile entities as connected heat exchangers (i.e.
|
boolean |
isSideConnected(net.minecraft.util.Direction side)
Check if this side of the heat exchanger has a thermal connection of any kind to the neighbouring block in the
given direction; whether to another heat exchanger, a static heat source like air, or a custom handler such as
a furnace or heat frame.
|
default void |
removeConnectedExchanger(IHeatExchangerLogic exchanger)
Disconnect a connected heat exchanger which was connected via
addConnectedExchanger(IHeatExchangerLogic) |
default void |
removeConnectedExchanger(IHeatExchangerLogic exchanger,
boolean reciprocate) |
default net.minecraft.nbt.CompoundNBT |
serializeNBT() |
void |
setTemperature(double temperature)
Set the temperature of this heat exchanger.
|
void |
setThermalCapacity(double capacity)
Set this heat exchanger's thermal capacity.
|
void |
setThermalResistance(double thermalResistance)
The higher the thermal resistance, the slower the heat disperses.
|
void |
tick()
Call this to tick this logic, and make the heat disperse itself.
|
static final java.util.function.BiPredicate<net.minecraft.world.IWorld,net.minecraft.util.math.BlockPos> ALL_BLOCKS
void tick()
tick() method, on the server side only.void initializeAsHull(net.minecraft.world.World world,
net.minecraft.util.math.BlockPos pos,
java.util.function.BiPredicate<net.minecraft.world.IWorld,net.minecraft.util.math.BlockPos> blockFilter,
net.minecraft.util.Direction... validSides)
IHeatExchangerLogic capability on that side). It will also account for neighbouring blocks with
special heat properties, like Magma or Lava, and other special cases like Heat Frames (which are entities).
You don't need to call this method if this heat exchanger is not connected to the outside world (e.g. the connecting heat exchanger within a Vortex Tube).
world - the worldpos - the positionblockFilter - a whitelist check; can be used to exclude certain blocks, e.g. air or fluidsvalidSides - an array of sides to check for heat exchanging neighboursvoid initializeAmbientTemperature(net.minecraft.world.World world,
net.minecraft.util.math.BlockPos pos)
IHeatExchangerLogic object via
capability lookup), as hulls are automatically initialized by
initializeAsHull(World, BlockPos, BiPredicate, Direction...)world - the worldpos - the positiondefault void addConnectedExchanger(IHeatExchangerLogic exchanger)
You don't need to call this method if your TE just has one heat exchanger to
expose to the world; in that case initializeAsHull(World, BlockPos, BiPredicate, Direction...) will
handle connecting your TE's heat exchanger to neighbouring blocks.
You should only call this method on one of the two heat exchangers being connected; a reciprocal connection on the target heat exchanger will automatically be added.
exchanger - the other heat exchangerdefault void addConnectedExchanger(IHeatExchangerLogic exchanger, boolean reciprocate)
exchanger - the other heat exchangerreciprocate - whether the other exchanger should also add this onedefault void removeConnectedExchanger(IHeatExchangerLogic exchanger)
addConnectedExchanger(IHeatExchangerLogic)exchanger - the other heat exchangerdefault void removeConnectedExchanger(IHeatExchangerLogic exchanger, boolean reciprocate)
exchanger - the other heat exchangerreciprocate - whether the other exchanger should also add this onevoid setTemperature(double temperature)
temperature - in degrees Kelvindouble getTemperature()
getTemperatureAsInt() there instead.int getTemperatureAsInt()
double getAmbientTemperature()
void setThermalResistance(double thermalResistance)
thermalResistance - the thermal resistance; higher resistance means slower heat transferdouble getThermalResistance()
setThermalResistance(double) for more information
on thermal resistance.void setThermalCapacity(double capacity)
The higher the capacity, the more heat can be 'stored'. E.g. an object with a heat capacity of double the heat capacity of another object will require twice as much heat gain or loss to adjust the temperature by the same amount.
capacity - the thermal capacitydouble getThermalCapacity()
setThermalCapacity(double) for more information.void addHeat(double amount)
amount - the heat amountboolean isSideConnected(net.minecraft.util.Direction side)
initializeAsHull(World, BlockPos, BiPredicate, Direction...).side - the side to checkdefault net.minecraft.nbt.CompoundNBT serializeNBT()
serializeNBT in interface net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundNBT>default void deserializeNBT(net.minecraft.nbt.CompoundNBT nbt)
deserializeNBT in interface net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundNBT>default <T extends HeatBehaviour<?>> java.util.Optional<T> getHeatBehaviour(net.minecraft.util.math.BlockPos pos, java.lang.Class<T> cls)
HeatBehaviour at the given position, which must be adjacent to this heat exchanger's owning tile
entity, and in this heat exchanger's list of heat behaviours that it handles.T - pos - position of the heat behaviourcls - required class of the heat behaviour (any heat behaviour which extends this class will match)Optional.empty() the position is invalid or there is no matching
heat behaviour there