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 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 connected IHeatExchangerLogic when 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 logic
      world - the world
      pos - block pos of the owning block entity
      direction - direction of this behaviour (from the block entity's point of view)
    • getHeatExchanger

      public IHeatExchangerLogic 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:
      serializeNBT in interface net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
    • deserializeNBT

      public void deserializeNBT(net.minecraft.nbt.CompoundTag nbt)
      Specified by:
      deserializeNBT in interface net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object