Class RegisterCauldronFluidContentEvent

java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.fluids.RegisterCauldronFluidContentEvent
All Implemented Interfaces:
IModBusEvent

public class RegisterCauldronFluidContentEvent extends net.neoforged.bus.api.Event implements IModBusEvent
Event to register CauldronFluidContent for modded cauldrons.

Registering cauldrons is done by calling CauldronFluidContent.register(net.minecraft.world.level.block.Block, net.minecraft.world.level.material.Fluid, int, net.minecraft.world.level.block.state.properties.IntegerProperty) and allows all cauldrons registered in this way to interoperate with each other when accessed via the

invalid reference
Capabilities.FluidHandler#BLOCK
capability.
  • Constructor Details

    • RegisterCauldronFluidContentEvent

      RegisterCauldronFluidContentEvent()
  • Method Details

    • register

      public void register(Block block, Fluid fluid, int totalAmount, @Nullable IntegerProperty levelProperty)
      Register a new cauldron, allowing it to be filled and emptied through the standard capability. In both cases, return the content of the cauldron, either the existing one, or the newly registered one.

      If the block is not a subclass of AbstractCauldronBlock, BlockBehaviour.onPlace(BlockState, Level, BlockPos, BlockState, boolean) and

      invalid reference
      BlockBehaviour#onRemove(BlockState, Level, BlockPos, BlockState, boolean)
      must be overridden to invalidate capabilities when the block changes! See how NeoForge patches AbstractCauldronBlock for reference.
      Parameters:
      block - the block of the cauldron
      fluid - the fluid stored in this cauldron
      totalAmount - how much fluid can fit in the cauldron at maximum capacity, in millibuckets
      levelProperty - the property used by the cauldron to store its levels, or null if the cauldron only has one level