Package net.neoforged.neoforge.fluids
Class RegisterCauldronFluidContentEvent
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.fluids.RegisterCauldronFluidContentEvent
- All Implemented Interfaces:
net.neoforged.fml.event.IModBusEvent
public class RegisterCauldronFluidContentEvent
extends net.neoforged.bus.api.Event
implements net.neoforged.fml.event.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 Capabilities.FluidHandler.BLOCK
capability.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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.
-
Constructor Details
-
RegisterCauldronFluidContentEvent
RegisterCauldronFluidContentEvent()
-
-
Method Details
-
register
public void register(Block block, Fluid fluid, int totalAmount, @Nullable @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)
andBlockBehaviour.onRemove(BlockState, Level, BlockPos, BlockState, boolean)
must be overridden to invalidate capabilities when the block changes! See how NeoForge patchesAbstractCauldronBlock
for reference.- Parameters:
block
- the block of the cauldronfluid
- the fluid stored in this cauldrontotalAmount
- how much fluid can fit in the cauldron at maximum capacity, in millibucketslevelProperty
- the property used by the cauldron to store its levels, ornull
if the cauldron only has one level
-