Class CauldronFluidContent

java.lang.Object
net.neoforged.neoforge.fluids.CauldronFluidContent

public final class CauldronFluidContent extends Object
Fluid content information for cauldrons.

Empty, water and lava cauldrons are registered by default, and additional cauldrons must be registered with RegisterCauldronFluidContentEvent. Contents can be queried with getForBlock(net.minecraft.world.level.block.Block) and getForFluid(net.minecraft.world.level.material.Fluid).

The CauldronFluidContent itself defines:

  • The block of the cauldron.
  • The fluid that can be accepted by the cauldron. NBT is discarded when entering the cauldron.
  • Which fluid amounts can be stored in the cauldron, and how they map to the level property of the cauldron. If levelProperty is null, then maxLevel = 1, and there is only one level. Otherwise, the levels are all the integer values between 1 and maxLevel (included).
  • totalAmount defines how much fluid (in millibuckets) there is in one level of the cauldron.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final net.minecraft.world.level.block.Block
    Block of the cauldron.
    private static final Map<net.minecraft.world.level.block.Block,CauldronFluidContent>
     
    final net.minecraft.world.level.material.Fluid
    Fluid stored inside the cauldron.
    private static final Map<net.minecraft.world.level.material.Fluid,CauldronFluidContent>
     
    final @Nullable net.minecraft.world.level.block.state.properties.IntegerProperty
    Property storing the level of the cauldron.
    final int
    Maximum level for levelProperty.
    final int
    Amount of #fluid in millibuckets in the entire full cauldron.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    CauldronFluidContent(net.minecraft.world.level.block.Block block, net.minecraft.world.level.material.Fluid fluid, int totalAmount, int maxLevel, @Nullable net.minecraft.world.level.block.state.properties.IntegerProperty levelProperty)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    currentLevel(net.minecraft.world.level.block.state.BlockState state)
    Return the current level of the cauldron given its block state, or 0 if it's an empty cauldron.
    static @Nullable CauldronFluidContent
    getForBlock(net.minecraft.world.level.block.Block block)
    Get the cauldron fluid content for a cauldron block, or null if none was registered (yet).
    static @Nullable CauldronFluidContent
    getForFluid(net.minecraft.world.level.material.Fluid fluid)
    Get the cauldron fluid content for a fluid, or null if no cauldron was registered for that fluid (yet).
    static void
     
    (package private) static void
    register(net.minecraft.world.level.block.Block block, net.minecraft.world.level.material.Fluid fluid, int totalAmount, @Nullable net.minecraft.world.level.block.state.properties.IntegerProperty levelProperty)
    Do not try to call, use the RegisterCauldronFluidContentEvent event instead.
    static void
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • block

      public final net.minecraft.world.level.block.Block block
      Block of the cauldron.
    • fluid

      public final net.minecraft.world.level.material.Fluid fluid
      Fluid stored inside the cauldron.
    • totalAmount

      public final int totalAmount
      Amount of #fluid in millibuckets in the entire full cauldron.
    • maxLevel

      public final int maxLevel
      Maximum level for levelProperty. 1 if levelProperty is null, otherwise a number >= 1. The minimum level is always 1.
    • levelProperty

      @Nullable public final @Nullable net.minecraft.world.level.block.state.properties.IntegerProperty levelProperty
      Property storing the level of the cauldron. If it's null, only one level is possible.
    • BLOCK_TO_CAULDRON

      private static final Map<net.minecraft.world.level.block.Block,CauldronFluidContent> BLOCK_TO_CAULDRON
    • FLUID_TO_CAULDRON

      private static final Map<net.minecraft.world.level.material.Fluid,CauldronFluidContent> FLUID_TO_CAULDRON
  • Constructor Details

    • CauldronFluidContent

      private CauldronFluidContent(net.minecraft.world.level.block.Block block, net.minecraft.world.level.material.Fluid fluid, int totalAmount, int maxLevel, @Nullable @Nullable net.minecraft.world.level.block.state.properties.IntegerProperty levelProperty)
  • Method Details

    • currentLevel

      public int currentLevel(net.minecraft.world.level.block.state.BlockState state)
      Return the current level of the cauldron given its block state, or 0 if it's an empty cauldron.
    • getForBlock

      @Nullable public static @Nullable CauldronFluidContent getForBlock(net.minecraft.world.level.block.Block block)
      Get the cauldron fluid content for a cauldron block, or null if none was registered (yet).
    • getForFluid

      @Nullable public static @Nullable CauldronFluidContent getForFluid(net.minecraft.world.level.material.Fluid fluid)
      Get the cauldron fluid content for a fluid, or null if no cauldron was registered for that fluid (yet).
    • init

      @Internal public static void init()
    • register

      static void register(net.minecraft.world.level.block.Block block, net.minecraft.world.level.material.Fluid fluid, int totalAmount, @Nullable @Nullable net.minecraft.world.level.block.state.properties.IntegerProperty levelProperty)
      Do not try to call, use the RegisterCauldronFluidContentEvent event instead.
    • registerCapabilities

      @Internal public static void registerCapabilities(RegisterCapabilitiesEvent event)