Package me.desht.pneumaticcraft.api.heat
Class HeatBehaviour
java.lang.Object
me.desht.pneumaticcraft.api.heat.HeatBehaviour
- All Implemented Interfaces:
net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
- Direct Known Subclasses:
HeatBehaviourFurnace,HeatBehaviourHeatFrame,HeatBehaviourLiquid
public abstract class HeatBehaviour
extends Object
implements net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
This can be used to add heat dependent logic to non-BE's or blocks from outside your own mod. For example,
PneumaticCraft uses this to power Furnaces with heat, and to turn Lava into Obsidian when heat is drained.
Of course, this requires a ticking heat exchanger block (e.g. a Compressed Iron Block or any heatable machine) to
perform the ticking behaviour; simply adding a heat behaviour to lava won't make lava spontaneously turn into
obsidian. A ticking heat exchanger adjacent to the Lava block is needed to actually drain the heat.
You can extend this class, and register the extended class via
IHeatRegistry.registerHeatBehaviour(ResourceLocation, Supplier)
For general blockstate transitions, datapack recipes are the preferred way to add custom heat behaviours. See
data/pneumaticcraft/recipes/block_heat_properties/*.json
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddeserializeNBT(net.minecraft.nbt.CompoundTag nbt) booleannet.minecraft.world.level.block.state.BlockStatenet.minecraft.world.level.block.entity.BlockEntitynet.minecraft.core.Directionabstract net.minecraft.resources.ResourceLocationgetId()Unique id for this behaviour, also used in NBT saving.net.minecraft.core.BlockPosgetPos()net.minecraft.world.level.LevelgetWorld()inthashCode()initialize(IHeatExchangerLogic connectedHeatLogic, net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, net.minecraft.core.Direction direction) This method is called by the connectedIHeatExchangerLogicwhen it initialises itself as a hull heat exchanger; this happens when the owning block entity gets a neighbor block update.abstract booleanReturn true when this heat behaviour is applicable for this coordinate.net.minecraft.nbt.CompoundTagabstract voidtick()Called every tick to update this behaviour.
-
Constructor Details
-
HeatBehaviour
public HeatBehaviour()
-
-
Method Details
-
initialize
public HeatBehaviour initialize(IHeatExchangerLogic connectedHeatLogic, net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, net.minecraft.core.Direction direction) This method is called by the connectedIHeatExchangerLogicwhen it initialises itself as a hull heat exchanger; this happens when the owning block entity gets a neighbor block update. You can override and extend this method, but be sure to call the super method!- Parameters:
connectedHeatLogic- the connected heat exchanger logicworld- the worldpos- block pos of the owning block entitydirection- direction of this behaviour (from the block entity's point of view)
-
getHeatExchanger
-
getWorld
public net.minecraft.world.level.Level getWorld() -
getPos
public net.minecraft.core.BlockPos getPos() -
getDirection
public net.minecraft.core.Direction getDirection() -
getCachedTileEntity
public net.minecraft.world.level.block.entity.BlockEntity getCachedTileEntity() -
getBlockState
public net.minecraft.world.level.block.state.BlockState getBlockState() -
getId
public abstract net.minecraft.resources.ResourceLocation getId()Unique id for this behaviour, also used in NBT saving.- Returns:
- a unique ID
-
isApplicable
public abstract boolean isApplicable()Return true when this heat behaviour is applicable for this coordinate. World access methods can be used here (getWorld(), getPos(), getBlockState(), getTileEntity()).- Returns:
- true if this behaviour is applicable here
-
tick
public abstract void tick()Called every tick to update this behaviour. -
serializeNBT
public net.minecraft.nbt.CompoundTag serializeNBT()- Specified by:
serializeNBTin interfacenet.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
-
deserializeNBT
public void deserializeNBT(net.minecraft.nbt.CompoundTag nbt) - Specified by:
deserializeNBTin interfacenet.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
-
equals
-
hashCode
public int hashCode()
-