Package me.desht.pneumaticcraft.api.heat
Interface IHeatExchangerAdapter
- All Superinterfaces:
IHeatExchangerLogic,net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
- All Known Implementing Classes:
IHeatExchangerAdapter.Simple,Mek2PNCHeatProvider.Mek2PNCHeatAdapter
A special extension of
IHeatExchangerLogic intended for implementing adapter objects for other mods' heat
systems. An implementation of this can be attached to other mods' tile entities to make them appear like PNC heat
exchanging blocks, while internally adapting the PNC heat API to the block's actual heat API.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classConvenience adapter implementation which can be extended. -
Field Summary
Fields inherited from interface me.desht.pneumaticcraft.api.heat.IHeatExchangerLogic
ALL_BLOCKS -
Method Summary
Modifier and TypeMethodDescriptiondefault intGet the heat exchanger's current temperature to the nearest integer.default voidinitializeAmbientTemperature(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos) Initialize this heat exchanger's ambient temperature based on the given world & position.default voidinitializeAsHull(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, BiPredicate<net.minecraft.world.level.LevelAccessor, net.minecraft.core.BlockPos> blockFilter, net.minecraft.core.Direction... validSides) Discovers all heat exchanging neighbor block entities (i.e.default voidsetTemperature(double temperature) Set the temperature of this heat exchanger.default voidsetThermalCapacity(double capacity) Set this heat exchanger's thermal capacity.default voidsetThermalResistance(double thermalResistance) The higher the thermal resistance, the slower the heat disperses.default voidtick()Call this to tick this logic, and make the heat disperse itself.Methods inherited from interface me.desht.pneumaticcraft.api.heat.IHeatExchangerLogic
addConnectedExchanger, addConnectedExchanger, addHeat, deserializeNBT, getAmbientTemperature, getHeatBehaviour, getTemperature, getThermalCapacity, getThermalResistance, isSideConnected, removeConnectedExchanger, removeConnectedExchanger, serializeNBT
-
Method Details
-
tick
default void tick()Description copied from interface:IHeatExchangerLogicCall this to tick this logic, and make the heat disperse itself. In general this should be called each tick by the owning block entity'stick()method, on the server side only.- Specified by:
tickin interfaceIHeatExchangerLogic
-
initializeAsHull
default void initializeAsHull(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, BiPredicate<net.minecraft.world.level.LevelAccessor, net.minecraft.core.BlockPos> blockFilter, net.minecraft.core.Direction... validSides) Description copied from interface:IHeatExchangerLogicDiscovers all heat exchanging neighbor block entities (i.e. block entities who provide theIHeatExchangerLogiccapability on that side) and adds them as connected heat exchangers. It also accounts for neighbouring blocks with special heat properties, like Magma or Lava, and other special cases like Heat Frames (which are entities).This should be called by the owning block entity on first tick (
IForgeBlockEntity.onLoad()is suitable) and when neighboring blocks update (BlockBehaviour.neighborChanged(BlockState, Level, BlockPos, Block, BlockPos, boolean).You don't need to call this method if this heat exchanger is not connected to the outside world (e.g. the internal connecting heat exchanger within a Vortex Tube).
- Specified by:
initializeAsHullin interfaceIHeatExchangerLogic- Parameters:
world- the worldpos- the blockpos of the owning block entityblockFilter- a whitelist check; can be used to exclude certain blocks, e.g. air or fluids. In most cases,IHeatExchangerLogic.ALL_BLOCKScan be passed here.validSides- an array of sides to check for heat exchanging neighbours
-
initializeAmbientTemperature
default void initializeAmbientTemperature(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos) Description copied from interface:IHeatExchangerLogicInitialize this heat exchanger's ambient temperature based on the given world & position. You don't need to call this method if your heat exchanger is a hull exchanger (i.e. provides anIHeatExchangerLogicobject via capability lookup), as such heat exchangers are automatically initialized byIHeatExchangerLogic.initializeAsHull(Level, BlockPos, BiPredicate, Direction...).- Specified by:
initializeAmbientTemperaturein interfaceIHeatExchangerLogic- Parameters:
world- the worldpos- the position
-
setTemperature
default void setTemperature(double temperature) Description copied from interface:IHeatExchangerLogicSet the temperature of this heat exchanger. By default, heat exchangers start with a temperature equal to the ambient temperature (in the case of non-hull exchangers which have not been initialized, the default temperature is 300K, the Forge-defined temperature of water).- Specified by:
setTemperaturein interfaceIHeatExchangerLogic- Parameters:
temperature- in degrees Kelvin
-
getTemperatureAsInt
default int getTemperatureAsInt()Description copied from interface:IHeatExchangerLogicGet the heat exchanger's current temperature to the nearest integer. This is sync'd to clients rather than the precise floating-point temperature to avoid excessive network chatter.- Specified by:
getTemperatureAsIntin interfaceIHeatExchangerLogic- Returns:
- the temperature to the nearest integer
-
setThermalResistance
default void setThermalResistance(double thermalResistance) Description copied from interface:IHeatExchangerLogicThe higher the thermal resistance, the slower the heat disperses. The effective resistance is the sum of this resistance plus the neighbour's resistance; if both exchangers have a resistance of 1, heat will equalize in a single tick under normal circumstances.- Specified by:
setThermalResistancein interfaceIHeatExchangerLogic- Parameters:
thermalResistance- the thermal resistance; higher resistance means slower heat transfer
-
setThermalCapacity
default void setThermalCapacity(double capacity) Description copied from interface:IHeatExchangerLogicSet this heat exchanger's thermal 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.
- Specified by:
setThermalCapacityin interfaceIHeatExchangerLogic- Parameters:
capacity- the thermal capacity
-